@ -18,7 +18,6 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis ;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache ;
import com.epmet.commons.tools.security.dto.TokenDto ;
import com.epmet.commons.tools.utils.ConvertUtils ;
import com.epmet.commons.tools.utils.HttpClientManager ;
import com.epmet.commons.tools.utils.Result ;
import com.epmet.dataaggre.constant.DataSourceConstant ;
@ -829,15 +828,7 @@ public class GovOrgServiceImpl implements GovOrgService {
return ;
}
//3.生成多sheet页excel文件并写入数据导出文件
List < Map < String , Object > > headerList = new ArrayList < > ( ) ;
String titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "网格活跃度统计表" ) ;
headerList . add ( getHaderMap ( resultDTO . getLivelyExcelList ( ) , titleName , "各街镇网格运行情况" , GridLivelyExcel . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "活跃网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getLivelyGrid ( ) , titleName , "活跃网格统计" , GridLivelyDetailExcel . LivelyGrid . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "正常运行网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getOrdinaryGrid ( ) , titleName , "正常运行网格统计" , GridLivelyDetailExcel . OrdinaryGrid . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "僵尸网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getLazyGrid ( ) , titleName , "僵尸网格统计" , GridLivelyDetailExcel . LazyGrid . class ) ) ;
List < Map < String , Object > > headerList = getHeaderList ( formDTO , agencyInfo , resultDTO ) ;
try {
Workbook workbook = ExcelExportUtil . exportExcel ( headerList , ExcelType . XSSF ) ;
response . setCharacterEncoding ( "UTF-8" ) ;
@ -852,6 +843,20 @@ public class GovOrgServiceImpl implements GovOrgService {
log . error ( "网格活跃度导出失败" , e ) ;
}
}
private List < Map < String , Object > > getHeaderList ( GridLivelyFormDTO formDTO , AgencyInfoCache agencyInfo , GridLivelyDetailExcel resultDTO ) {
List < Map < String , Object > > headerList = new ArrayList < > ( ) ;
String titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "网格活跃度统计表" ) ;
headerList . add ( getHaderMap ( resultDTO . getLivelyExcelList ( ) , titleName , "各街镇网格运行情况" , GridLivelyExcel . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "活跃网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getLivelyGrid ( ) , titleName , "活跃网格统计" , GridLivelyDetailExcel . LivelyGrid . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "正常运行网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getOrdinaryGrid ( ) , titleName , "正常运行网格统计" , GridLivelyDetailExcel . OrdinaryGrid . class ) ) ;
titleName = excelTitleName ( formDTO . getStartTime ( ) , formDTO . getEndTime ( ) , agencyInfo . getOrganizationName ( ) + "僵尸网格明细" ) ;
headerList . add ( getHaderMap ( resultDTO . getLazyGrid ( ) , titleName , "僵尸网格统计" , GridLivelyDetailExcel . LazyGrid . class ) ) ;
return headerList ;
}
/ * *
* @Author sun
* data 业务数据集合
@ -902,25 +907,38 @@ public class GovOrgServiceImpl implements GovOrgService {
* * /
@Override
public void pcworkRecordListExportSendMsg ( GridLivelyFormDTO formDTO ) {
List < GridLivelyExcel > data = ConvertUtils . sourceToTarget ( grdiLively ( formDTO ) , GridLivelyExcel . class ) ;
/ * List < GridLivelyExcel > data = ConvertUtils . sourceToTarget ( grdiLively ( formDTO ) , GridLivelyExcel . class ) ;
if ( CollectionUtils . isEmpty ( data ) ) {
log . warn ( String . format ( "网格员活跃度统计数据查询为空,入参【%s】" , JSON . toJSONString ( formDTO ) ) ) ;
return ;
}
ExportParams exportParams = new ExportParams ( ) ;
String sheetName = excelSheetName ( formDTO ) ;
exportParams . setSheetName ( sheetName ) ;
Workbook workbook = ExcelExportUtil . exportExcel ( exportParams ,
GridLivelyExcel . class , data ) ;
GridLivelyExcel . class , data ) ; * /
//1.获取当前组织缓存信息
AgencyInfoCache agencyInfo = CustomerOrgRedis . getAgencyInfo ( formDTO . getAgencyId ( ) ) ;
if ( null = = agencyInfo ) {
throw new RenException ( String . format ( "获取组织缓存信息失败%s" , formDTO . getAgencyId ( ) ) ) ;
}
//2.查询网格活跃度数据
GridLivelyDetailExcel resultDTO = gridActiveList ( formDTO ) ;
if ( null = = resultDTO | | CollectionUtils . isEmpty ( resultDTO . getLivelyExcelList ( ) ) ) {
log . warn ( String . format ( "网格员活跃度统计数据为空,入参【%s】" , JSON . toJSONString ( formDTO ) ) ) ;
return ;
}
//3.生成多sheet页excel文件并写入数据导出文件
List < Map < String , Object > > headerList = getHeaderList ( formDTO , agencyInfo , resultDTO ) ;
// 文件名
String resultDescFileName = sheetName . concat ( ".xls" ) ;
String sheetName = excelSheetName ( formDTO ) ;
String resultDescFileName = sheetName . concat ( ".xlsx" ) ;
FileItemFactory factory = new DiskFileItemFactory ( 16 , null ) ;
FileItem fileItem = factory . createItem ( "file" , ContentType . APPLICATION_OCTET_STREAM . toString ( ) , true , resultDescFileName ) ;
OutputStream os = null ;
Result < UploadImgResultDTO > uploadResult = null ;
try {
Workbook workbook = ExcelExportUtil . exportExcel ( headerList , ExcelType . XSSF ) ;
os = fileItem . getOutputStream ( ) ;
workbook . write ( os ) ;
uploadResult = ossFeignClient . uploadImportTaskDescFile ( new CommonsMultipartFile ( fileItem ) ) ;
@ -957,6 +975,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//小雷哥手机号:18660295251,
OapiRobotSendRequest . At at = new OapiRobotSendRequest . At ( ) ;
at . setAtMobiles ( Arrays . asList ( "18660295251" ) ) ;
// at.setAtMobiles(Arrays.asList("15764229697"));
at . setIsAtAll ( false ) ;
dingTalkTextMsg . setAt ( at ) ;