薪酬系统-福利档案,福利档案编辑保存逻辑中增加基数调整记录
This commit is contained in:
parent
e80a3497d9
commit
0225e40e57
|
|
@ -662,8 +662,22 @@ public class SIArchivesBiz {
|
|||
otherIds.add(param.getId());
|
||||
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherById(otherIds);
|
||||
|
||||
//设置福利档案基数调整记录数据
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(param.getOtherSchemeId())
|
||||
.adjustAfterBaseJson(paramReq.getPaymentForm())
|
||||
.welfareType(paramReq.getWelfareType().getValue())
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build();
|
||||
|
||||
if (oldOtherInfoList.size() == 1) {
|
||||
InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0);
|
||||
//设置福利档案基数调整记录数据
|
||||
encryptUtil.decrypt(oldOtherInfo, InsuranceArchivesOtherSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldOtherInfo.getOtherPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldOtherInfo.getOtherSchemeId());
|
||||
//新数据
|
||||
InsuranceArchivesOtherSchemePO updateOtherInfo =
|
||||
InsuranceArchivesOtherSchemePO.builder()
|
||||
.id(oldOtherInfo.getId())
|
||||
|
|
@ -740,10 +754,13 @@ public class SIArchivesBiz {
|
|||
} else {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//生成福利档案基数调整记录数据
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = createAdjustInfo(adjustInfo, employeeId);
|
||||
//福利档案基数调整记录数据入库
|
||||
batchInsertAdjustHistory(adjustHistoryList, employeeId);
|
||||
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
|
@ -771,8 +788,22 @@ public class SIArchivesBiz {
|
|||
fundIds.add(param.getId());
|
||||
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundById(fundIds);
|
||||
|
||||
//设置福利档案基数调整记录数据
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(param.getFundSchemeId())
|
||||
.adjustAfterBaseJson(paramReq.getPaymentForm())
|
||||
.welfareType(paramReq.getWelfareType().getValue())
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build();
|
||||
|
||||
if (oldFundInfoList.size() == 1) {
|
||||
InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0);
|
||||
//设置福利档案基数调整记录数据
|
||||
encryptUtil.decrypt(oldFundInfo, InsuranceArchivesFundSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldFundInfo.getFundPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldFundInfo.getFundSchemeId());
|
||||
//新数据
|
||||
InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder()
|
||||
.id(oldFundInfo.getId())
|
||||
.fundSchemeId(param.getFundSchemeId())
|
||||
|
|
@ -855,6 +886,11 @@ public class SIArchivesBiz {
|
|||
|
||||
}
|
||||
|
||||
//生成福利档案基数调整记录数据
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = createAdjustInfo(adjustInfo, employeeId);
|
||||
//福利档案基数调整记录数据入库
|
||||
batchInsertAdjustHistory(adjustHistoryList, employeeId);
|
||||
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
|
@ -888,10 +924,25 @@ public class SIArchivesBiz {
|
|||
List<Long> socialIds = new ArrayList();
|
||||
socialIds.add(param.getId());
|
||||
List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialById(socialIds);
|
||||
|
||||
//设置福利档案基数调整记录数据
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(param.getSocialSchemeId())
|
||||
.adjustAfterBaseJson(paramReq.getPaymentForm())
|
||||
.welfareType(paramReq.getWelfareType().getValue())
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build();
|
||||
|
||||
//组装新数据
|
||||
if (oldSocialInfoList.size() == 1) {
|
||||
//老数据
|
||||
InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0);
|
||||
|
||||
//设置福利档案基数调整记录数据
|
||||
encryptUtil.decrypt(oldSocialInfo, InsuranceArchivesSocialSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldSocialInfo.getSocialPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldSocialInfo.getSocialSchemeId());
|
||||
//新数据
|
||||
InsuranceArchivesSocialSchemePO updateSocialInfo =
|
||||
InsuranceArchivesSocialSchemePO.builder()
|
||||
.id(oldSocialInfo.getId())
|
||||
|
|
@ -974,6 +1025,10 @@ public class SIArchivesBiz {
|
|||
|
||||
}
|
||||
|
||||
//生成福利档案基数调整记录数据
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = createAdjustInfo(adjustInfo, employeeId);
|
||||
//福利档案基数调整记录数据入库
|
||||
batchInsertAdjustHistory(adjustHistoryList, employeeId);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
|
@ -1818,9 +1873,10 @@ public class SIArchivesBiz {
|
|||
return getInsuranceBaseInfoMapper().listEndDateIsNull(employeeIds);
|
||||
}
|
||||
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealSocialBaseAdjustInfoList(List<InsuranceArchivesSocialSchemePO> adjustList) {
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealSocialBaseAdjustInfoList(List<InsuranceArchivesSocialSchemePO> adjustList, Long creator) {
|
||||
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());
|
||||
|
|
@ -1835,20 +1891,22 @@ public class SIArchivesBiz {
|
|||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesSocialSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesSocialSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getSocialPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getSocialSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
|
||||
}
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealFundBaseAdjustInfoList(List<InsuranceArchivesFundSchemePO> adjustList) {
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealFundBaseAdjustInfoList(List<InsuranceArchivesFundSchemePO> adjustList, Long creator) {
|
||||
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());
|
||||
|
|
@ -1863,19 +1921,21 @@ public class SIArchivesBiz {
|
|||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesFundSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesFundSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getFundPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getFundSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
}
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealOtherBaseAdjustInfoList(List<InsuranceArchivesOtherSchemePO> adjustList) {
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealOtherBaseAdjustInfoList(List<InsuranceArchivesOtherSchemePO> adjustList, Long creator) {
|
||||
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());
|
||||
|
|
@ -1890,19 +1950,23 @@ public class SIArchivesBiz {
|
|||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesOtherSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesOtherSchemePO.class);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getOtherPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getOtherSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
}
|
||||
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> createAdjustInfo(InsuranceArchivesBaseAdjustHistoryDTO adjustInfo) {
|
||||
//生成基数调整记录(基数单元未变化则忽略)
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> createAdjustInfo(InsuranceArchivesBaseAdjustHistoryDTO adjustInfo, Long creator) {
|
||||
Date now = new Date();
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> toCreateAdjustHistoryList = new ArrayList<>();
|
||||
//旧档案不存在基数信息,则直接遍历新的基数数据,生成调整记录;旧档案存在基数信息,则合并新旧基数数据,遍历合并后的技术数据中的key,生成调整记录。
|
||||
if(adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() == null) {
|
||||
Map<String, Object> adjustAfterBaseMap = JSON.parseObject(adjustInfo.getAdjustAfterBaseJson(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
|
@ -1911,7 +1975,14 @@ public class SIArchivesBiz {
|
|||
BeanUtils.copyProperties(adjustInfo, adjustItem);
|
||||
adjustItem.setAdjustWelfareItemId(Long.valueOf(key));
|
||||
adjustItem.setAdjustAfterBaseValue((String) adjustAfterBaseMap.get(key));
|
||||
|
||||
adjustItem.setOperateTime(now);
|
||||
adjustItem.setOperator(creator);
|
||||
adjustItem.setCreator(creator);
|
||||
adjustItem.setCreateTime(now);
|
||||
adjustItem.setUpdateTime(now);
|
||||
adjustItem.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
adjustItem.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
adjustItem.setId(IdGenerator.generate());
|
||||
toCreateAdjustHistoryList.add(adjustItem);
|
||||
}
|
||||
} else if (adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() != null) {
|
||||
|
|
@ -1933,6 +2004,14 @@ public class SIArchivesBiz {
|
|||
adjustItem.setAdjustWelfareItemId(Long.valueOf(key));
|
||||
adjustItem.setAdjustBeforeBaseValue(beforeValue);
|
||||
adjustItem.setAdjustAfterBaseValue(afterValue);
|
||||
adjustItem.setOperateTime(now);
|
||||
adjustItem.setOperator(creator);
|
||||
adjustItem.setCreator(creator);
|
||||
adjustItem.setCreateTime(now);
|
||||
adjustItem.setUpdateTime(now);
|
||||
adjustItem.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
adjustItem.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
adjustItem.setId(IdGenerator.generate());
|
||||
|
||||
toCreateAdjustHistoryList.add(adjustItem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<result column="id" property="id"/>
|
||||
<result column="employee_id" property="employeeId"/>
|
||||
<result column="payment_organization" property="paymentOrganization"/>
|
||||
<result column="welfare_type" property="welfareType"/>
|
||||
<result column="adjust_before_scheme_id" property="adjustBeforeSchemeId"/>
|
||||
<result column="adjust_after_scheme_id" property="adjustAfterSchemeId"/>
|
||||
<result column="adjust_before_base_value" property="adjustBeforeBaseValue"/>
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
t.id
|
||||
, t.employee_id
|
||||
, t.payment_organization
|
||||
, t.welfare_type
|
||||
, t.adjust_before_scheme_id
|
||||
, t.adjust_after_scheme_id
|
||||
, t.adjust_before_base_value
|
||||
|
|
@ -42,7 +44,7 @@
|
|||
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
(id,employee_id,payment_organization,welfare_type,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
|
|
@ -53,6 +55,7 @@
|
|||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.paymentOrganization},
|
||||
#{item.welfareType},
|
||||
#{item.adjustBeforeSchemeId},
|
||||
#{item.adjustAfterSchemeId},
|
||||
#{item.adjustBeforeBaseValue},
|
||||
|
|
@ -70,7 +73,7 @@
|
|||
</insert>
|
||||
<insert id="batchSave" databaseId="oracle">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
(id,employee_id,payment_organization,welfare_type,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
|
|
@ -80,6 +83,7 @@
|
|||
#{item.id,jdbcType=DOUBLE},
|
||||
#{item.employeeId,jdbcType=DOUBLE},
|
||||
#{item.paymentOrganization,jdbcType=DOUBLE},
|
||||
#{item.welfareType,jdbcType=DOUBLE},
|
||||
#{item.adjustBeforeSchemeId,jdbcType=DOUBLE},
|
||||
#{item.adjustAfterSchemeId,jdbcType=DOUBLE},
|
||||
#{item.adjustBeforeBaseValue,jdbcType=VARCHAR},
|
||||
|
|
@ -98,7 +102,7 @@
|
|||
<insert id="batchSave" databaseId="sqlserver">
|
||||
<foreach collection="infos" item="item" separator=";">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
(id,employee_id,payment_organization,welfare_type,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
|
|
@ -108,6 +112,7 @@
|
|||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.paymentOrganization},
|
||||
#{item.welfareType},
|
||||
#{item.adjustBeforeSchemeId},
|
||||
#{item.adjustAfterSchemeId},
|
||||
#{item.adjustBeforeBaseValue},
|
||||
|
|
|
|||
|
|
@ -1385,7 +1385,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustSocialHistoryPOList = siArchivesBiz.dealSocialBaseAdjustInfoList(socialSchemePOS);
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustSocialHistoryPOList = siArchivesBiz.dealSocialBaseAdjustInfoList(socialSchemePOS, (long) user.getUID());
|
||||
|
||||
//根据人员id和个税扣缴义务人id删除对应旧档案
|
||||
socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
|
@ -1407,7 +1407,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustFundHistoryPOList = siArchivesBiz.dealFundBaseAdjustInfoList(fundSchemePOS);
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustFundHistoryPOList = siArchivesBiz.dealFundBaseAdjustInfoList(fundSchemePOS, (long) user.getUID());
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
//新建新档案
|
||||
|
|
@ -1426,7 +1426,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustOtherHistoryPOList = siArchivesBiz.dealOtherBaseAdjustInfoList(otherSchemePOS);
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustOtherHistoryPOList = siArchivesBiz.dealOtherBaseAdjustInfoList(otherSchemePOS, (long) user.getUID());
|
||||
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue