历史数据处理
This commit is contained in:
parent
4a20105260
commit
1f0bf061dd
|
|
@ -12,7 +12,7 @@ package com.engine.salary.enums.salaryarchive;
|
||||||
public enum SalaryArchiveAddTypeEnum {
|
public enum SalaryArchiveAddTypeEnum {
|
||||||
|
|
||||||
INDUCTION(0, "入职", 85901),
|
INDUCTION(0, "入职", 85901),
|
||||||
// REHIRE(2, "返聘", 109535),
|
REHIRE(2, "返聘", 109535),
|
||||||
TAXAGENTADJUST(1, "调整个税扣缴义务人", 93910);
|
TAXAGENTADJUST(1, "调整个税扣缴义务人", 93910);
|
||||||
|
|
||||||
private int value;
|
private int value;
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,23 @@ public interface SalaryArchiveMapper {
|
||||||
*/
|
*/
|
||||||
void batchDeleteHistoryData(SalaryArchivePO build);
|
void batchDeleteHistoryData(SalaryArchivePO build);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条件查询
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<SalaryArchivePO> listSome(@Param("param") SalaryArchivePO param);
|
List<SalaryArchivePO> listSome(@Param("param") SalaryArchivePO param);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取人员状态为空的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SalaryArchivePO> getStatusIsNullData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新状态
|
||||||
|
* @param build
|
||||||
|
*/
|
||||||
|
void updateStatus(SalaryArchivePO build);
|
||||||
}
|
}
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<result column="tax_agent_id" property="taxAgentId"/>
|
<result column="tax_agent_id" property="taxAgentId"/>
|
||||||
<result column="pay_start_date" property="payStartDate"/>
|
<result column="pay_start_date" property="payStartDate"/>
|
||||||
<result column="pay_end_date" property="payEndDate"/>
|
<result column="pay_end_date" property="payEndDate"/>
|
||||||
|
<result column="run_status" property="runStatus"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 表字段 -->
|
<!-- 表字段 -->
|
||||||
|
|
@ -28,6 +29,7 @@
|
||||||
, t.tax_agent_id
|
, t.tax_agent_id
|
||||||
, t.pay_start_date
|
, t.pay_start_date
|
||||||
, t.pay_end_date
|
, t.pay_end_date
|
||||||
|
, t.run_status
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询全部 -->
|
<!-- 查询全部 -->
|
||||||
|
|
@ -50,6 +52,7 @@
|
||||||
tax_agent_id=#{taxAgentId},
|
tax_agent_id=#{taxAgentId},
|
||||||
pay_start_date=#{payStartDate},
|
pay_start_date=#{payStartDate},
|
||||||
pay_end_date=#{payEndDate},
|
pay_end_date=#{payEndDate},
|
||||||
|
run_status=#{runStatus},
|
||||||
</set>
|
</set>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -84,6 +87,7 @@
|
||||||
, t1.tax_agent_id
|
, t1.tax_agent_id
|
||||||
, t1.pay_start_date
|
, t1.pay_start_date
|
||||||
, t1.pay_end_date
|
, t1.pay_end_date
|
||||||
|
, t1.run_status
|
||||||
, e.mobile
|
, e.mobile
|
||||||
, e.workcode
|
, e.workcode
|
||||||
, e.lastname as username
|
, e.lastname as username
|
||||||
|
|
@ -150,7 +154,7 @@
|
||||||
</if>
|
</if>
|
||||||
<!-- 排序 -->
|
<!-- 排序 -->
|
||||||
<if test="param.orderRule != null">
|
<if test="param.orderRule != null">
|
||||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO" databaseId="oracle">
|
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO" databaseId="oracle">
|
||||||
|
|
@ -208,7 +212,7 @@
|
||||||
</if>
|
</if>
|
||||||
<!-- 排序 -->
|
<!-- 排序 -->
|
||||||
<if test="param.orderRule != null">
|
<if test="param.orderRule != null">
|
||||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO"
|
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO"
|
||||||
|
|
@ -267,7 +271,7 @@
|
||||||
</if>
|
</if>
|
||||||
<!-- 排序 -->
|
<!-- 排序 -->
|
||||||
<if test="param.orderRule != null">
|
<if test="param.orderRule != null">
|
||||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -281,7 +285,8 @@
|
||||||
tenant_key,
|
tenant_key,
|
||||||
tax_agent_id,
|
tax_agent_id,
|
||||||
pay_start_date,
|
pay_start_date,
|
||||||
pay_end_date
|
pay_end_date,
|
||||||
|
run_status
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="collection" item="item" separator=",">
|
<foreach collection="collection" item="item" separator=",">
|
||||||
|
|
@ -294,7 +299,8 @@
|
||||||
#{item.tenantKey},
|
#{item.tenantKey},
|
||||||
#{item.taxAgentId},
|
#{item.taxAgentId},
|
||||||
#{item.payStartDate},
|
#{item.payStartDate},
|
||||||
#{item.payEndDate}
|
#{item.payEndDate},
|
||||||
|
#{item.runStatus}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -308,7 +314,8 @@
|
||||||
tenant_key,
|
tenant_key,
|
||||||
tax_agent_id,
|
tax_agent_id,
|
||||||
pay_start_date,
|
pay_start_date,
|
||||||
pay_end_date
|
pay_end_date,
|
||||||
|
run_status
|
||||||
)
|
)
|
||||||
|
|
||||||
<foreach collection="collection" item="item" separator="union all">
|
<foreach collection="collection" item="item" separator="union all">
|
||||||
|
|
@ -321,7 +328,8 @@
|
||||||
#{item.tenantKey,jdbcType=VARCHAR},
|
#{item.tenantKey,jdbcType=VARCHAR},
|
||||||
#{item.taxAgentId,jdbcType=DOUBLE},
|
#{item.taxAgentId,jdbcType=DOUBLE},
|
||||||
#{item.payStartDate,jdbcType=DATE},
|
#{item.payStartDate,jdbcType=DATE},
|
||||||
#{item.payEndDate,jdbcType=DATE}
|
#{item.payEndDate,jdbcType=DATE},
|
||||||
|
#{item.runStatus,jdbcType=VARCHAR}
|
||||||
from dual
|
from dual
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -336,7 +344,8 @@
|
||||||
tenant_key,
|
tenant_key,
|
||||||
tax_agent_id,
|
tax_agent_id,
|
||||||
pay_start_date,
|
pay_start_date,
|
||||||
pay_end_date
|
pay_end_date,
|
||||||
|
run_status
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
|
|
@ -348,7 +357,8 @@
|
||||||
#{item.tenantKey},
|
#{item.tenantKey},
|
||||||
#{item.taxAgentId},
|
#{item.taxAgentId},
|
||||||
#{item.payStartDate},
|
#{item.payStartDate},
|
||||||
#{item.payEndDate}
|
#{item.payEndDate},
|
||||||
|
#{item.runStatus}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -390,4 +400,22 @@
|
||||||
ORDER BY t.id DESC
|
ORDER BY t.id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getStatusIsNullData" resultMap="BaseResultMap">
|
||||||
|
SELECT
|
||||||
|
<include refid="baseColumns"/>
|
||||||
|
FROM hrsa_salary_archive t
|
||||||
|
WHERE run_status is null
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateStatus" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
||||||
|
UPDATE hrsa_salary_archive
|
||||||
|
<set>
|
||||||
|
run_status=#{runStatus}
|
||||||
|
</set>
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -23,10 +23,7 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
|
||||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
||||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||||
import com.engine.salary.enums.UserStatusEnum;
|
import com.engine.salary.enums.UserStatusEnum;
|
||||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
|
import com.engine.salary.enums.salaryarchive.*;
|
||||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum;
|
|
||||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
|
|
||||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum;
|
|
||||||
import com.engine.salary.exception.SalaryRunTimeException;
|
import com.engine.salary.exception.SalaryRunTimeException;
|
||||||
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
|
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
|
||||||
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
||||||
|
|
@ -1637,9 +1634,17 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
||||||
// .isNull(SalaryArchivePO::getIncomeCategory)
|
// .isNull(SalaryArchivePO::getIncomeCategory)
|
||||||
// .set(SalaryArchivePO::getIncomeCategory, IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
|
// .set(SalaryArchivePO::getIncomeCategory, IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
|
||||||
// .update();
|
// .update();
|
||||||
List<SalaryArchivePO> salaryArchives = getSalaryArchiveMapper().getHistoryData();
|
|
||||||
|
|
||||||
log.info("处理历史数据开始,数据总量==============={}", salaryArchives.size());
|
//历史档案默认为发薪员工
|
||||||
|
List<SalaryArchivePO> historyData = getSalaryArchiveMapper().getStatusIsNullData();
|
||||||
|
List<Long> ids = SalaryEntityUtil.properties(historyData, SalaryArchivePO::getId, Collectors.toList());
|
||||||
|
List<List<Long>> partIds = Lists.partition(ids, 999);
|
||||||
|
for (List<Long> part : partIds) {
|
||||||
|
getSalaryArchiveMapper().updateStatus(SalaryArchivePO.builder().ids(part).runStatus(ArchiveStatusEnum.FIXED.getValue()).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理个税扣缴义务人为空
|
||||||
|
List<SalaryArchivePO> salaryArchives = getSalaryArchiveMapper().getHistoryData();
|
||||||
if (CollectionUtils.isEmpty(salaryArchives)) {
|
if (CollectionUtils.isEmpty(salaryArchives)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue