社保福利台账 导出功能增加筛选条件,工号、部门、分部

This commit is contained in:
dxfeng 2025-12-17 10:05:29 +08:00
parent 7acdc94380
commit 0cea01300d
3 changed files with 132 additions and 2 deletions

View File

@ -45,4 +45,6 @@ public class InsuranceExportParam extends BaseQueryParam {
private List<Long> taxAgents;
private String workcode;
private List<Long> departmentIds;
private List<Long> subCompanyIds;
}

View File

@ -23,6 +23,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -51,6 +52,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -79,6 +81,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -96,6 +99,7 @@
LEFT JOIN hrmresource e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
where e.status not in (7)
<include refid="paramSql"/>
</select>
<select id="exportExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="oracle">
@ -108,6 +112,7 @@
LEFT JOIN hrmresource e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
where e.status not in (7)
<include refid="paramSql"/>
</select>
<select id="exportExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="sqlserver">
@ -120,6 +125,7 @@
LEFT JOIN hrmresource e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
where e.status not in (7)
<include refid="paramSql"/>
</select>
@ -147,6 +153,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -176,6 +183,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -205,6 +213,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
where e.status not in (7)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -233,6 +242,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<include refid="extParamSql"/>
<!-- 排序 -->
</select>
<select id="exportExtAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO" databaseId="oracle">
@ -256,6 +266,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<include refid="extParamSql"/>
<!-- 排序 -->
</select>
<select id="exportExtAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO" databaseId="sqlserver">
@ -279,6 +290,7 @@
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<include refid="extParamSql"/>
<!-- 排序 -->
</select>
@ -293,6 +305,7 @@
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
<include refid="extParamSql"/>
</select>
<select id="exportExtExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="oracle">
SELECT
@ -305,6 +318,7 @@
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
<include refid="extParamSql"/>
</select>
<select id="exportExtExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="sqlserver">
SELECT
@ -317,5 +331,113 @@
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
<include refid="extParamSql"/>
</select>
<sql id="paramSql">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like CONCAT('%',#{param.workcode},'%')
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid 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.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'||#{param.workcode}||'%'
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid 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.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{param.workcode}+'%'
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid 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.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="extParamSql">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like CONCAT('%',#{param.workcode},'%')
</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>
</sql>
<sql id="extParamSql" databaseId="oracle">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'||#{param.workcode}||'%'
</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>
</sql>
<sql id="extParamSql" databaseId="sqlserver">
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{param.workcode}+'%'
</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>
</sql>
</mapper>

View File

@ -112,8 +112,14 @@ public class SIExportController {
@Path("/common/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("billMonth") String billMonth,@QueryParam("paymentOrganization") String paymentOrganization) {
InsuranceExportParam param = InsuranceExportParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).build();
@QueryParam("billMonth") String billMonth,@QueryParam("paymentOrganization") String paymentOrganization,@QueryParam("departmentIds") String departmentIds,@QueryParam("subCompanyIds") String subCompanyIds,@QueryParam("workcode") String workcode) {
InsuranceExportParam param = InsuranceExportParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).workcode(workcode).build();
if(StringUtils.isNotBlank(departmentIds)){
param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::parseLong).collect(Collectors.toList()));
}
if(StringUtils.isNotBlank(subCompanyIds)){
param.setSubCompanyIds(Arrays.stream(subCompanyIds.split(",")).map(Long::parseLong).collect(Collectors.toList()));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.COMMON.getValue(),param);
String time = LocalDate.now().toString();