|
|
@ -19,6 +19,9 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
@ -47,6 +50,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.*; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|
|
|
import com.epmet.constant.IcPlatformConstant; |
|
|
|
import com.epmet.constant.IcResiUserConstant; |
|
|
|
import com.epmet.constant.UserConstant; |
|
|
@ -59,6 +63,8 @@ import com.epmet.dto.result.demand.IcResiDemandDictDTO; |
|
|
|
import com.epmet.dto.result.demand.OptionDTO; |
|
|
|
import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.excel.DataSyncRecordDisabilityExcel; |
|
|
|
import com.epmet.excel.EpidemicPreventionExportExcel; |
|
|
|
import com.epmet.excel.support.ExportResiUserItemDTO; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.opendata.dto.form.GetResidentDetailByIdCardFormDTO; |
|
|
@ -83,6 +89,9 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.sql.Timestamp; |
|
|
@ -1673,8 +1682,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
if (null != staffInfo) { |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
} |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<EpidemicPreventionResultDTO> list = baseDao.getEpidemicPreventionList(formDTO); |
|
|
|
List<EpidemicPreventionResultDTO> list = new ArrayList<>(); |
|
|
|
if (formDTO.getIsPage()){ |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
list = baseDao.getEpidemicPreventionList(formDTO); |
|
|
|
}else { |
|
|
|
list = baseDao.getEpidemicPreventionList(formDTO); |
|
|
|
} |
|
|
|
|
|
|
|
PageInfo<EpidemicPreventionResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//查询网格名称
|
|
|
@ -3544,4 +3559,38 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
IcResiUserEntity icResiUserEntity = baseDao.selectById(userId); |
|
|
|
return ConvertUtils.sourceToTarget(icResiUserEntity,IcResiUserInfoCache.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void epidemicPreventionExport(EpidemicPreventionFormDTO formDTO, HttpServletResponse response) throws IOException { |
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
formDTO.setPageNo(NumConstant.ONE); |
|
|
|
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|
|
|
try { |
|
|
|
String fileName = "居民防疫信息" + DateUtils.format(new Date()) + ".xlsx"; |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), EpidemicPreventionExportExcel.class).build(); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|
|
|
List<EpidemicPreventionExportExcel> list = null; |
|
|
|
do { |
|
|
|
PageData<EpidemicPreventionResultDTO> data = epidemicPreventionList(formDTO); |
|
|
|
list = ConvertUtils.sourceToTarget(data.getList(), EpidemicPreventionExportExcel.class); |
|
|
|
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|
|
|
excelWriter.write(list, writeSheet); |
|
|
|
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); |
|
|
|
} catch (EpmetException e) { |
|
|
|
response.reset(); |
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|
|
|
PrintWriter printWriter = response.getWriter(); |
|
|
|
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); |
|
|
|
printWriter.write(JSON.toJSONString(result)); |
|
|
|
printWriter.close(); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("export exception", e); |
|
|
|
} finally { |
|
|
|
if (excelWriter != null) { |
|
|
|
excelWriter.finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|