Commit eb22fd4c authored by fangxinjiang's avatar fangxinjiang

社保公积金查询导出速度优化

parent 03542cf5
...@@ -32,6 +32,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -32,6 +32,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeExportVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
...@@ -109,22 +111,22 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -109,22 +111,22 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8")); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfoExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build(); ExcelUtil<TSocialFundInfoExportVo> util = new ExcelUtil<>(TSocialFundInfoExportVo.class);
// 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfoExportVo.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap))
.includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet; WriteSheet writeSheet;
ExcelUtil<TSocialFundInfoExportVo> util;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = export(searchVo); list = export(searchVo);
if (Common.isNotNull(list)) {
util = new ExcelUtil<>(TSocialFundInfoExportVo.class);
for (TSocialFundInfoExportVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (list != null) { if (list != null) {
writeSheet = EasyExcel.writerSheet("社保公积金查询表" + index).build(); writeSheet = EasyExcel.writerSheet("社保公积金查询表" + index).build();
excelWriter.write(list, writeSheet); excelWriter.write(list, writeSheet);
......
...@@ -939,18 +939,21 @@ ...@@ -939,18 +939,21 @@
a.ID, a.ID,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.EMP_TYPE, case when a.EMP_TYPE = 1 then "标准工时"
when a.EMP_TYPE = 2 then "综合工时"
when a.EMP_TYPE = 3 then "不定时工时制"
else null end as "EMP_TYPE" ,
d.EMP_MOBILE, d.EMP_MOBILE,
if(a.SETTLE_DOMAIN_CODE = a.SETTLE_DOMAIN_CODE_FUND,a.SETTLE_DOMAIN_CODE,concat(ifnull(a.SETTLE_DOMAIN_CODE,""),if(a.SETTLE_DOMAIN_CODE is null or a.SETTLE_DOMAIN_CODE_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_CODE_FUND,""))) SETTLE_DOMAIN_CODE, if(a.SETTLE_DOMAIN_CODE = a.SETTLE_DOMAIN_CODE_FUND,a.SETTLE_DOMAIN_CODE,concat(ifnull(a.SETTLE_DOMAIN_CODE,""),if(a.SETTLE_DOMAIN_CODE is null or a.SETTLE_DOMAIN_CODE_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_CODE_FUND,""))) SETTLE_DOMAIN_CODE,
if(a.SETTLE_DOMAIN_NAME = a.SETTLE_DOMAIN_NAME_FUND,a.SETTLE_DOMAIN_NAME,concat(ifnull(a.SETTLE_DOMAIN_NAME,""),if(a.SETTLE_DOMAIN_NAME is null or a.SETTLE_DOMAIN_NAME_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_NAME_FUND,""))) SETTLE_DOMAIN_NAME, if(a.SETTLE_DOMAIN_NAME = a.SETTLE_DOMAIN_NAME_FUND,a.SETTLE_DOMAIN_NAME,concat(ifnull(a.SETTLE_DOMAIN_NAME,""),if(a.SETTLE_DOMAIN_NAME is null or a.SETTLE_DOMAIN_NAME_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_NAME_FUND,""))) SETTLE_DOMAIN_NAME,
if(a.UNIT_NAME = a.UNIT_NAME_FUND,a.UNIT_NAME,concat(ifnull(a.UNIT_NAME,""),if(a.UNIT_NAME is null or a.UNIT_NAME_FUND is null,"",","),ifnull(a.UNIT_NAME_FUND,""))) UNIT_NAME, if(a.UNIT_NAME = a.UNIT_NAME_FUND,a.UNIT_NAME,concat(ifnull(a.UNIT_NAME,""),if(a.UNIT_NAME is null or a.UNIT_NAME_FUND is null,"",","),ifnull(a.UNIT_NAME_FUND,""))) UNIT_NAME,
d.ID_CARD_PROVINCE, a1.AREA_NAME as "ID_CARD_PROVINCE",
d.ID_CARD_CITY, a2.AREA_NAME as "ID_CARD_CITY",
d.ID_CARD_TOWN, a3.AREA_NAME as "ID_CARD_TOWN",
d.ID_CARD_ADDRESS, d.ID_CARD_ADDRESS,
d.FILE_PROVINCE, d1.AREA_NAME as "FILE_PROVINCE",
d.FILE_CITY, d2.AREA_NAME as "FILE_CITY",
d.FILE_TOWN, d3.AREA_NAME as "FILE_TOWN",
d.POST, d.POST,
d.TRY_PERIOD, d.TRY_PERIOD,
d.WORKING_HOURS, d.WORKING_HOURS,
...@@ -963,8 +966,28 @@ ...@@ -963,8 +966,28 @@
d.CONTRACT_TERM, d.CONTRACT_TERM,
d.EDUCATION_NAME, d.EDUCATION_NAME,
a.RECORD_BASE, a.RECORD_BASE,
a.SOCIAL_STATUS, case when a.SOCIAL_STATUS = 0 then "派增待审核"
a.FUND_STATUS, when a.SOCIAL_STATUS = 1 then "派增待办理"
when a.SOCIAL_STATUS = 2 then "派增办理中"
when a.SOCIAL_STATUS = 3 then "派增办理成功"
when a.SOCIAL_STATUS = 4 then "派增部分办理失败"
when a.SOCIAL_STATUS = 5 then "派增办理失败"
when a.SOCIAL_STATUS = 6 then "派减待审核"
when a.SOCIAL_STATUS = 7 then "派减待办理"
when a.SOCIAL_STATUS = 8 then "派减办理成功"
when a.SOCIAL_STATUS = 9 then "派减办理失败"
when a.SOCIAL_STATUS = 10 then "派增审核不通过"
else null end as "SOCIAL_STATUS" ,
case when a.FUND_STATUS = 0 then "派增待审核"
when a.FUND_STATUS = 1 then "派增待办理"
when a.FUND_STATUS = 3 then "派增办理成功"
when a.FUND_STATUS = 4 then "派增办理失败"
when a.FUND_STATUS = 5 then "派减待审核"
when a.FUND_STATUS = 6 then "派减待办理"
when a.FUND_STATUS = 7 then "派减办理成功"
when a.FUND_STATUS = 8 then "派减办理失败"
when a.FUND_STATUS = 9 then "派增审核不通过"
else null end as "FUND_STATUS" ,
a.SOCIAL_START_DATE, a.SOCIAL_START_DATE,
a.PROVIDENT_START, a.PROVIDENT_START,
a.SOCIAL_REDUCE_DATE, a.SOCIAL_REDUCE_DATE,
...@@ -975,16 +998,19 @@ ...@@ -975,16 +998,19 @@
a.PERSONAL_FUND_SUM, a.PERSONAL_FUND_SUM,
ifnull(a.UNIT_SOCIAL_SUM,0) + ifnull(a.PERSONAL_SOCIAL_SUM,0) + ifnull(a.UNIT_FUND_SUM,0) + ifnull(a.PERSONAL_FUND_SUM,0) ALL_SUM, ifnull(a.UNIT_SOCIAL_SUM,0) + ifnull(a.PERSONAL_SOCIAL_SUM,0) + ifnull(a.UNIT_FUND_SUM,0) + ifnull(a.PERSONAL_FUND_SUM,0) ALL_SUM,
a.SOCIAL_HOUSEHOLD_NAME, a.SOCIAL_HOUSEHOLD_NAME,
a.SOCIAL_PROVINCE, s1.AREA_NAME as "SOCIAL_PROVINCE",
a.SOCIAL_CITY, s2.AREA_NAME as "SOCIAL_CITY",
a.SOCIAL_TOWN, s3.AREA_NAME as "SOCIAL_TOWN",
a.PENSION_START, a.PENSION_START,
a.MEDICAL_START, a.MEDICAL_START,
a.UNEMPLOY_START, a.UNEMPLOY_START,
a.WORK_INJURY_START, a.WORK_INJURY_START,
a.BIRTH_START, a.BIRTH_START,
a.BIGAILMENT_START, a.BIGAILMENT_START,
a.PAYMENT_TYPE, case when a.PAYMENT_TYPE = 0 then "最低"
when a.PAYMENT_TYPE = 1 then "自定义"
when a.PAYMENT_TYPE = 2 then "最高"
else null end as "PAYMENT_TYPE" ,
a.UNIT_PENSION_CARDINAL, a.UNIT_PENSION_CARDINAL,
a.UNIT_PENSION_PER, a.UNIT_PENSION_PER,
...@@ -1023,9 +1049,9 @@ ...@@ -1023,9 +1049,9 @@
ifnull(a.UNIT_BIGAILMENT_MONEY,0) + ifnull(a.PERSONAL_BIGAILMENT_MONEY,0) BIGAILMENT_MONEY, ifnull(a.UNIT_BIGAILMENT_MONEY,0) + ifnull(a.PERSONAL_BIGAILMENT_MONEY,0) BIGAILMENT_MONEY,
a.PROVIDENT_HOUSEHOLD_NAME, a.PROVIDENT_HOUSEHOLD_NAME,
d.FUND_PROVINCE, f1.AREA_NAME as "FUND_PROVINCE",
d.FUND_CITY, f2.AREA_NAME as "FUND_CITY",
d.FUND_TOWN, f3.AREA_NAME as "FUND_TOWN",
a.UNIT_PROVIDENG_CARDINAL, a.UNIT_PROVIDENG_CARDINAL,
a.UNIT_PROVIDENT_PER, a.UNIT_PROVIDENT_PER,
a.PERSONAL_PROVIDENT_PER, a.PERSONAL_PROVIDENT_PER,
...@@ -1033,16 +1059,53 @@ ...@@ -1033,16 +1059,53 @@
a.PERSONAL_FUND_SUM PERSONAL_FUND_SUM2, a.PERSONAL_FUND_SUM PERSONAL_FUND_SUM2,
ifnull(a.UNIT_FUND_SUM,0) + ifnull(a.PERSONAL_FUND_SUM,0) FUND_SUM, ifnull(a.UNIT_FUND_SUM,0) + ifnull(a.PERSONAL_FUND_SUM,0) FUND_SUM,
a.TRUST_REMARK, a.TRUST_REMARK,
a.PENSION_HANDLE, case when a.PENSION_HANDLE = 0 then "待办理"
a.MEDICAL_HANDLE, when a.PENSION_HANDLE = 1 then "办理成功"
a.UNEMPLOY_HANDLE, when a.PENSION_HANDLE = 2 then "办理失败"
a.WORK_INJURY_HANDLE, when a.PENSION_HANDLE = 3 then "已派减"
a.BIRTH_HANDLE, else null end as "PENSION_HANDLE" ,
a.BIGAILMENT_HANDLE, case when a.MEDICAL_HANDLE = 0 then "待办理"
when a.MEDICAL_HANDLE = 1 then "办理成功"
when a.MEDICAL_HANDLE = 2 then "办理失败"
when a.MEDICAL_HANDLE = 3 then "已派减"
else null end as "MEDICAL_HANDLE" ,
case when a.UNEMPLOY_HANDLE = 0 then "待办理"
when a.UNEMPLOY_HANDLE = 1 then "办理成功"
when a.UNEMPLOY_HANDLE = 2 then "办理失败"
when a.UNEMPLOY_HANDLE = 3 then "已派减"
else null end as "UNEMPLOY_HANDLE" ,
case when a.WORK_INJURY_HANDLE = 0 then "待办理"
when a.WORK_INJURY_HANDLE = 1 then "办理成功"
when a.WORK_INJURY_HANDLE = 2 then "办理失败"
when a.WORK_INJURY_HANDLE = 3 then "已派减"
else null end as "WORK_INJURY_HANDLE" ,
case when a.BIRTH_HANDLE = 0 then "待办理"
when a.BIRTH_HANDLE = 1 then "办理成功"
when a.BIRTH_HANDLE = 2 then "办理失败"
when a.BIRTH_HANDLE = 3 then "已派减"
else null end as "BIRTH_HANDLE" ,
case when a.BIGAILMENT_HANDLE = 0 then "待办理"
when a.BIGAILMENT_HANDLE = 1 then "办理成功"
when a.BIGAILMENT_HANDLE = 2 then "办理失败"
when a.BIGAILMENT_HANDLE = 3 then "已派减"
else null end as "BIGAILMENT_HANDLE" ,
d.EMP_NATIONAL, d.EMP_NATIONAL,
d.EMP_REGIS_TYPE d.EMP_REGIS_TYPE
from t_social_fund_info a from t_social_fund_info a
left join t_dispatch_info d on a.DISPATCH_ID=d.ID left join t_dispatch_info d on a.DISPATCH_ID=d.ID
LEFT JOIN sys_area a1 on d.ID_CARD_PROVINCE=a1.id
LEFT JOIN sys_area a2 on d.ID_CARD_CITY=a2.id
LEFT JOIN sys_area a3 on d.ID_CARD_TOWN=a3.id
LEFT JOIN sys_area s1 on a.SOCIAL_PROVINCE=s1.id
LEFT JOIN sys_area s2 on a.SOCIAL_CITY=s2.id
LEFT JOIN sys_area s3 on a.SOCIAL_TOWN=s3.id
LEFT JOIN sys_area f1 on d.FUND_PROVINCE=f1.id
LEFT JOIN sys_area f2 on d.FUND_CITY=f2.id
LEFT JOIN sys_area f3 on d.FUND_TOWN=f3.id
LEFT JOIN sys_area d1 on d.FILE_PROVINCE=d1.id
LEFT JOIN sys_area d2 on d.FILE_CITY=d2.id
LEFT JOIN sys_area d3 on d.FILE_TOWN=d3.id
<where> <where>
1=1 1=1
<include refid="tSocialFundInfo_where"/> <include refid="tSocialFundInfo_where"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment