Commit 7c05ea48 authored by fangxinjiang's avatar fangxinjiang

派单查询导出优化

parent eb22fd4c
......@@ -165,28 +165,24 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个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;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
ExcelUtil<TDispatchInfoExportVo> util;
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
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)) {
writeSheet = EasyExcel.writerSheet("派单" + index).build();
excelWriter.write(list, writeSheet);
......
......@@ -595,58 +595,166 @@
<!-- 派单导出 -->
<select id="exportDispatch" resultMap="exportMap">
select
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_TYPE,
a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.TYPE,
a.SOCIAL_HOUSEHOLD_NAME,
a.PROVIDENT_HOUSEHOLD_NAME,
a.SOCIAL_HANDLE_STATUS,
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,
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,
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,
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,
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',s.BIGAILMENT_HANDLE,IF(a.TYPE='1' and a.SOCIAL_HANDLE_STATUS = '1','3',a.SOCIAL_HANDLE_STATUS)) as BIGAILMENT_HANDLE,
a.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,
a.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,'',a.STATUS) 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,'',a.STATUS) 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
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_TYPE,
a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
case when a.TYPE = 0 then "派增"
when a.TYPE = 1 then "派减"
else null end as "TYPE" ,
a.SOCIAL_HOUSEHOLD_NAME,
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 "SOCIAL_HANDLE_STATUS",
IF(a.TYPE='0',
case when s.PENSION_HANDLE = 0 then "待办理"
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.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
left join t_social_info s on s.id=a.SOCIAL_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