Commit 7c05ea48 authored by fangxinjiang's avatar fangxinjiang

派单查询导出优化

parent eb22fd4c
...@@ -165,28 +165,24 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -165,28 +165,24 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
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, TDispatchInfoExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build(); ExcelUtil<TDispatchInfoExportVo> util = new ExcelUtil<>(TDispatchInfoExportVo.class);
// 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
redisLabelMap.putAll(userMap);
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchInfoExportVo.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<TDispatchInfoExportVo> util;
for (int i = 0; i <= count; ) { for (int i = 0; i <= count; ) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = exportDispatch(searchVo); list = exportDispatch(searchVo);
if (Common.isNotNull(list)) {
util = new ExcelUtil<>(TDispatchInfoExportVo.class);
for (TDispatchInfoExportVo vo : list) {
if (!userMap.isEmpty()) {
vo.setFundHandleUser(null != userMap.get(vo.getFundHandleUser()) ? userMap.get(vo.getFundHandleUser()) : "");
vo.setAuditUserName(null != userMap.get(vo.getAuditUserName()) ? userMap.get(vo.getAuditUserName()) : "");
vo.setFundAuditUser(null != userMap.get(vo.getFundAuditUser()) ? userMap.get(vo.getFundAuditUser()) : "");
vo.setHandleUser(null != userMap.get(vo.getHandleUser()) ? userMap.get(vo.getHandleUser()) : "");
}
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
writeSheet = EasyExcel.writerSheet("派单" + index).build(); writeSheet = EasyExcel.writerSheet("派单" + index).build();
excelWriter.write(list, writeSheet); excelWriter.write(list, writeSheet);
......
...@@ -600,17 +600,105 @@ ...@@ -600,17 +600,105 @@
a.EMP_TYPE, a.EMP_TYPE,
a.BELONG_UNIT_NAME, a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME, a.SETTLE_DOMAIN_NAME,
a.TYPE, case when a.TYPE = 0 then "派增"
when a.TYPE = 1 then "派减"
else null end as "TYPE" ,
a.SOCIAL_HOUSEHOLD_NAME, a.SOCIAL_HOUSEHOLD_NAME,
a.PROVIDENT_HOUSEHOLD_NAME, case when a.STATUS = 0 then "待办理"
a.SOCIAL_HANDLE_STATUS, when a.STATUS = 1 then "办理成功"
IF(a.TYPE='0',s.PENSION_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as PENSION_HANDLE, when a.STATUS = 2 then "办理失败"
IF(a.TYPE='0',s.MEDICAL_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as MEDICAL_HANDLE, when a.STATUS = 3 then "部分办理失败"
IF(a.TYPE='0',s.UNEMPLOY_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as UNEMPLOY_HANDLE, when a.STATUS = 4 then "办理中"
IF(a.TYPE='0',s.WORK_INJURY_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as WORK_INJURY_HANDLE, else null end as "SOCIAL_HANDLE_STATUS",
IF(a.TYPE='0',s.BIRTH_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as BIRTH_HANDLE, IF(a.TYPE='0',
IF(a.TYPE='0',s.BIGAILMENT_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as BIGAILMENT_HANDLE, case when s.PENSION_HANDLE = 0 then "待办理"
a.FUND_HANDLE_STATUS, when s.PENSION_HANDLE = 1 then "办理成功"
when s.PENSION_HANDLE = 2 then "办理失败"
when s.PENSION_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as PENSION_HANDLE,
IF(a.TYPE='0',
case when s.MEDICAL_HANDLE = 0 then "待办理"
when s.MEDICAL_HANDLE = 1 then "办理成功"
when s.MEDICAL_HANDLE = 2 then "办理失败"
when s.MEDICAL_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as MEDICAL_HANDLE,
IF(a.TYPE='0',
case when s.UNEMPLOY_HANDLE = 0 then "待办理"
when s.UNEMPLOY_HANDLE = 1 then "办理成功"
when s.UNEMPLOY_HANDLE = 2 then "办理失败"
when s.UNEMPLOY_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as UNEMPLOY_HANDLE,
IF(a.TYPE='0',
case when s.WORK_INJURY_HANDLE = 0 then "待办理"
when s.WORK_INJURY_HANDLE = 1 then "办理成功"
when s.WORK_INJURY_HANDLE = 2 then "办理失败"
when s.WORK_INJURY_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as WORK_INJURY_HANDLE,
IF(a.TYPE='0',
case when s.BIRTH_HANDLE = 0 then "待办理"
when s.BIRTH_HANDLE = 1 then "办理成功"
when s.BIRTH_HANDLE = 2 then "办理失败"
when s.BIRTH_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as BIRTH_HANDLE,
IF(a.TYPE='0',
case when s.BIGAILMENT_HANDLE = 0 then "待办理"
when s.BIGAILMENT_HANDLE = 1 then "办理成功"
when s.BIGAILMENT_HANDLE = 2 then "办理失败"
when s.BIGAILMENT_HANDLE = 3 then "已派减"
else null end,
IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
else null end
))
as BIGAILMENT_HANDLE,
case when a.FUND_HANDLE_STATUS = 0 then "待办理"
when a.FUND_HANDLE_STATUS = 1 then "办理成功"
when a.FUND_HANDLE_STATUS = 2 then "办理失败"
when a.FUND_HANDLE_STATUS = 3 then "已派减"
else null end as FUND_HANDLE_STATUS,
a.CREATE_NAME, a.CREATE_NAME,
a.ORGAN_NAME, a.ORGAN_NAME,
a.CREATE_TIME, a.CREATE_TIME,
...@@ -623,19 +711,38 @@ ...@@ -623,19 +711,38 @@
a.TRUST_REMARK, a.TRUST_REMARK,
a.LEAVE_DATE, a.LEAVE_DATE,
a.REDUCE_REASON, a.REDUCE_REASON,
a.STATUS, case when a.STATUS = 0 then "未提交"
when a.STATUS = 1 then "待审核"
when a.STATUS = 2 then "审核通过"
when a.STATUS = 3 then "审核不通过"
when a.STATUS = 4 then "已办结"
else null end as STATUS,
a.AUDIT_USER_NAME as AUDIT_USER, a.AUDIT_USER_NAME as AUDIT_USER,
a.AUDIT_TIME, a.AUDIT_TIME,
a.FUND_HANDLE_REMARK, a.FUND_HANDLE_REMARK,
a.SOCIAL_HANDLE_REMARK, a.SOCIAL_HANDLE_REMARK,
a.FUND_REDUCE_DATE, a.FUND_REDUCE_DATE,
c.PROVIDENT_START, c.PROVIDENT_START,
if(a.FUND_ID = NULL,'',a.STATUS) as FUND_AUDIT_STATUS, if(a.FUND_ID = NULL,'',
(case when a.STATUS = 0 then "未提交"
when a.STATUS = 1 then "待审核"
when a.STATUS = 2 then "审核通过"
when a.STATUS = 3 then "审核不通过"
when a.STATUS = 4 then "已办结"
else null end )
) as FUND_AUDIT_STATUS,
c.AUDIT_USER as FUND_AUDIT_USER, c.AUDIT_USER as FUND_AUDIT_USER,
c.HANDLE_USER as FUND_HANDLE_USER, c.HANDLE_USER as FUND_HANDLE_USER,
c.HANDLE_TIME as FUND_HANDLE_TIME, c.HANDLE_TIME as FUND_HANDLE_TIME,
s.AUDIT_USER as AUDIT_USER_NAME, s.AUDIT_USER as AUDIT_USER_NAME,
if(a.SOCIAL_ID =NULL,'',a.STATUS) as AUDIT_STATUS, if(a.SOCIAL_ID =NULL,'',
(case when a.STATUS = 0 then "未提交"
when a.STATUS = 1 then "待审核"
when a.STATUS = 2 then "审核通过"
when a.STATUS = 3 then "审核不通过"
when a.STATUS = 4 then "已办结"
else null end )
) as AUDIT_STATUS,
s.SOCIAL_START_DATE, s.SOCIAL_START_DATE,
a.SOCIAL_REDUCE_DATE, a.SOCIAL_REDUCE_DATE,
s.RECORD_BASE, s.RECORD_BASE,
...@@ -647,6 +754,7 @@ ...@@ -647,6 +754,7 @@
s.UNIT_BIGAILMENT_CARDINAL, s.UNIT_BIGAILMENT_CARDINAL,
s.UNIT_WORK_INJURY_CARDINAL, s.UNIT_WORK_INJURY_CARDINAL,
s.UNIT_BIRTH_CARDINAL s.UNIT_BIRTH_CARDINAL
from t_dispatch_info a from t_dispatch_info a
left join t_social_info s on s.id=a.SOCIAL_ID left join t_social_info s on s.id=a.SOCIAL_ID
left join t_provident_fund c on c.id=a.FUND_ID left join t_provident_fund c on c.id=a.FUND_ID
......
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