个人养老金附表

This commit is contained in:
钱涛 2024-12-23 16:41:42 +08:00
parent 090331e5b1
commit cf253ecfb0
21 changed files with 1361 additions and 4 deletions

View File

@ -0,0 +1,25 @@
create table hrsa_personal_pension
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
main_id number,
tax_year_month date,
employee_id number,
tax_agent_id number,
file_status int,
voucher_type varchar2(255),
voucher_no varchar2(255),
pay_amount varchar2(255),
data_source int,
collect_source varchar2(50),
pay_month date,
eb_data_id number,
voucher_type_name varchar2(50),
employee_type int
);
/

View File

@ -0,0 +1,25 @@
create table hrsa_personal_pension
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
main_id number,
tax_year_month date,
employee_id number,
tax_agent_id number,
file_status int,
voucher_type varchar2(255),
voucher_no varchar2(255),
pay_amount varchar2(255),
data_source int,
collect_source varchar2(50),
pay_month date,
eb_data_id number,
voucher_type_name varchar2(50),
employee_type int
);
/

View File

@ -0,0 +1,25 @@
create table hrsa_personal_pension
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
main_id number,
tax_year_month date,
employee_id number,
tax_agent_id number,
file_status int,
voucher_type varchar2(255),
voucher_no varchar2(255),
pay_amount varchar2(255),
data_source int,
collect_source varchar2(50),
pay_month date,
eb_data_id number,
voucher_type_name varchar2(50),
employee_type int
);
/

View File

@ -0,0 +1,24 @@
create table hrsa_personal_pension
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
main_id bigint comment '主表数据id' ,
tax_year_month date comment '税款所属期' ,
employee_id bigint comment '人员id' ,
tax_agent_id bigint comment '个税扣缴义务人id' ,
file_status int comment '归档状态 0未归档 1已归档' ,
voucher_type varchar(255) comment '凭证类型' ,
voucher_no varchar(255) comment '凭证编码' ,
pay_amount varchar(255) comment '金额' ,
data_source int comment '数据来源' ,
collect_source varchar(50) comment '采集来源' ,
pay_month date comment '缴费月度' ,
eb_data_id bigint comment 'eb数据id' ,
voucher_type_name varchar(50) comment '凭证类型' ,
employee_type int comment '人员类型'
)
;

View File

@ -0,0 +1,24 @@
create table hrsa_personal_pension
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
main_id number,
tax_year_month date,
employee_id number,
tax_agent_id number,
file_status int,
voucher_type varchar2(255),
voucher_no varchar2(255),
pay_amount varchar2(255),
data_source int,
collect_source varchar2(50),
pay_month date,
eb_data_id number,
voucher_type_name varchar2(50),
employee_type int
)
/

View File

@ -0,0 +1,24 @@
create table hrsa_personal_pension
(
id bigint primary key ,
create_time timestamp,
update_time timestamp,
creator bigint,
delete_type int default 0,
tenant_key varchar(10),
main_id bigint,
tax_year_month date,
employee_id bigint,
tax_agent_id bigint,
file_status int,
voucher_type varchar(255),
voucher_no varchar(255),
pay_amount varchar(255),
data_source int,
collect_source varchar(50),
pay_month date,
eb_data_id bigint,
voucher_type_name varchar(50),
employee_type int
);
/

View File

@ -0,0 +1,24 @@
create table hrsa_personal_pension
(
id bigint primary key ,
create_time datetime,
update_time datetime,
creator bigint,
delete_type int default 0,
tenant_key nvarchar(10),
main_id bigint,
tax_year_month datetime,
employee_id bigint,
tax_agent_id bigint,
file_status int,
voucher_type nvarchar(255),
voucher_no nvarchar(255),
pay_amount nvarchar(255),
data_source int,
collect_source nvarchar(50),
pay_month datetime,
eb_data_id bigint,
voucher_type_name nvarchar(50),
employee_type int
)
GO

View File

@ -0,0 +1,25 @@
create table hrsa_personal_pension
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
main_id number,
tax_year_month date,
employee_id number,
tax_agent_id number,
file_status int,
voucher_type varchar2(255),
voucher_no varchar2(255),
pay_amount varchar2(255),
data_source int,
collect_source varchar2(50),
pay_month date,
eb_data_id number,
voucher_type_name varchar2(50),
employee_type int
);
/

View File

@ -0,0 +1,127 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.I18n;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import com.engine.salary.enums.datacollection.EnumDeductionDataSource;
import com.engine.salary.util.excel.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 其他免税扣除-个人养老金
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_personal_pension
//其他免税扣除-个人养老金
public class PersonalPensionListDTO {
private Long id;
private Long mainId;
/**
* 个税扣缴义务人id
*/
private Long taxAgentId;
private Long employeeId;
/**
* 人员类型
*
* @see DataCollectionEmployeeTypeEnum
*/
private Integer employeeType;
@TableTitle(title = "税款所属期", dataIndex = "taxYearMonth", key = "taxYearMonth")
private Date taxYearMonth;
//姓名
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
@ExcelProperty(index = 0)
@I18n
private String username;
//个税扣缴义务人
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
@ExcelProperty(index = 1)
private String taxAgentName;
//部门
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
@ExcelProperty(index = 2)
@I18n
private String departmentName;
//手机号
@TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile")
@ExcelProperty(index = 3)
private String mobile;
//工号
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
@ExcelProperty(index = 4)
private String jobNum;
//证件号码
@ExcelProperty(index = 5)
@TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo")
private String idNo;
//缴费月度
private Date payMonth;
//凭证类别
private Integer voucherType;
//凭证类别名称
@ExcelProperty(index = 6)
@TableTitle(title = "凭证类型", dataIndex = "voucherTypeName", key = "voucherTypeName")
private String voucherTypeName;
//凭证编码
@ExcelProperty(index = 7)
@TableTitle(title = "凭证编码", dataIndex = "voucherNo", key = "voucherNo")
private String voucherNo;
//缴费金额
@ExcelProperty(index = 8)
@TableTitle(title = "缴费金额", dataIndex = "payAmount", key = "payAmount")
private String payAmount;
//归档状态 0未归档 1已归档
private Integer fileStatus;
/**
* @see EnumDeductionDataSource
*/
//数据来源
private Integer dataSource;
//采集来源
private String collectSource;
//创建时间
private Date createTime;
//更新时间
private Date updateTime;
//创建人
private Long creator;
}

View File

@ -0,0 +1,48 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 减免税额
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_derate_deduction
//其他免税扣除-减免税额
public class DerateDeductionSaveParam {
//主键id
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员
private Long employeeId;
//个税扣缴义务人
private Long taxAgentId;
//减免事项
private String derateItem;
//减免性质
private String derateProperty;
//减免金额
private String derateAmount;
}

View File

@ -0,0 +1,60 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 税延养老保险
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_endowment_insurance
//其他免税扣除-税延养老保险
public class EndowmentInsuranceSaveParam {
//主键
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员id
private Long employeeId;
//个税扣缴义务人ID
private Long taxAgentId;
//申报扣除月份
private Date deductionMonth;
//税延养老账户编号
private String accountNumber;
//报税校验码
private String checkCode;
//年度保费
private String yearPremium;
//月度保费
private String monthPremium;
//本期扣除金额
private String currentDeduction;
}

View File

@ -0,0 +1,48 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 其他免税扣除-免税收入表单
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_free_income
//其他免税扣除-免税收入
public class FreeIncomeSaveParam {
//主键id
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员
private Long employeeId;
//个税扣缴义务人
private Long taxAgentId;
//免税事项
private String freeItem;
//免税性质
private String freeProperty;
//免税金额
private String freeAmount;
}

View File

@ -0,0 +1,59 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 其他免税扣除-准予扣除的捐赠额
*
* @author chengliming
* @date 2023-06-09 15:03:45
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_grant_donation
//其他免税扣除-准予扣除的捐赠额
public class GrantDonationSaveParam {
//主键id
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员
private Long employeeId;
//个税扣缴义务人
private Long taxAgentId;
//受赠单位名称
private String recipientName;
//受赠单位纳税人识别号
private String taxCode;
//捐赠凭证号
private String donationNumber;
//捐赠日期
private Date donateDate;
//捐赠金额
private String donateAmount;
//扣除比例
private String deductionProportion;
//实际扣除金额
private String actualDeduction;
}

View File

@ -0,0 +1,54 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 商业健康保险
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_health_insurance
//其他免税扣除-商业健康保险表单
public class HealthInsuranceSaveParam {
//主键id
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员
private Long employeeId;
//个税扣缴义务人
private Long taxAgentId;
//税优识别码
private String identificationNumber;
//保单生效日期
private Date effectiveDate;
//年度保费
private String yearPremium;
//月度保费
private String monthPremium;
//本期扣除金额
private String currentDeduction;
}

View File

@ -0,0 +1,45 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 其他免税扣除-其他
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_other_derate_deduction
//其他免税扣除-其他
public class OtherDerateDeductionSaveParam {
//主键id
private Long id;
//主表数据Id
private Long mainId;
//税款所属期
private Date taxYearMonth;
//人员
private Long employeeId;
//个税扣缴义务人
private Long taxAgentId;
//减免税额
private String otherDeduction;
//备注
private String remark;
}

View File

@ -142,5 +142,6 @@ public class OtherDeductionPO {
private List<GrantDonationPO> grantDonationList;
private List<HealthInsurancePO> healthInsuranceList;
private List<OtherDerateDeductionPO> otherDerateDeductionList;
private List<PersonalPensionPO> personalPensionList;
}

View File

@ -0,0 +1,52 @@
package com.engine.salary.enums.datacollection;
import com.engine.salary.enums.BaseEnum;
import java.util.Arrays;
import java.util.Optional;
/**
* 个人养老金凭证类别
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum PersonalPensionVoucherTypeEnum implements BaseEnum<Integer> {
YEAR(1, "月度", 173218),
MONTH(2, "年度", 157163);
private int value;
private String defaultLabel;
private int labelId;
PersonalPensionVoucherTypeEnum(int value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
public Integer getValue() {
return value;
}
public String getDefaultLabel() {
return defaultLabel;
}
public Integer getLabelId() {
return labelId;
}
public static String getDefaultLabelByValue(Integer value) {
Optional<PersonalPensionVoucherTypeEnum> optional = Arrays.stream(PersonalPensionVoucherTypeEnum.values()).filter(r -> Integer.valueOf(r.getValue()).equals(value)).findFirst();
return optional.isPresent() ? optional.get().getDefaultLabel() : "";
}
public static PersonalPensionVoucherTypeEnum parseByValue(int value) {
return Arrays.stream(values()).filter(e -> e.getValue() == value).findFirst().orElse(null);
}
}

View File

@ -0,0 +1,73 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.po.PersonalPensionPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface PersonalPensionMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<PersonalPensionPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<PersonalPensionPO> listSome(PersonalPensionPO personalPension);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
PersonalPensionPO getById(Long id);
/**
* 新增忽略null字段
*
* @param personalPension 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(PersonalPensionPO personalPension);
/**
* 修改修改所有字段
*
* @param personalPension 修改的记录
* @return 返回影响行数
*/
int update(PersonalPensionPO personalPension);
/**
* 修改忽略null字段
*
* @param personalPension 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(PersonalPensionPO personalPension);
/**
* 删除记录
*
* @param personalPension 待删除的记录
* @return 返回影响行数
*/
int delete(PersonalPensionPO personalPension);
/**
* 批量删除记录
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
}

View File

@ -0,0 +1,390 @@
<?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.PersonalPensionMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
<result column="collect_source" property="collectSource"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="data_source" property="dataSource"/>
<result column="delete_type" property="deleteType"/>
<result column="eb_data_id" property="ebDataId"/>
<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="pay_amount" property="payAmount"/>
<result column="pay_month" property="payMonth"/>
<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"/>
<result column="voucher_no" property="voucherNo"/>
<result column="voucher_type" property="voucherType"/>
<result column="voucher_type_name" property="voucherTypeName"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
collect_source
, t.create_time
, t.creator
, t.data_source
, t.delete_type
, t.eb_data_id
, t.employee_id
, t.employee_type
, t.file_status
, t.id
, t.main_id
, t.pay_amount
, t.pay_month
, t.tax_agent_id
, t.tax_year_month
, t.tenant_key
, t.update_time
, t.voucher_no
, t.voucher_type
, t.voucher_type_name
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_personal_pension t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_personal_pension t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_personal_pension t
WHERE delete_type = 0
<if test="collectSource != null">
AND collect_source = #{collectSource}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="dataSource != null">
AND data_source = #{dataSource}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="ebDataId != null">
AND eb_data_id = #{ebDataId}
</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="payAmount != null">
AND pay_amount = #{payAmount}
</if>
<if test="payMonth != null">
AND pay_month = #{payMonth}
</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="voucherNo != null">
AND voucher_no = #{voucherNo}
</if>
<if test="voucherType != null">
AND voucher_type = #{voucherType}
</if>
<if test="voucherTypeName != null">
AND voucher_type_name = #{voucherTypeName}
</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>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
INSERT INTO hrsa_personal_pension
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="collectSource != null">
collect_source,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="dataSource != null">
data_source,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="ebDataId != null">
eb_data_id,
</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="payAmount != null">
pay_amount,
</if>
<if test="payMonth != null">
pay_month,
</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>
<if test="voucherNo != null">
voucher_no,
</if>
<if test="voucherType != null">
voucher_type,
</if>
<if test="voucherTypeName != null">
voucher_type_name,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="collectSource != null">
#{collectSource},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="dataSource != null">
#{dataSource},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="ebDataId != null">
#{ebDataId},
</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="payAmount != null">
#{payAmount},
</if>
<if test="payMonth != null">
#{payMonth},
</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>
<if test="voucherNo != null">
#{voucherNo},
</if>
<if test="voucherType != null">
#{voucherType},
</if>
<if test="voucherTypeName != null">
#{voucherTypeName},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
UPDATE hrsa_personal_pension
<set>
collect_source=#{collectSource},
create_time=#{createTime},
creator=#{creator},
data_source=#{dataSource},
delete_type=#{deleteType},
eb_data_id=#{ebDataId},
employee_id=#{employeeId},
employee_type=#{employeeType},
file_status=#{fileStatus},
main_id=#{mainId},
pay_amount=#{payAmount},
pay_month=#{payMonth},
tax_agent_id=#{taxAgentId},
tax_year_month=#{taxYearMonth},
tenant_key=#{tenantKey},
update_time=#{updateTime},
voucher_no=#{voucherNo},
voucher_type=#{voucherType},
voucher_type_name=#{voucherTypeName},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
UPDATE hrsa_personal_pension
<set>
<if test="collectSource != null">
collect_source=#{collectSource},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="dataSource != null">
data_source=#{dataSource},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="ebDataId != null">
eb_data_id=#{ebDataId},
</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="payAmount != null">
pay_amount=#{payAmount},
</if>
<if test="payMonth != null">
pay_month=#{payMonth},
</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>
<if test="voucherNo != null">
voucher_no=#{voucherNo},
</if>
<if test="voucherType != null">
voucher_type=#{voucherType},
</if>
<if test="voucherTypeName != null">
voucher_type_name=#{voucherTypeName},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_personal_pension
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_personal_pension
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -47,15 +47,13 @@ public interface OtherDeductionService {
/**
* 导出
*
*/
XSSFWorkbook export(OtherDeductionQueryParam queryParam);
/**
* 导出详情
*
*/
XSSFWorkbook exportDetail( OtherDeductionQueryParam queryParam);
XSSFWorkbook exportDetail(OtherDeductionQueryParam queryParam);
/**
* 下载导入模板
@ -67,6 +65,7 @@ public interface OtherDeductionService {
/**
* 下载明细模板
*
* @param param
* @return
*/
@ -84,6 +83,7 @@ public interface OtherDeductionService {
/**
* 导入明细数据
*
* @param importParam
* @return
*/
@ -124,4 +124,17 @@ public interface OtherDeductionService {
OtherDeductionRecordDTO getOtherDeduction(OtherDeductionParam otherDeductionParam);
String extendToLastMonth(OtherDeductionExtendLastParam param);
/**
* 保存免税收入
* @param param
*/
void saveFreeIncome(FreeIncomeSaveParam param);
// void saveEndowmentInsurance(EndowmentInsuranceSaveParam param);
// void saveGrantDonation(GrantDonationSaveParam param);
// void saveHealthInsurance(HealthInsuranceSaveParam param);
// void saveOtherDerateDeduction(OtherDerateDeductionSaveParam param);
// void saveDerateDeduction(DerateDeductionSaveParam param);
}

View File

@ -21,6 +21,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.*;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
@ -1344,6 +1345,154 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
IOUtils.closeQuietly(fileInputStream);
}
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
int successCount = 0;
int errorCount = 0;
// 错误excel内容
List<Map> errorData = new ArrayList<>();
List<PersonalPensionListDTO> dtoList = ExcelParseHelper.parse2Map(fileInputStream, PersonalPensionListDTO.class, 6, 1, 9, "OtherDeductionTemplate.xlsx");
for (int i = 0; i < dtoList.size(); i++) {
PersonalPensionListDTO dto = dtoList.get(i);
Date now = new Date();
//待插入数据库对象
OtherDeductionPO mainPo = OtherDeductionPO.builder()
.declareMonth(declareMonth)
.freeIncomeList(new ArrayList<>())
.derateDeductionList(new ArrayList<>())
.endowmentInsuranceList(new ArrayList<>())
.grantDonationList(new ArrayList<>())
.healthInsuranceList(new ArrayList<>())
.otherDerateDeductionList(new ArrayList<>())
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
.tenantKey(DEFAULT_TENANT_KEY)
.build();
PersonalPensionPO po = PersonalPensionPO.builder()
.taxYearMonth(declareMonth)
.fileStatus(1)
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.tenantKey(DEFAULT_TENANT_KEY)
.build();
//异常点数量
int errorSum = 0;
//行号
String rowIndex = String.format("第%s行", i + 2);
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
String mobile = dto.getMobile();
String workcode = dto.getJobNum();
String idNo = dto.getIdNo();
List<Long> employeeSameIds = new ArrayList<>();
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
List<DataCollectionEmployee> emps = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo, null);
//含在职和离职选在职数据
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
employeeSameIds = emps.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.map(DataCollectionEmployee::getEmployeeId)
.collect(Collectors.toList());
}
if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) {
employeeSameIds = emps.stream()
.map(DataCollectionEmployee::getEmployeeId)
.collect(Collectors.toList());
}
//当人员信息导入筛选的全局配置为"0"姓名才是必填项
if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
//姓名 不能为空
//错误消息对象
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不存在或者存在多个员工");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
if (employeeId != null && employeeId > 0) {
mainPo.setEmployeeId(employeeId);
po.setEmployeeId(employeeId);
po.setEmployeeType(DataCollectionEmployeeTypeEnum.ORGANIZATION.getValue());
} else {
//姓名错误系统内不存在该姓名
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
String taxAgentName = dto.getTaxAgentName();
if (StringUtils.isBlank(taxAgentName)) {
//个税扣缴义务人不能为空
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Optional<TaxAgentManageRangeEmployeeDTO> optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst();
if (optionalTemp.isPresent()) {
mainPo.setTaxAgentId(optionalTemp.get().getTaxAgentId());
po.setTaxAgentId(optionalTemp.get().getTaxAgentId());
} else {
//个税扣缴义务人不存在
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在或不在权限范围内");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
po.setVoucherTypeName(dto.getVoucherTypeName());
po.setVoucherNo(dto.getVoucherNo());
po.setPayAmount(dto.getPayAmount());
if (errorSum == 0) {
successCount += 1;
String key = mainPo.getTaxAgentId() + "-" + mainPo.getEmployeeId();
Map<String, OtherDeductionPO> deductionPOMap = SalaryEntityUtil.convert2Map(eligibleData, e -> e.getTaxAgentId() + "-" + e.getEmployeeId());
if (deductionPOMap.containsKey(key)) {
deductionPOMap.get(key).getPersonalPensionList().add(po);
} else {
mainPo.getPersonalPensionList().add(po);
eligibleData.add(mainPo);
}
} else {
errorCount += 1;
}
}
HashMap<Object, Object> dataMap = new HashMap<>();
dataMap.put("successCount", successCount);
dataMap.put("errorCount", errorCount);
dataMap.put("errorData", errorData);
apidatas.put("derateDeduction", dataMap);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
@ -2020,11 +2169,53 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
map.put("减免税额", Arrays.asList(derateDeductionTitle));
List<Object> otherDerateDeductionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "其他免税扣除金额", "备注");
map.put("其他", Arrays.asList(otherDerateDeductionTitle));
// map.put("个人养老金", rowList);
List<Object> personalPensionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "凭证类型", "凭证编码", "缴费金额");
map.put("个人养老金", Arrays.asList(personalPensionTitle));
XSSFWorkbook book = ExcelUtil.genWorkbookV2(map);
return book;
}
@Override
public void saveFreeIncome(FreeIncomeSaveParam param) {
Date now = new Date();
Long id = param.getId();
if (id == null) {
FreeIncomePO po = FreeIncomePO.builder()
.id(id)
.mainId(param.getMainId())
.taxYearMonth(param.getTaxYearMonth())
.employeeId(param.getEmployeeId())
.taxAgentId(param.getTaxAgentId())
.freeItem(param.getFreeItem())
.freeProperty(param.getFreeProperty())
.freeAmount(param.getFreeAmount())
.fileStatus(1)
.employeeType(0)
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(DEFAULT_TENANT_KEY)
.build();
getFreeIncomeMapper().insertIgnoreNull(po);
} else {
FreeIncomePO po = getFreeIncomeMapper().getById(id);
po.setTaxYearMonth(param.getTaxYearMonth());
po.setEmployeeId(param.getEmployeeId());
po.setTaxAgentId(param.getTaxAgentId());
po.setFreeItem(param.getFreeItem());
po.setFreeProperty(param.getFreeProperty());
po.setFreeAmount(param.getFreeAmount());
po.setEmployeeType(0);
po.setUpdateTime(now);
getFreeIncomeMapper().updateIgnoreNull(po);
}
}
}