|  | @ -11,10 +11,15 @@ import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.constant.NumConstant; |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.constant.ServiceConstant; |  |  | import com.epmet.commons.tools.constant.ServiceConstant; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.constant.StrConstant; |  |  | import com.epmet.commons.tools.constant.StrConstant; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.commons.tools.enums.OrgTypeEnum; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.commons.tools.exception.EpmetException; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.exception.RenException; |  |  | import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.redis.RedisKeys; |  |  | import com.epmet.commons.tools.redis.RedisKeys; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.redis.RedisUtils; |  |  | import com.epmet.commons.tools.redis.RedisUtils; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.security.dto.TokenDto; |  |  | import com.epmet.commons.tools.security.dto.TokenDto; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.utils.ConvertUtils; |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.utils.DateUtils; |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
	
		
		
			
				
					|  | @ -55,6 +60,7 @@ import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					|  |  | import javax.servlet.http.HttpServletResponse; |  |  | import javax.servlet.http.HttpServletResponse; | 
			
		
	
		
		
			
				
					|  |  | import java.io.UnsupportedEncodingException; |  |  | import java.io.UnsupportedEncodingException; | 
			
		
	
		
		
			
				
					|  |  | import java.net.URLEncoder; |  |  | import java.net.URLEncoder; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import java.text.SimpleDateFormat; | 
			
		
	
		
		
			
				
					|  |  | import java.util.*; |  |  | import java.util.*; | 
			
		
	
		
		
			
				
					|  |  | import java.util.stream.Collectors; |  |  | import java.util.stream.Collectors; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -530,15 +536,15 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec | 
			
		
	
		
		
			
				
					|  |  | 		ExcelWriter excelWriter = null; |  |  | 		ExcelWriter excelWriter = null; | 
			
		
	
		
		
			
				
					|  |  | 		try { |  |  | 		try { | 
			
		
	
		
		
			
				
					|  |  | 			excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("网格员巡查记录.xlsx", response)).build(); |  |  | 			excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("网格员巡查记录.xlsx", response)).build(); | 
			
		
	
		
		
			
				
					
					|  |  | 			/*WriteSheet writeSheet = EasyExcel.writerSheet("sheet").build(); |  |  | 			WriteSheet writeSheet = EasyExcel.writerSheet(excelSheetName(formDTO)).build(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 			writeSheet.setClazz(StaffPatrolRecordExcel.class);*/ |  |  | 			writeSheet.setClazz(StaffPatrolRecordExcel.class); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 			int num = NumConstant.ZERO; |  |  | 			int num = NumConstant.ZERO; | 
			
		
	
		
		
			
				
					
					|  |  | 			//一千条一个sheet页,循环分批写入
 |  |  | 			//一千条查一次,循环分批写入
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 			do { |  |  | 			do { | 
			
		
	
		
		
			
				
					|  |  | 				PcworkRecordListResultDTO dto = pcworkRecordList(formDTO); |  |  | 				PcworkRecordListResultDTO dto = pcworkRecordList(formDTO); | 
			
		
	
		
		
			
				
					|  |  | 				List<StaffPatrolRecordExcel> data = ConvertUtils.sourceToTarget(dto.getList(), StaffPatrolRecordExcel.class); |  |  | 				List<StaffPatrolRecordExcel> data = ConvertUtils.sourceToTarget(dto.getList(), StaffPatrolRecordExcel.class); | 
			
		
	
		
		
			
				
					
					|  |  | 				WriteSheet writeSheet = EasyExcel.writerSheet(formDTO.getPageNo(), "sheet" + formDTO.getPageNo()).build(); |  |  | 				/*WriteSheet writeSheet = EasyExcel.writerSheet(formDTO.getPageNo(), "sheet" + formDTO.getPageNo()).build(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 				writeSheet.setClazz(StaffPatrolRecordExcel.class); |  |  | 				writeSheet.setClazz(StaffPatrolRecordExcel.class);*/ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 				excelWriter.write(data, writeSheet); |  |  | 				excelWriter.write(data, writeSheet); | 
			
		
	
		
		
			
				
					|  |  | 				num = data.size(); |  |  | 				num = data.size(); | 
			
		
	
		
		
			
				
					|  |  | 				formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |  |  | 				formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); | 
			
		
	
	
		
		
			
				
					|  | @ -552,4 +558,33 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec | 
			
		
	
		
		
			
				
					|  |  | 		} |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  | 	} |  |  | 	} | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 	private String excelSheetName(PcworkRecordListFormDTO formDTO){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		StringBuilder name = new StringBuilder(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		if (formDTO.getOrgType().equals(OrgTypeEnum.GRID.getCode())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			if (null == gridInfo){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				throw new EpmetException("查询网格信息失败..."); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			name.append(gridInfo.getGridName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		}else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			if (null == agencyInfo){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				throw new EpmetException("查询组织信息失败..."); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			name.append(agencyInfo.getOrganizationName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		name.append("巡查记录"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		try{ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			if (StringUtils.isNotBlank(formDTO.getStartTime())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				name.append(format2.format(format1.parse(formDTO.getStartTime()))).append("-").append(format2.format(format1.parse(formDTO.getEndTime()))).append("区间增长值"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			}else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				name.append(format2.format(format1.parse(formDTO.getEndTime()))).append("累计值"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		} catch (Exception e) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			e.printStackTrace(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		return name.toString(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
	
		
		
			
				
					|  | 
 |