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);
......
...@@ -595,58 +595,166 @@ ...@@ -595,58 +595,166 @@
<!-- 派单导出 --> <!-- 派单导出 -->
<select id="exportDispatch" resultMap="exportMap"> <select id="exportDispatch" resultMap="exportMap">
select select
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
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 "派增"
a.SOCIAL_HOUSEHOLD_NAME, when a.TYPE = 1 then "派减"
a.PROVIDENT_HOUSEHOLD_NAME, else null end as "TYPE" ,
a.SOCIAL_HANDLE_STATUS, a.SOCIAL_HOUSEHOLD_NAME,
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, case when a.STATUS = 0 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 = 1 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 = 2 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, when a.STATUS = 3 then "部分办理失败"
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, when a.STATUS = 4 then "办理中"
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, else null end as "SOCIAL_HANDLE_STATUS",
a.FUND_HANDLE_STATUS, IF(a.TYPE='0',
a.CREATE_NAME, case when s.PENSION_HANDLE = 0 then "待办理"
a.ORGAN_NAME, when s.PENSION_HANDLE = 1 then "办理成功"
a.CREATE_TIME, when s.PENSION_HANDLE = 2 then "办理失败"
a.CONTRACT_NAME AS CONTRACT_TYPE, when s.PENSION_HANDLE = 3 then "已派减"
a.CONTRACT_SUB_NAME, else null end,
a.CONTRACT_TERM, IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
a.CONTRACT_START, case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
a.CONTRACT_END, when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
a.AUDIT_REMARK, when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
a.TRUST_REMARK, when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
a.LEAVE_DATE, else null end
a.REDUCE_REASON, ))
a.STATUS, as PENSION_HANDLE,
a.AUDIT_USER_NAME as AUDIT_USER, IF(a.TYPE='0',
a.AUDIT_TIME, case when s.MEDICAL_HANDLE = 0 then "待办理"
a.FUND_HANDLE_REMARK, when s.MEDICAL_HANDLE = 1 then "办理成功"
a.SOCIAL_HANDLE_REMARK, when s.MEDICAL_HANDLE = 2 then "办理失败"
a.FUND_REDUCE_DATE, when s.MEDICAL_HANDLE = 3 then "已派减"
c.PROVIDENT_START, else null end,
if(a.FUND_ID = NULL,'',a.STATUS) as FUND_AUDIT_STATUS, IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
c.AUDIT_USER as FUND_AUDIT_USER, case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
c.HANDLE_USER as FUND_HANDLE_USER, when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
c.HANDLE_TIME as FUND_HANDLE_TIME, when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
s.AUDIT_USER as AUDIT_USER_NAME, when a.SOCIAL_HANDLE_STATUS = 3 then "已派减"
if(a.SOCIAL_ID =NULL,'',a.STATUS) as AUDIT_STATUS, else null end
s.SOCIAL_START_DATE, ))
a.SOCIAL_REDUCE_DATE, as MEDICAL_HANDLE,
s.RECORD_BASE, IF(a.TYPE='0',
s.HANDLE_USER, case when s.UNEMPLOY_HANDLE = 0 then "待办理"
s.HANDLE_TIME, when s.UNEMPLOY_HANDLE = 1 then "办理成功"
s.UNIT_PENSION_CARDINAL, when s.UNEMPLOY_HANDLE = 2 then "办理失败"
s.UNIT_MEDICAL_CARDINAL, when s.UNEMPLOY_HANDLE = 3 then "已派减"
s.UNIT_UNEMPLOYMENT_CARDINAL, else null end,
s.UNIT_BIGAILMENT_CARDINAL, IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1',"已派减",
s.UNIT_WORK_INJURY_CARDINAL, case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
s.UNIT_BIRTH_CARDINAL 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.ORGAN_NAME,
a.CREATE_TIME,
a.CONTRACT_NAME AS CONTRACT_TYPE,
a.CONTRACT_SUB_NAME,
a.CONTRACT_TERM,
a.CONTRACT_START,
a.CONTRACT_END,
a.AUDIT_REMARK,
a.TRUST_REMARK,
a.LEAVE_DATE,
a.REDUCE_REASON,
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_TIME,
a.FUND_HANDLE_REMARK,
a.SOCIAL_HANDLE_REMARK,
a.FUND_REDUCE_DATE,
c.PROVIDENT_START,
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.HANDLE_USER as FUND_HANDLE_USER,
c.HANDLE_TIME as FUND_HANDLE_TIME,
s.AUDIT_USER as AUDIT_USER_NAME,
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,
a.SOCIAL_REDUCE_DATE,
s.RECORD_BASE,
s.HANDLE_USER,
s.HANDLE_TIME,
s.UNIT_PENSION_CARDINAL,
s.UNIT_MEDICAL_CARDINAL,
s.UNIT_UNEMPLOYMENT_CARDINAL,
s.UNIT_BIGAILMENT_CARDINAL,
s.UNIT_WORK_INJURY_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