!8 社保档案详情-保存等接口

Merge pull request !8 from reset/archive
This commit is contained in:
reset 2022-03-17 07:28:29 +00:00 committed by Gitee
commit 4749bdbdc4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 607 additions and 11 deletions

View File

@ -13,6 +13,8 @@ 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.param.InsuranceArchivesFundSaveParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesOtherSaveParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSocialSaveParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
@ -40,6 +42,7 @@ import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.Util;
import weaver.hrm.User;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -408,10 +411,10 @@ public class SIArchivesBiz {
socialSave(param, employeeId);
break;
case ACCUMULATION_FUND:
//fundSave(param, employeeId);
fundSave(param, employeeId);
break;
case OTHER:
//otherSave(param, employeeId);
otherSave(param, employeeId);
break;
default:
throw new SalaryRunTimeException("福利类型不存在");
@ -419,6 +422,84 @@ public class SIArchivesBiz {
}
/**
*
* @param paramReq
* @param employeeId
*/
public void otherSave(InsuranceArchivesSaveParam paramReq, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
InsuranceArchivesOtherSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesOtherSaveParam.class);
SalaryAssert.notNull( "员工id为空", param, param.getEmployeeId());
otherSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO =
InsuranceArchivesOtherSchemePO.builder()
.otherSchemeId(param.getOtherName())
.otherStartTime(param.getOtherStartTime())
.underTake(param.getUnderTake().getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.welfareType(paramReq.getWelfareType().getValue())
.otherEndTime(param.getOtherEndTime())
.employeeId(param.getEmployeeId())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.updateTime(new Date())
.createTime(new Date())
//.id(IdGenerator.generate())
.nonPayment(param.getNonPayment())
.creator(employeeId)
.paymentOrganization(param.getPaymentOrganization())
.otherPaymentBaseString(paramReq.getPaymentForm())
.build();
otherSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesOtherSchemePO));
sqlSession.commit();
}finally {
sqlSession.close();
}
}
/**
*
* @param paramReq
* @param employeeId
*/
public void fundSave(InsuranceArchivesSaveParam paramReq, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
InsuranceArchivesFundSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesFundSaveParam.class);
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
fundSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = InsuranceArchivesFundSchemePO.builder()
.fundSchemeId(param.getFundName())
.fundAccount(param.getFundAccount())
.fundEndTime(param.getFundEndTime())
.fundStartTime(param.getFundStartTime())
.fundPaymentBaseString(paramReq.getPaymentForm())
.supplementFundAccount(param.getSupplementFundAccount())
//.id(IdGenerator.generate())
.createTime(new Date())
.creator(employeeId)
.nonPayment(param.getNonPayment())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.underTake(param.getUnderTake().getValue())
.paymentOrganization(param.getPaymentOrganization())
.updateTime(new Date())
.welfareType(paramReq.getWelfareType().getValue())
.employeeId(param.getEmployeeId())
.build();
fundSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesFundSchemePO));
sqlSession.commit();
}finally {
sqlSession.close();
}
}
/**
*
* @param paramReq

View File

@ -0,0 +1,60 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO 公积金档案保存
* @Date 2022/3/17
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceArchivesFundSaveParam {
//主键id
private Long id;
//员工id
private Long employeeId;
//暂不缴纳
private Integer nonPayment;
//福利类型
private WelfareTypeEnum welfareType;
//公积金起始缴纳月
private String fundStartTime;
//公积金最后缴纳月
private String fundEndTime;
//公积金方案id
private Long fundSchemeId;
//公积金方案id
private Long fundName;
//公积金账号
private String fundAccount;
//补充公积金账号
private String supplementFundAccount;
//公积金缴纳组织
private Long paymentOrganization;
//公积金个人实际承担方
private UndertakerEnum underTake;
//公积金基数jsonString
private String paymentForm;
}

View File

@ -0,0 +1,54 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.enums.sicategory.UndertakerEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO 其他福利档案保存
* @Date 2022/3/17
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceArchivesOtherSaveParam {
//主键id
private Long id;
//员工id
private Long employeeId;
//暂不缴纳
private Integer nonPayment;
//福利类型
private WelfareTypeEnum welfareType;
//其他福利起始缴纳月
private String otherStartTime;
//其他福利最后缴纳月
private String otherEndTime;
//其他福利方案id
private Long otherSchemeId;
//其他福利方案id")
private Long otherName;
//其他福利缴纳组织
private Long paymentOrganization;
//其他福利个人实际承担方
private UndertakerEnum underTake;
//其他福利基数jsonString
private String paymentForm;
}

View File

@ -3,6 +3,9 @@ package com.engine.salary.mapper.siarchives;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
@ -17,4 +20,17 @@ public interface FundSchemeMapper {
* @return
*/
InsuranceArchivesFundSchemePO getFundByEmployeeId(@Param("employeeId")Long employeeId);
/**
* 批量删除
* @param singletonList
*/
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
/**
* 批量保存
* @param singletonList
*/
void batchSave(@Param("fundSchemePOS") List<InsuranceArchivesFundSchemePO> singletonList);
}

View File

@ -51,6 +51,138 @@
WHERE employee_id = #{employeeId} AND delete_type = 0
</select>
<!-- 批量删除 -->
<delete id="batchDeleteByEmployeeIds">
UPDATE hrsa_fund_archives
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
</delete>
<!-- 批量保存 -->
<insert id="batchSave">
INSERT INTO hrsa_fund_archives(
fund_scheme_id,
fund_account,
fund_end_time,
fund_start_time,
fund_payment_base_string,
supplement_fund_account,
create_time,
creator,
non_payment,
delete_type,
tenant_key,
under_take,
payment_organization,
update_time,
welfare_type,
employee_id)
VALUES
<foreach collection="fundSchemePOS" item="item" separator=",">
(
#{item.fundSchemeId},
#{item.fundAccount},
#{item.fundEndTime},
#{item.fundStartTime},
#{item.fundPaymentBaseString},
#{item.supplementFundAccount}
#{item.createTime}
#{item.creator}
#{item.nonPayment}
#{item.deleteType}
#{item.tenantKey}
#{item.underTake}
#{item.paymentOrganization}
#{item.updateTime}
#{item.welfareType}
#{item.employeeId}
)
</foreach>
</insert>
<insert id="batchSave" databaseId="oracle">
INSERT INTO hrsa_fund_archives(
fund_scheme_id,
fund_account,
fund_end_time,
fund_start_time,
fund_payment_base_string,
supplement_fund_account,
create_time,
creator,
non_payment,
delete_type,
tenant_key,
under_take,
payment_organization,
update_time,
welfare_type,
employee_id)
<foreach collection="fundSchemePOS" item="item" separator="union all">
select
#{item.fundSchemeId},
#{item.fundAccount},
#{item.fundEndTime},
#{item.fundStartTime},
#{item.fundPaymentBaseString},
#{item.supplementFundAccount}
#{item.createTime}
#{item.creator}
#{item.nonPayment}
#{item.deleteType}
#{item.tenantKey}
#{item.underTake}
#{item.paymentOrganization}
#{item.updateTime}
#{item.welfareType}
#{item.employeeId}
from dual
</foreach>
</insert>
<insert id="batchSave" databaseId="sqlserver">
INSERT INTO hrsa_fund_archives(
fund_scheme_id,
fund_account,
fund_end_time,
fund_start_time,
fund_payment_base_string,
supplement_fund_account,
create_time,
creator,
non_payment,
delete_type,
tenant_key,
under_take,
payment_organization,
update_time,
welfare_type,
employee_id)
VALUES
<foreach collection="fundSchemePOS" item="item" separator=",">
(
#{item.fundSchemeId},
#{item.fundAccount},
#{item.fundEndTime},
#{item.fundStartTime},
#{item.fundPaymentBaseString},
#{item.supplementFundAccount}
#{item.createTime}
#{item.creator}
#{item.nonPayment}
#{item.deleteType}
#{item.tenantKey}
#{item.underTake}
#{item.paymentOrganization}
#{item.updateTime}
#{item.welfareType}
#{item.employeeId}
)
</foreach>
</insert>

View File

@ -3,6 +3,9 @@ package com.engine.salary.mapper.siarchives;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
@ -17,4 +20,18 @@ public interface OtherSchemeMapper {
* @return
*/
InsuranceArchivesOtherSchemePO getOtherByEmployeeId(@Param("employeeId")Long employeeId);
/**
* 批量删除
* @param singletonList
*/
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
/**
* 批量保存
* @param singletonList
*/
void batchSave(@Param("otherSchemePOS") List<InsuranceArchivesOtherSchemePO> singletonList);
}

View File

@ -50,7 +50,125 @@
</select>
<!-- 批量删除 -->
<delete id="batchDeleteByEmployeeIds">
UPDATE hrsa_other_archives
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
</delete>
<!-- 批量保存 -->
<insert id="batchSave">
INSERT INTO hrsa_other_archives(
other_scheme_id,
other_start_time,
under_take,
tenant_key,
welfare_type,
other_end_time,
employee_id,
delete_type,
update_time,
create_time,
non_payment,
creator,
payment_organization,
other_payment_base_string)
VALUES
<foreach collection="otherSchemePOS" item="item" separator=",">
(
#{item.otherSchemeId},
#{item.otherStartTime},
#{item.underTake},
#{item.tenantKey},
#{item.welfareType},
#{item.otherEndTime}
#{item.employeeId}
#{item.deleteType}
#{item.updateTime}
#{item.createTime}
#{item.nonPayment}
#{item.creator}
#{item.paymentOrganization}
#{item.otherPaymentBaseString}
)
</foreach>
</insert>
<insert id="batchSave" databaseId="oracle">
INSERT INTO hrsa_other_archives(
other_scheme_id,
other_start_time,
under_take,
tenant_key,
welfare_type,
other_end_time,
employee_id,
delete_type,
update_time,
create_time,
non_payment,
creator,
payment_organization,
other_payment_base_string)
<foreach collection="otherSchemePOS" item="item" separator="union all">
select
#{item.otherSchemeId},
#{item.otherStartTime},
#{item.underTake},
#{item.tenantKey},
#{item.welfareType},
#{item.otherEndTime}
#{item.employeeId}
#{item.deleteType}
#{item.updateTime}
#{item.createTime}
#{item.nonPayment}
#{item.creator}
#{item.paymentOrganization}
#{item.otherPaymentBaseString}
from dual
</foreach>
</insert>
<insert id="batchSave" databaseId="sqlserver">
INSERT INTO hrsa_other_archives(
other_scheme_id,
other_start_time,
under_take,
tenant_key,
welfare_type,
other_end_time,
employee_id,
delete_type,
update_time,
create_time,
non_payment,
creator,
payment_organization,
other_payment_base_string)
VALUES
<foreach collection="otherSchemePOS" item="item" separator=",">
(
#{item.otherSchemeId},
#{item.otherStartTime},
#{item.underTake},
#{item.tenantKey},
#{item.welfareType},
#{item.otherEndTime}
#{item.employeeId}
#{item.deleteType}
#{item.updateTime}
#{item.createTime}
#{item.nonPayment}
#{item.creator}
#{item.paymentOrganization}
#{item.otherPaymentBaseString}
)
</foreach>
</insert>
</mapper>

View File

@ -31,5 +31,5 @@ public interface SocialSchemeMapper {
* 批量保存
* @param singletonList
*/
void batchSave(List<InsuranceArchivesSocialSchemePO> singletonList);
void batchSave(@Param("socialSchemePOS") List<InsuranceArchivesSocialSchemePO> singletonList);
}

View File

@ -49,7 +49,131 @@
WHERE employee_id = #{employeeId} AND delete_type = 0
</select>
<!-- 批量删除 -->
<delete id="batchDeleteByEmployeeIds">
UPDATE hrsa_social_archives
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
</delete>
<!-- 批量保存 -->
<insert id="batchSave">
INSERT INTO hrsa_social_archives(
welfare_type,
delete_type,
social_payment_base_string,
social_scheme_id,
create_time,
social_end_time,
social_start_time,
creator,
non_payment,
tenant_key,
employee_id,
update_time,
under_take,
social_account,
payment_organization)
VALUES
<foreach collection="socialSchemePOS" item="item" separator=",">
(
#{item.welfareType},
#{item.deleteType},
#{item.socialPaymentBaseString},
#{item.socialSchemeId},
#{item.createTime},
#{item.socialEndTime}
#{item.socialStartTime}
#{item.creator}
#{item.nonPayment}
#{item.tenantKey}
#{item.employeeId}
#{item.updateTime}
#{item.underTake}
#{item.socialAccount}
#{item.paymentOrganization}
)
</foreach>
</insert>
<insert id="batchSave" databaseId="oracle">
INSERT INTO hrsa_social_archives(
welfare_type,
delete_type,
social_payment_base_string,
social_scheme_id,
create_time,
social_end_time,
social_start_time,
creator,
non_payment,
tenant_key,
employee_id,
update_time,
under_take,
social_account,
payment_organization)
<foreach collection="socialSchemePOS" item="item" separator="union all">
select
#{item.welfareType},
#{item.deleteType},
#{item.socialPaymentBaseString},
#{item.socialSchemeId},
#{item.createTime},
#{item.socialEndTime}
#{item.socialStartTime}
#{item.creator}
#{item.nonPayment}
#{item.tenantKey}
#{item.employeeId}
#{item.updateTime}
#{item.underTake}
#{item.socialAccount}
#{item.paymentOrganization}
from dual
</foreach>
</insert>
<insert id="batchSave" databaseId="sqlserver">
INSERT INTO hrsa_social_archives(
welfare_type,
delete_type,
social_payment_base_string,
social_scheme_id,
create_time,
social_end_time,
social_start_time,
creator,
non_payment,
tenant_key,
employee_id,
update_time,
under_take,
social_account,
payment_organization)
VALUES
<foreach collection="socialSchemePOS" item="item" separator=",">
(
#{item.welfareType},
#{item.deleteType},
#{item.socialPaymentBaseString},
#{item.socialSchemeId},
#{item.createTime},
#{item.socialEndTime}
#{item.socialStartTime}
#{item.creator}
#{item.nonPayment}
#{item.tenantKey}
#{item.employeeId}
#{item.updateTime}
#{item.underTake}
#{item.socialAccount}
#{item.paymentOrganization}
)
</foreach>
</insert>

View File

@ -47,7 +47,6 @@
>
INSERT INTO hrsa_insurance_category
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
insurance_name,
welfare_type,
is_use,
@ -60,7 +59,6 @@
tenant_key,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{id},
#{insuranceName},
#{welfareType},
#{isUse},

View File

@ -95,7 +95,6 @@
>
INSERT INTO hrsa_scheme_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
primary_id,
insurance_id,
effective_time,
@ -115,7 +114,6 @@
tenant_key,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{id},
#{primaryId},
#{insuranceId},
#{effectiveTime},
@ -136,7 +134,7 @@
</trim>
</insert>
<update id="batchDeleteByPrimaryIds">
<delete id="batchDeleteByPrimaryIds">
UPDATE hrsa_scheme_detail
SET delete_type = 1
WHERE delete_type = 0
@ -144,7 +142,7 @@
<foreach collection="primaryIds" open="(" item="primaryIds" separator="," close=")">
#{primaryIds}
</foreach>
</update>
</delete>
<!-- 根据险种id和是否缴费查询社保方案明细表 -->
<select id="queryListByInsuranceIdIsPayment" resultMap="BaseResultMap">

View File

@ -65,7 +65,6 @@
>
INSERT INTO hrsa_social_security_scheme
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
payment_area,
payment_type,
scheme_name,
@ -79,7 +78,6 @@
tenant_key,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{id},
#{paymentArea},
#{paymentType},
#{schemeName},