薪酬系统-福利档案,修复非系统人员增量数据造成的bug

This commit is contained in:
sy 2023-08-08 15:03:52 +08:00
parent 95525d42d8
commit 9f021b6d5e
10 changed files with 327 additions and 12 deletions

View File

@ -1080,6 +1080,8 @@ public class SIArchivesBiz {
request.setTaxAgentId(param.getTaxAgentId());
request.setExtWelArchiveList(param.isExtWelArchiveList());
apidatas = listPageEmployeePOS(request, operateId);
return apidatas;
@ -1115,7 +1117,11 @@ public class SIArchivesBiz {
Collection<Long> taxAgentIds = param.getTaxAgentIds();
log.info("从数据库获取档案列表数据开始");
sw.start("获取福利档案列表数据");
page = socialSchemeMapper.queryEmployeeList(param);
if (param.isExtWelArchiveList()) {
page = socialSchemeMapper.queryExtEmployeeList(param);
} else {
page = socialSchemeMapper.queryEmployeeList(param);
}
sw.stop();
log.info("从数据库获取档案列表数据完成!");
page = page.stream().filter(f ->
@ -1131,7 +1137,11 @@ public class SIArchivesBiz {
} else {
log.info("从数据库获取档案列表数据开始");
sw.start("获取档案列表数据");
page = socialSchemeMapper.queryEmployeeList(param);
if (param.isExtWelArchiveList()) {
page = socialSchemeMapper.queryExtEmployeeList(param);
} else {
page = socialSchemeMapper.queryEmployeeList(param);
}
sw.stop();
log.info("从数据库获取档案列表数据完成!");
pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(),

View File

@ -81,6 +81,7 @@ public class InsuranceArchivesBaseInfoBO {
.creator(currentEmployeeId)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.employeeType(change.getEmployeeType())
.build());
}
// 如果是删除 说明如果有档案并且是在缴纳中才处理没档案不用管

View File

@ -115,4 +115,9 @@ public class InsuranceArchivesListParam extends BaseQueryParam {
* 人事状态
*/
private List<String> personnelStatuses;
/**
* 是否是外部系统档案
*/
private boolean extWelArchiveList;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.siarchives.po;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -79,6 +80,13 @@ public class InsuranceArchivesBaseInfoPO {
*/
private String runStatus;
/**
* 人员类型,0或null组织架构,1非系统人员
*
* @see DataCollectionEmployeeTypeEnum
*/
private Integer employeeType;
//---------条件-------
private Collection<Long> ids;
private Collection<Long> employeeIds;

View File

@ -15,6 +15,7 @@
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="run_status" property="runStatus"/>
<result column="employee_type" property="employeeType"/>
</resultMap>
<!-- 表字段 -->
@ -31,6 +32,7 @@
, t.creator
, t.delete_type
, t.tenant_key
, t.employee_type
</sql>
<!-- 查询全部 -->
@ -100,7 +102,7 @@
<insert id="batchSave">
INSERT INTO hrsa_insurance_base_info
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status)
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status, employee_type)
VALUES
<foreach collection="infos" item="item" separator=",">
(
@ -115,13 +117,14 @@
#{item.deleteType},
#{item.createTime},
#{item.updateTime},
#{item.runStatus}
#{item.runStatus},
#{item.employeeType}
)
</foreach>
</insert>
<insert id="batchSave" databaseId="oracle">
INSERT INTO hrsa_insurance_base_info
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status)
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status, employee_type)
<foreach collection="infos" item="item" separator="union all">
select
#{item.id,jdbcType=DOUBLE},
@ -135,14 +138,15 @@
#{item.deleteType},
#{item.createTime},
#{item.updateTime},
#{item.runStatus,jdbcType=VARCHAR}
#{item.runStatus,jdbcType=VARCHAR},
#{item.employeeType}
from dual
</foreach>
</insert>
<insert id="batchSave" databaseId="sqlserver">
<foreach collection="infos" item="item" separator=";">
INSERT INTO hrsa_insurance_base_info
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status)
(id,employee_id,payment_organization,social_archives_id,fund_archives_id,other_archives_id,tenant_key,creator,delete_type,create_time,update_time,run_status, employee_type)
VALUES
(
#{item.id},
@ -156,7 +160,8 @@
#{item.deleteType},
#{item.createTime},
#{item.updateTime},
#{item.runStatus}
#{item.runStatus},
#{item.employeeType}
)
</foreach>
</insert>

View File

@ -77,6 +77,8 @@ public interface SocialSchemeMapper {
List<InsuranceArchivesEmployeePO> queryEmployeeList(@Param("param") InsuranceArchivesListParam param);
List<InsuranceArchivesEmployeePO> queryExtEmployeeList(@Param("param") InsuranceArchivesListParam param);
/**
* 根据社保缴纳组织id获取
* @param paymentOrganization

View File

@ -369,12 +369,41 @@
WHERE
1=1
AND base.delete_type = 0
AND base.employee_type is null
<include refid="condition"></include>
<if test="param.orderRule != null">
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<!--]]>-->
<select id="queryExtEmployeeList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO">
SELECT base.id AS baseInfoId, e.id AS employeeId, e.username AS userName, e.department_id AS departmentId, e.workcode AS jobNum, e.mobile AS telephone,
d.departmentname AS departmentName, e.jobtitle_id AS position, e.status AS userStatus,e.companystartdate AS hiredate,
social.siSchemeId,
base.payment_organization AS paymentOrganization,
fund.fundSchemeId,
other.otherSchemeId,
social.id AS socialId,
fund.id AS fundId,
other.id AS otherId,
e.companystartdate as companystartdate
FROM hrsa_insurance_base_info base
LEFT JOIN hrsa_external_employee e ON base.employee_id = e.id
LEFT JOIN hrmdepartment d ON e.department_id = d.ID
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
LEFT JOIN( SELECT social.id, social.employee_id, social.social_scheme_id AS siSchemeId, social.payment_organization FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON e.id = social.employee_id AND base.payment_organization = social.payment_organization
LEFT JOIN( SELECT fund.id, fund.employee_id, fund.fund_scheme_id AS fundSchemeId, fund.payment_organization FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON e.id = fund.employee_id AND base.payment_organization = fund.payment_organization
LEFT JOIN( SELECT other.id, other.employee_id, other.other_scheme_id AS otherSchemeId, other.payment_organization FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON e.id = other.employee_id AND base.payment_organization = other.payment_organization
WHERE
1=1
AND base.delete_type = 0
AND base.employee_type = 1
<include refid="extCondition"></include>
ORDER BY base.create_time desc
</select>
<sql id="condition">
@ -623,6 +652,235 @@
</if>
</sql>
<sql id="extCondition">
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like CONCAT('%',#{param.keyword},'%')
)
</if>
<if test="param.userName != null and param.userName != ''">
AND e.username like CONCAT('%',#{param.userName},'%')
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.statuses != null and param.statuses.size()>0">
AND e.status IN
<foreach collection="param.statuses" open="(" item="userStatus" separator="," close=")">
#{userStatus}
</foreach>
</if>
<if test="param.positions != null and param.positions.size()>0">
AND e.jobtitle_id IN
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
#{position}
</foreach>
</if>
<if test="param.hiredateStart != null">
AND e.companystartdate &gt; #{param.hiredateStart}
</if>
<if test="param.hiredateEnd != null">
AND e.companystartdate &lt; #{param.hiredateEnd}
</if>
<if test="param.siSchemeId != null and param.siSchemeId != 0">
AND siSchemeId = #{param.siSchemeId}
</if>
<if test="param.fundSchemeId != null and param.fundSchemeId != 0">
AND fundSchemeId = #{param.fundSchemeId}
</if>
<if test="param.otherSchemeId != null and param.otherSchemeId != 0">
AND otherSchemeId = #{param.otherSchemeId}
</if>
<if test="param.taxAgentId != null and param.taxAgentId != 0">
AND base.payment_organization = #{param.taxAgentId}
</if>
<if test="param.runStatuses != null and param.runStatuses.size()>0">
AND base.run_status IN
<foreach collection="param.runStatuses" open="(" item="runStatus" separator="," close=")">
#{runStatus}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size() > 0">
AND e.id IN
<foreach collection="param.employeeIds" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
<if test="param.ids != null and param.ids.size() > 0">
AND base.id IN
<foreach collection="param.ids" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
</sql>
<sql id="extCondition" databaseId="sqlserver">
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like '%'+#{param.keyword}+'%'
)
</if>
<if test="param.userName != null and param.userName != ''">
AND e.username like '%'+#{param.userName}+'%'
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like '%'+#{param.jobNum}+'%'
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.statuses != null and param.statuses.size()>0">
AND e.status IN
<foreach collection="param.statuses" open="(" item="userStatus" separator="," close=")">
#{userStatus}
</foreach>
</if>
<if test="param.positions != null and param.positions.size()>0">
AND e.jobtitle_id IN
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
#{position}
</foreach>
</if>
<if test="param.hiredateStart != null">
AND e.companystartdate &gt; #{param.hiredateStart}
</if>
<if test="param.hiredateEnd != null">
AND e.companystartdate &lt; #{param.hiredateEnd}
</if>
<if test="param.siSchemeId != null and param.siSchemeId != 0">
AND siSchemeId = #{param.siSchemeId}
</if>
<if test="param.fundSchemeId != null and param.fundSchemeId != 0">
AND fundSchemeId = #{param.fundSchemeId}
</if>
<if test="param.otherSchemeId != null and param.otherSchemeId != 0">
AND otherSchemeId = #{param.otherSchemeId}
</if>
<if test="param.taxAgentId != null and param.taxAgentId != 0">
AND base.payment_organization = #{param.taxAgentId}
</if>
<if test="param.runStatuses != null and param.runStatuses.size()>0">
AND base.run_status IN
<foreach collection="param.runStatuses" open="(" item="runStatus" separator="," close=")">
#{runStatus}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size() > 0">
AND e.id IN
<foreach collection="param.employeeIds" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
<if test="param.ids != null and param.ids.size() > 0">
AND base.id IN
<foreach collection="param.ids" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
</sql>
<sql id="extCondition" databaseId="oracle">
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like '%'||#{param.keyword}||'%'
)
</if>
<if test="param.userName != null and param.userName != ''">
AND e.username like '%'||#{param.userName}||'%'
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like '%'||#{param.jobNum}||'%'
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="param.statuses != null and param.statuses.size()>0">
AND e.status IN
<foreach collection="param.statuses" open="(" item="userStatus" separator="," close=")">
#{userStatus}
</foreach>
</if>
<if test="param.positions != null and param.positions.size()>0">
AND e.jobtitle_id IN
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
#{position}
</foreach>
</if>
<if test="param.hiredateStart != null">
AND e.companystartdate &gt; #{param.hiredateStart}
</if>
<if test="param.hiredateEnd != null">
AND e.companystartdate &lt; #{param.hiredateEnd}
</if>
<if test="param.siSchemeId != null and param.siSchemeId != 0">
AND siSchemeId = #{param.siSchemeId}
</if>
<if test="param.fundSchemeId != null and param.fundSchemeId != 0">
AND fundSchemeId = #{param.fundSchemeId}
</if>
<if test="param.otherSchemeId != null and param.otherSchemeId != 0">
AND otherSchemeId = #{param.otherSchemeId}
</if>
<if test="param.taxAgentId != null and param.taxAgentId != 0">
AND base.payment_organization = #{param.taxAgentId}
</if>
<if test="param.runStatuses != null and param.runStatuses.size()>0">
AND base.run_status IN
<foreach collection="param.runStatuses" open="(" item="runStatus" separator="," close=")">
#{runStatus}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size() > 0">
AND e.id IN
<foreach collection="param.employeeIds" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
<if test="param.ids != null and param.ids.size() > 0">
AND base.id IN
<foreach collection="param.ids" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
</sql>
<!-- 根据社保缴纳组织id获取记录 -->
<select id="getSocialByPaymentOrganization" resultMap="BaseResultMap" >
SELECT

View File

@ -77,7 +77,9 @@ public class SIImportServiceImpl extends Service implements SIImportService {
//工作簿名称
String sheetName;
//表头
if (param.getRunStatuses().size() > 0) {
if (param.isExtWelArchiveList()) {
sheetName = SalaryI18nUtil.getI18nLabel(542679, "非系统人员");
} else if (param.getRunStatuses().size() > 0) {
if (param.getRunStatuses().contains(EmployeeStatusEnum.STAY_ADD.getValue()) && param.getRunStatuses().size() == 1) {
sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板" + "-" + EmployeeStatusEnum.STAY_ADD.getDefaultLabel());
} else if (param.getRunStatuses().contains(EmployeeStatusEnum.PAYING.getValue()) && param.getRunStatuses().contains(EmployeeStatusEnum.STAY_DEL.getValue()) && param.getRunStatuses().size() == 2) {
@ -93,6 +95,7 @@ public class SIImportServiceImpl extends Service implements SIImportService {
sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板");
}
List<String> headers = buildHeader();
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
if (param.getHireDate() != null && param.getHireDate().length == 2) {
@ -130,7 +133,11 @@ public class SIImportServiceImpl extends Service implements SIImportService {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
List<InsuranceArchivesEmployeePO> page = new ArrayList<>();
page = socialSchemeMapper.queryEmployeeList(param);
if (param.isExtWelArchiveList()) {
page = socialSchemeMapper.queryExtEmployeeList(param);
} else {
page = socialSchemeMapper.queryEmployeeList(param);
}
PageInfo<InsuranceArchivesEmployeePO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(),
page, InsuranceArchivesEmployeePO.class);
int total = (int)pageInfo.getTotal();

View File

@ -233,4 +233,20 @@ public class SIArchivesController {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, Map<String, Object>>(user).run(getService(user)::deleteArchive, ids);
}
/**
* 查询非系统人员福利档案列表
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/getExtTable")
@Produces(MediaType.APPLICATION_JSON)
public String getExtTable(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody InsuranceArchivesListParam param) {
User user = HrmUserVarify.getUser(request, response);
param.setExtWelArchiveList(true);
return new ResponseResult<InsuranceArchivesListParam,Map<String,Object>>(user).run(getService(user)::listPage, param);
}
}

View File

@ -250,7 +250,7 @@ public class SISchemeController {
param.setRunStatuses( Arrays.stream(runStatuses.split(",")).map(String::valueOf).collect(Collectors.toList()));
}
param.setExportData(Boolean.valueOf(request.getParameter("exportData")));
param.setExtWelArchiveList(Boolean.valueOf(request.getParameter("extWelArchiveList")));
User user = HrmUserVarify.getUser(request, response);
if (param.getInspectAll() != null && param.getInspectAll()) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getSIAccountService(user).allInspects(param.getIds(), param.getBillMonth());
@ -259,7 +259,9 @@ public class SISchemeController {
XSSFWorkbook workbook = getService(user).exportTemplate(param);
String fileName;
//表头
if (param.getRunStatuses().size() > 0) {
if (param.isExtWelArchiveList()) {
fileName = SalaryI18nUtil.getI18nLabel(0, "社保福利档案导入模板") + "-" + SalaryI18nUtil.getI18nLabel(542679, "非系统人员");
} else if (param.getRunStatuses().size() > 0) {
if (param.getRunStatuses().contains(EmployeeStatusEnum.STAY_ADD.getValue()) && param.getRunStatuses().size() == 1) {
fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板" + "-" + EmployeeStatusEnum.STAY_ADD.getDefaultLabel());
} else if (param.getRunStatuses().contains(EmployeeStatusEnum.PAYING.getValue()) && param.getRunStatuses().contains(EmployeeStatusEnum.STAY_DEL.getValue()) && param.getRunStatuses().size() == 2) {
@ -275,6 +277,7 @@ public class SISchemeController {
fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板");
}
fileName = fileName + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");