导入功能

This commit is contained in:
钱涛 2024-12-25 16:28:21 +08:00
parent 2e4c3ddaff
commit 18bd6509db
19 changed files with 736 additions and 307 deletions

View File

@ -1,8 +1,9 @@
package com.engine.salary.entity.datacollection.po;
import cn.hutool.core.util.NumberUtil;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.annotation.Encrypt;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.hrmelog.annotation.ElogTransform;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -19,31 +20,31 @@ import java.util.List;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ElogTransform( name = "其他免税扣除")
@ElogTransform(name = "其他免税扣除")
public class OtherDeductionPO {
/**
* 主键
*/
@ElogTransform( name="主键id" )
@ElogTransform(name = "主键id")
private Long id;
/**
* 人员信息表的主键id
*/
@ElogTransform( name ="人员id")
@ElogTransform(name = "人员id")
private Long employeeId;
/**
* 个税扣缴义务人的主键id
*/
@ElogTransform( name ="个税扣缴义务人id")
@ElogTransform(name = "个税扣缴义务人id")
private Long taxAgentId;
/**
* 申报月份
*/
@ElogTransform( name ="税款所属期")
@ElogTransform(name = "税款所属期")
private Date declareMonth;
/**
@ -65,7 +66,7 @@ public class OtherDeductionPO {
/**
* 商业健康保险
*/
@ElogTransform( name ="商业健康保险")
@ElogTransform(name = "商业健康保险")
@SalaryFormulaVar(defaultLabel = "商业健康保险", labelId = 91238, dataType = "number")
@Encrypt
private String businessHealthyInsurance;
@ -73,7 +74,7 @@ public class OtherDeductionPO {
/**
* 税延养老保险
*/
@ElogTransform( name ="税延养老保险")
@ElogTransform(name = "税延养老保险")
@SalaryFormulaVar(defaultLabel = "税延养老保险", labelId = 91239, dataType = "number")
@Encrypt
private String taxDelayEndowmentInsurance;
@ -82,7 +83,7 @@ public class OtherDeductionPO {
/**
* 其他
*/
@ElogTransform( name ="其他")
@ElogTransform(name = "其他")
@SalaryFormulaVar(defaultLabel = "其他", labelId = 84500, dataType = "number")
@Encrypt
private String otherDeduction;
@ -90,7 +91,7 @@ public class OtherDeductionPO {
/**
* 准予扣除的捐赠额
*/
@ElogTransform( name ="准予扣除的捐赠额")
@ElogTransform(name = "准予扣除的捐赠额")
@SalaryFormulaVar(defaultLabel = "准予扣除的捐赠额", labelId = 91240, dataType = "number")
@Encrypt
private String deductionAllowedDonation;
@ -98,7 +99,7 @@ public class OtherDeductionPO {
/**
* 个人养老金
*/
@ElogTransform( name ="个人养老金")
@ElogTransform(name = "个人养老金")
@SalaryFormulaVar(defaultLabel = "个人养老金", labelId = 91240, dataType = "number")
@Encrypt
private String privatePension;
@ -106,19 +107,19 @@ public class OtherDeductionPO {
/**
* 创建时间
*/
@ElogTransform( name ="创建时间")
@ElogTransform(name = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ElogTransform( name ="更新时间")
@ElogTransform(name = "更新时间")
private Date updateTime;
/**
* 创建人
*/
@ElogTransform( name ="创建人id")
@ElogTransform(name = "创建人id")
private Long creator;
/**
@ -129,7 +130,7 @@ public class OtherDeductionPO {
/**
* 租户ID
*/
@ElogTransform( name ="租户")
@ElogTransform(name = "租户")
private String tenantKey;
private List<Long> employeeIds;
@ -137,11 +138,64 @@ public class OtherDeductionPO {
private List<FreeIncomePO> freeIncomeList;
private List<DerateDeductionPO> derateDeductionList;
private List<HealthInsurancePO> healthInsuranceList;
private List<EndowmentInsurancePO> endowmentInsuranceList;
private List<GrantDonationPO> grantDonationList;
private List<HealthInsurancePO> healthInsuranceList;
private List<DerateDeductionPO> derateDeductionList;
private List<OtherDerateDeductionPO> otherDerateDeductionList;
private List<PersonalPensionPO> personalPensionList;
public void handleList() {
freeIncome = freeIncomeList
.stream()
.map(FreeIncomePO::getFreeAmount)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
derateDeduction = derateDeductionList
.stream()
.map(DerateDeductionPO::getDerateAmount)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
taxDelayEndowmentInsurance = endowmentInsuranceList
.stream()
.map(EndowmentInsurancePO::getCurrentDeduction)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
deductionAllowedDonation = grantDonationList
.stream()
.map(GrantDonationPO::getActualDeduction)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
businessHealthyInsurance = healthInsuranceList
.stream()
.map(HealthInsurancePO::getCurrentDeduction)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
otherDeduction = otherDerateDeductionList
.stream()
.map(OtherDerateDeductionPO::getOtherDeduction)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
privatePension = personalPensionList
.stream()
.map(PersonalPensionPO::getPayAmount)
.filter(NumberUtil::isNumber)
.mapToDouble(Double::valueOf)
.sum() + "";
}
}

View File

@ -76,6 +76,8 @@ public class PersonalPensionPO{
@ElogTransform(name = "采集来源")
private String collectSource;
private Long ebDataId;
@ElogTransform(name = "创建时间", ignore = true)
private Date createTime;

View File

@ -69,5 +69,8 @@ public interface DerateDeductionMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -1,27 +1,29 @@
<?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.datacollection.DerateDeductionMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="derate_amount" property="derateAmount" />
<result column="derate_item" property="derateItem" />
<result column="derate_property" property="derateProperty" />
<result column="employee_id" property="employeeId" />
<result column="employee_type" property="employeeType" />
<result column="file_status" property="fileStatus" />
<result column="id" property="id" />
<result column="main_id" property="mainId" />
<result column="tax_agent_id" property="taxAgentId" />
<result column="tax_year_month" property="taxYearMonth" />
<result column="tenant_key" property="tenantKey" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="derate_amount" property="derateAmount"/>
<result column="derate_item" property="derateItem"/>
<result column="derate_property" property="derateProperty"/>
<result column="employee_id" property="employeeId"/>
<result column="employee_type" property="employeeType"/>
<result column="file_status" property="fileStatus"/>
<result column="id" property="id"/>
<result column="main_id" property="mainId"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tax_year_month" property="taxYearMonth"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.create_time
t
.
create_time
, t.creator
, t.delete_type
, t.derate_amount
@ -36,278 +38,285 @@
, t.tax_year_month
, t.tenant_key
, t.update_time
</sql>
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
SELECT
<include refid="baseColumns"/>
FROM hrsa_derate_deduction t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
WHERE id = #{id} AND delete_type = 0
</select>
SELECT
<include refid="baseColumns"/>
FROM hrsa_derate_deduction t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="derateAmount != null">
AND derate_amount = #{derateAmount}
</if>
<if test="derateItem != null">
AND derate_item = #{derateItem}
</if>
<if test="derateProperty != null">
AND derate_property = #{derateProperty}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeType != null">
AND employee_type = #{employeeType}
</if>
<if test="fileStatus != null">
AND file_status = #{fileStatus}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="mainId != null">
AND main_id = #{mainId}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxYearMonth != null">
AND tax_year_month = #{taxYearMonth}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_derate_deduction t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="derateAmount != null">
AND derate_amount = #{derateAmount}
</if>
<if test="derateItem != null">
AND derate_item = #{derateItem}
</if>
<if test="derateProperty != null">
AND derate_property = #{derateProperty}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeType != null">
AND employee_type = #{employeeType}
</if>
<if test="fileStatus != null">
AND file_status = #{fileStatus}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="mainId != null">
AND main_id = #{mainId}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxYearMonth != null">
AND tax_year_month = #{taxYearMonth}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</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>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
INSERT INTO hrsa_derate_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
INSERT INTO hrsa_derate_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="derateAmount != null">
derate_amount,
</if>
<if test="derateItem != null">
derate_item,
</if>
<if test="derateProperty != null">
derate_property,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeType != null">
employee_type,
</if>
<if test="fileStatus != null">
file_status,
</if>
<if test="id != null">
id,
</if>
<if test="mainId != null">
main_id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxYearMonth != null">
tax_year_month,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="derateAmount != null" >
#{derateAmount},
</if>
<if test="derateItem != null" >
#{derateItem},
</if>
<if test="derateProperty != null" >
#{derateProperty},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="employeeType != null" >
#{employeeType},
</if>
<if test="fileStatus != null" >
#{fileStatus},
</if>
<if test="id != null" >
#{id},
</if>
<if test="mainId != null" >
#{mainId},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="taxYearMonth != null" >
#{taxYearMonth},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="derateAmount != null">
derate_amount,
</if>
<if test="derateItem != null">
derate_item,
</if>
<if test="derateProperty != null">
derate_property,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeType != null">
employee_type,
</if>
<if test="fileStatus != null">
file_status,
</if>
<if test="id != null">
id,
</if>
<if test="mainId != null">
main_id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxYearMonth != null">
tax_year_month,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="derateAmount != null">
#{derateAmount},
</if>
<if test="derateItem != null">
#{derateItem},
</if>
<if test="derateProperty != null">
#{derateProperty},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="employeeType != null">
#{employeeType},
</if>
<if test="fileStatus != null">
#{fileStatus},
</if>
<if test="id != null">
#{id},
</if>
<if test="mainId != null">
#{mainId},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="taxYearMonth != null">
#{taxYearMonth},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
UPDATE hrsa_derate_deduction
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
derate_amount=#{derateAmount},
derate_item=#{derateItem},
derate_property=#{derateProperty},
employee_id=#{employeeId},
employee_type=#{employeeType},
file_status=#{fileStatus},
main_id=#{mainId},
tax_agent_id=#{taxAgentId},
tax_year_month=#{taxYearMonth},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
UPDATE hrsa_derate_deduction
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="derateAmount != null" >
derate_amount=#{derateAmount},
</if>
<if test="derateItem != null" >
derate_item=#{derateItem},
</if>
<if test="derateProperty != null" >
derate_property=#{derateProperty},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="employeeType != null" >
employee_type=#{employeeType},
</if>
<if test="fileStatus != null" >
file_status=#{fileStatus},
</if>
<if test="mainId != null" >
main_id=#{mainId},
</if>
<if test="taxAgentId != null" >
tax_agent_id=#{taxAgentId},
</if>
<if test="taxYearMonth != null" >
tax_year_month=#{taxYearMonth},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
UPDATE hrsa_derate_deduction
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
derate_amount=#{derateAmount},
derate_item=#{derateItem},
derate_property=#{derateProperty},
employee_id=#{employeeId},
employee_type=#{employeeType},
file_status=#{fileStatus},
main_id=#{mainId},
tax_agent_id=#{taxAgentId},
tax_year_month=#{taxYearMonth},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_derate_deduction
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
UPDATE hrsa_derate_deduction
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="derateAmount != null">
derate_amount=#{derateAmount},
</if>
<if test="derateItem != null">
derate_item=#{derateItem},
</if>
<if test="derateProperty != null">
derate_property=#{derateProperty},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="employeeType != null">
employee_type=#{employeeType},
</if>
<if test="fileStatus != null">
file_status=#{fileStatus},
</if>
<if test="mainId != null">
main_id=#{mainId},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="taxYearMonth != null">
tax_year_month=#{taxYearMonth},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_derate_deduction
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_derate_deduction
SET delete_type = 1
WHERE delete_type = 0
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_derate_deduction
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -69,5 +69,6 @@ public interface EndowmentInsuranceMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -356,5 +356,13 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_endowment_insurance
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -68,5 +68,7 @@ public interface FreeIncomeMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -311,5 +311,13 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_free_income
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -69,5 +69,6 @@ public interface GrantDonationMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -371,5 +371,12 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_grant_donation
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -69,5 +69,6 @@ public interface HealthInsuranceMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -341,5 +341,12 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_health_insurance
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -11,42 +11,64 @@ import java.util.List;
public interface OtherDeductionMapper {
/**
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
OtherDeductionPO getById(Long id);
OtherDeductionPO getById(Long id);
/**
* 查询数据采集-其他免税扣除列表
* @param param
* @return
*/
List<OtherDeductionListDTO> list(@Param("param") OtherDeductionQueryParam param);
/**
* 查询数据采集-其他免税扣除列表
*
* @param param
* @return
*/
List<OtherDeductionListDTO> list(@Param("param") OtherDeductionQueryParam param);
List<OtherDeductionRecordDTO> recordList(@Param("param") OtherDeductionQueryParam param);
List<OtherDeductionRecordDTO> recordList(@Param("param") OtherDeductionQueryParam param);
List<OtherDeductionPO> listSome(@Param("param") OtherDeductionPO param);
List<OtherDeductionPO> listSome(@Param("param") OtherDeductionPO param);
/**
* 批量插入
* @param pos
*/
void insertData(@Param("collection") List<OtherDeductionPO> pos);
/**
* 批量插入
*
* @param pos
*/
void insertData(@Param("collection") List<OtherDeductionPO> pos);
/**
* 批量修改
* @param pos
*/
void updateData(@Param("collection") List<OtherDeductionPO> pos);
/**
* 批量修改
*
* @param pos
*/
void updateData(@Param("collection") List<OtherDeductionPO> pos);
/**
* 批量删除
* @param longs
*/
/**
* 新增忽略null字段
*
* @param otherDeduction 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(OtherDeductionPO otherDeduction);
/**
* 批量删除
*
* @param longs
*/
void deleteData(List<Long> longs);
/**
* 删除记录
*
* @param otherDeduction 待删除的记录
* @return 返回影响行数
*/
int delete(OtherDeductionPO otherDeduction);
OtherDeductionPO getByTaxAgentIdAndEmployeeId(@Param("taxAgentId") Long taxAgentId, @Param("employeeId") Long employeeId);
}

View File

@ -53,6 +53,22 @@
</foreach>
</update>
<delete id="delete">
UPDATE hrsa_other_deduction
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<select id="getByTaxAgentIdAndEmployeeId" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_other_deduction t
WHERE delete_type = 0
AND tax_agent_id = #{taxAgentId}
AND employee_id = #{employeeId}
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
@ -510,4 +526,210 @@
</update>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true">
INSERT INTO hrsa_other_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="businessHealthyInsurance != null">
business_healthy_insurance,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="declareMonth != null">
declare_month,
</if>
<if test="deductionAllowedDonation != null">
deduction_allowed_donation,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="derateDeduction != null">
derate_deduction,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="freeIncome != null">
free_income,
</if>
<if test="otherDeduction != null">
other_deduction,
</if>
<if test="privatePension != null">
private_pension,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxDelayEndowmentInsurance != null">
tax_delay_endowment_insurance,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="businessHealthyInsurance != null" >
#{businessHealthyInsurance},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="declareMonth != null" >
#{declareMonth},
</if>
<if test="deductionAllowedDonation != null" >
#{deductionAllowedDonation},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="derateDeduction != null" >
#{derateDeduction},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="freeIncome != null" >
#{freeIncome},
</if>
<if test="otherDeduction != null" >
#{otherDeduction},
</if>
<if test="privatePension != null" >
#{privatePension},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="taxDelayEndowmentInsurance != null" >
#{taxDelayEndowmentInsurance},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select hrsa_other_deduction_id.currval from dual
</selectKey>
INSERT INTO hrsa_other_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="businessHealthyInsurance != null">
business_healthy_insurance,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="declareMonth != null">
declare_month,
</if>
<if test="deductionAllowedDonation != null">
deduction_allowed_donation,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="derateDeduction != null">
derate_deduction,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="freeIncome != null">
free_income,
</if>
<if test="otherDeduction != null">
other_deduction,
</if>
<if test="privatePension != null">
private_pension,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxDelayEndowmentInsurance != null">
tax_delay_endowment_insurance,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="businessHealthyInsurance != null" >
#{businessHealthyInsurance},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="declareMonth != null" >
#{declareMonth},
</if>
<if test="deductionAllowedDonation != null" >
#{deductionAllowedDonation},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="derateDeduction != null" >
#{derateDeduction},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="freeIncome != null" >
#{freeIncome},
</if>
<if test="otherDeduction != null" >
#{otherDeduction},
</if>
<if test="privatePension != null" >
#{privatePension},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="taxDelayEndowmentInsurance != null" >
#{taxDelayEndowmentInsurance},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
</mapper>

View File

@ -75,5 +75,7 @@ public interface OtherDerateDeductionMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -296,5 +296,13 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_other_derate_deduction
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -69,5 +69,7 @@ public interface PersonalPensionMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteByMainId(Long mainId);
}

View File

@ -386,5 +386,13 @@
</foreach>
</delete>
<delete id="deleteByMainId">
UPDATE hrsa_personal_pension
SET delete_type = 1
WHERE delete_type = 0
AND main_id = #{mainId}
</delete>
</mapper>

View File

@ -470,6 +470,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -623,6 +624,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -772,6 +774,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -923,6 +926,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -1075,6 +1079,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -1223,6 +1228,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -1371,6 +1377,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.personalPensionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
@ -1495,6 +1502,61 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
IOUtils.closeQuietly(fileInputStream);
}
eligibleData.forEach(po -> {
po.handleList();
//清除旧数据
OtherDeductionPO otherDeductionPO = getOtherDeductionMapper().getByTaxAgentIdAndEmployeeId(po.getTaxAgentId(), po.getEmployeeId());
getOtherDeductionMapper().delete(otherDeductionPO);
getFreeIncomeMapper().deleteByMainId(otherDeductionPO.getId());
getHealthInsuranceMapper().deleteByMainId(otherDeductionPO.getId());
getEndowmentInsuranceMapper().deleteByMainId(otherDeductionPO.getId());
getGrantDonationMapper().deleteByMainId(otherDeductionPO.getId());
getDerateDeductionMapper().deleteByMainId(otherDeductionPO.getId());
getOtherDerateDeductionMapper().deleteByMainId(otherDeductionPO.getId());
getPersonalPensionMapper().deleteByMainId(otherDeductionPO.getId());
//更新主表
getOtherDeductionMapper().insertIgnoreNull(po);
//更新各项明细
po.getFreeIncomeList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getFreeIncomeMapper().insertIgnoreNull(l);
});
po.getHealthInsuranceList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getHealthInsuranceMapper().insertIgnoreNull(l);
});
po.getEndowmentInsuranceList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getEndowmentInsuranceMapper().insertIgnoreNull(l);
});
po.getGrantDonationList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getGrantDonationMapper().insertIgnoreNull(l);
});
po.getDerateDeductionList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getDerateDeductionMapper().insertIgnoreNull(l);
});
po.getOtherDerateDeductionList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getOtherDerateDeductionMapper().insertIgnoreNull(l);
});
po.getPersonalPensionList().forEach(l -> {
l.setId(IdGenerator.generate());
l.setMainId(po.getId());
getPersonalPensionMapper().insertIgnoreNull(l);
});
});
return apidatas;
}