Procházet zdrojové kódy

台区停电周报修改

tudc před 4 roky
rodič
revize
40ba65d5f6

+ 74 - 43
src/main/java/com/minpay/common/service/impl/ReportServiceImpl.java

@@ -669,7 +669,7 @@ public class ReportServiceImpl implements IReportService {
 		param.put("yesterday", rangeArray[1]);
 		List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
 
-		// 等于三次且当天停电
+		// 大于等于三次且当天停电
 		List<Map<String, String>> yesterdayAndTDData = null;
 		if (yesterdayList.size() != 0) {
 			param.put("yesterdayDetail", yesterdayList);
@@ -890,6 +890,7 @@ public class ReportServiceImpl implements IReportService {
 		List<String> title = new ArrayList<String>();
 		title.add("单位\\分类");
 		title.add("管理台区总数");
+		title.add("本周停电台区数");
 		title.add("本周累计停电台次");
 		title.add("停电时户数");
 		title.add("本周平均停电时长(小时)");
@@ -918,6 +919,28 @@ public class ReportServiceImpl implements IReportService {
 		heji.add(totalMap.get("合计"));
 
 		resList.add(heji);
+		
+		// 停电台区数
+		List<Map<String, String>> tqCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByAddress(param);
+		String tqTotalCount = "0";
+		for (Map<String, String> map : tqCountList) {
+			String area = map.get("area");
+			String num = map.get("num");
+			if (areaList.contains(area)) {
+				int index = areaList.indexOf(area);
+				List<String> child = resList.get(index + 1);
+				child.add(num);
+			} else {
+				continue;
+			}
+			tqTotalCount = CommonUtil.add(tqTotalCount, num);
+		}
+		heji.add(tqTotalCount);
+		for (List<String> list : resList) {
+			if (list.size() == 2) {
+				list.add("0");
+			}
+		}
 
 		//累计停电台次
 		List<Map<String, String>> areaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param);
@@ -937,7 +960,7 @@ public class ReportServiceImpl implements IReportService {
 		heji.add(totalCount);
 		// 没有数据的区域数值为0
 		for (List<String> list : resList) {
-			if (list.size() == 2) {
+			if (list.size() == 3) {
 				list.add("0");
 			}
 		}
@@ -949,22 +972,19 @@ public class ReportServiceImpl implements IReportService {
 		String totalCountSC = "0";
 		List<Map<String, String>> areaTimeList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param);
 		for (Map<String, String> map : areaTimeList) {
+			String count = map.get("count");
 			String area = map.get("area");
 			String timeMinute = map.get("timeMinute");
-			String count = map.get("count");
-			// 平均停电小时
-			String hour = CommonUtil.divide(timeMinute, "60", 2);	// 时户
-			String hourPJ = CommonUtil.divide(hour, count, 2);		// 平均时长
-
+			String hour = CommonUtil.divide(timeMinute, "60", 2);				// 时户
 			if (areaList.contains(area)) {
 				int index = areaList.indexOf(area);
 				List<String> child = resList.get(index + 1);
+				String hourPJ = CommonUtil.divide(hour, child.get(2), 2);		// 本周平均停电时长= 停电时户数/停电台区数
 				child.add(hour);
 				child.add(hourPJ);
 			} else {
 				continue;
 			}
-
 			if (CommonUtil.compare(shihuNum, hour) == -1) {
 				shihuNum = hour;
 				shihuArea = area;
@@ -977,7 +997,7 @@ public class ReportServiceImpl implements IReportService {
 
 		// 没有数据的区域数值为0
 		for (List<String> list : resList) {
-			if (list.size() == 3) {
+			if (list.size() == 4) {
 				list.add("0");
 				list.add("0");
 			}
@@ -992,7 +1012,7 @@ public class ReportServiceImpl implements IReportService {
 		String mostAddressNumDesc = "";
 		// 停电最多的次数
 		String mostAddressNum = "";
-		String totalChongfu = "0";
+		
 		List<Map<String, String>> twiceCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
 		for (Map<String, String> map : twiceCountList) {
 			String area = map.get("area");
@@ -1002,32 +1022,38 @@ public class ReportServiceImpl implements IReportService {
 			if (areaList.contains(area)) {
 				int index = areaList.indexOf(area);
 				List<String> child = resList.get(index + 1);
-				if (child.size() >= 6) {
-					child.set(5, CommonUtil.add(child.get(5), "1"));
+				
+				// 本周督办频繁停电台次
+				if (child.size() >= 7) {
+					child.set(6, CommonUtil.add(child.get(6), "1"));
 				} else {
-					child.add(5, "1");
+					child.add(6, "1");
 				}
 			} else {
 				continue;
 			}
-
-			totalChongfu = CommonUtil.add(totalChongfu, "1");
-
+			
 			if (CommonUtil.isEmpty(mostAddressNum)) {
 				mostAddressNum = num;
 			}
 			if (mostAddressNum.equals(num)) {
 				mostAddressNumDesc += addressName + "、";
 			}
+			
+			// 合计
+			if (heji.size() >= 7) {
+				heji.set(6, CommonUtil.add(heji.get(6), "1"));
+			} else {
+				heji.add("1");
+			}
 		}
 		// 去除最后一个符号
 		if (!CommonUtil.isEmpty(mostAddressNumDesc)) {
 			mostAddressNumDesc = mostAddressNumDesc.substring(0, mostAddressNumDesc.length() - 1);
 		}
-		heji.add(totalChongfu);
-		// 没有数据的区域数值为0
+		
 		for (List<String> list : resList) {
-			if (list.size() == 5) {
+			if (list.size() == 6) {
 				list.add("0");
 			}
 		}
@@ -1044,12 +1070,7 @@ public class ReportServiceImpl implements IReportService {
 		// 本周督办频繁停电台次
 		String begin = rangeArray[0];
 		String end = rangeArray[1];
-
-		List<List<String>> dubanList = new ArrayList<List<String>>();
-		for (PubApppar apppar : appparList) {
-			List<String> childList = new ArrayList<String>();
-			dubanList.add(childList);
-		}
+		
 		// 查询每天的停电三次以上且当日停电的台次
 		while (CommonUtil.compare(begin, end) != 1) {
 			param.put("yesterday", begin);
@@ -1067,25 +1088,36 @@ public class ReportServiceImpl implements IReportService {
 
 			for (Map<String, String> map : sanciData) {
 				String area = map.get("area");
+				String num = map.get("num");
 				if (areaList.contains(area)) {
+					
 					int index = areaList.indexOf(area);
 					List<String> child = resList.get(index + 1);
-					if (child.size() >= 7) {
-						child.set(6, CommonUtil.add(child.get(6), "1"));
+					
+					// 本周督办频繁停电台次
+					if (child.size() >= 8) {
+						child.set(7, CommonUtil.add(child.get(7), num));
 					} else {
-						child.add("1");
+						child.add(7, num);
 					}
-					List<String> dubanChildList = dubanList.get(index);
-					if (!dubanChildList.contains(map.get("addressNum"))) {
-						dubanChildList.add(map.get("addressNum"));
+					// 本周督办频繁停电台区数
+					if (child.size() >= 9) {
+						child.set(8, CommonUtil.add(child.get(8), "1"));
+					} else {
+						child.add(8, "1");
 					}
 				} else {
 					continue;
 				}
-
+				if (heji.size() >= 8) {
+					heji.set(7, CommonUtil.add(heji.get(7), num));
+				} else {
+					heji.add(num);
+				}
+				
 				// 合计
-				if (heji.size() >= 7) {
-					heji.set(6, CommonUtil.add(heji.get(6), "1"));
+				if (heji.size() >= 9) {
+					heji.set(8, CommonUtil.add(heji.get(8), "1"));
 				} else {
 					heji.add("1");
 				}
@@ -1093,20 +1125,19 @@ public class ReportServiceImpl implements IReportService {
 			// 天数 + 1
 			begin = DateUtil.dateAddDay(begin, 1);
 		}
+		
 		// 没有数据的区域数值为0
 		for (List<String> list : resList) {
-			if (list.size() == 6) {
+			if (list.size() == 7) {
 				list.add("0");
 			}
 		}
-
-		int totalDuban = 0;
-		for (int i = 1; i < resList.size() - 1; i ++) {
-			List<String> child = resList.get(i);
-			child.add(String .valueOf(dubanList.get(i - 1).size()));
-			totalDuban = totalDuban + dubanList.get(i - 1).size();
+		// 没有数据的区域数值为0
+		for (List<String> list : resList) {
+			if (list.size() == 8) {
+				list.add("0");
+			}
 		}
-		heji.add(String.valueOf(totalDuban));
 
 		// 督办总次数
 		String totalMonthChongfuTaici = heji.get(6);
@@ -1198,7 +1229,7 @@ public class ReportServiceImpl implements IReportService {
 		dataMap.put("shihuArea", shihuArea);
 		dataMap.put("shihuNum", shihuNum);
 		dataMap.put("pingjun", CommonUtil.divide(totalHour, totalCount, 2));
-		dataMap.put("twiceCount", totalChongfu);
+		dataMap.put("twiceCount", heji.get(6));
 		dataMap.put("mostAddressNumDesc", mostAddressNumDesc);
 		dataMap.put("mostAddressNum", mostAddressNum);
 		dataMap.put("dubanCount", totalMonthChongfuTaici);

+ 293 - 1
src/main/java/com/minpay/reportManage/action/TQTDReportAction.java

@@ -61,11 +61,16 @@ public class TQTDReportAction implements IMINAction {
     public final static String AREA_NUM_UPDATE = "areaNumUpdate";
     
     /**穿透导出详情*/
-    public final static String REPORT_INF_FUJIAN_CHUANTOU="reportInfFujianChuantou";
+    public final static String REPORT_INF_FUJIAN_CHUANTOU = "reportInfFujianChuantou";
     
     /**红黄蓝督办预警下载*/
     public final static String DOWN_RB_HHL = "downRbHhl";
 
+    /** 台区停电周报报穿透数据 */
+    public final static String REPORT_INF_ZB_CHUANTOU = "reportInfZbChuantou";
+    
+    /** 台区停电周报报穿透数据下载 */
+    public final static String REPORT_INF_ZB_CHUANTOU_DOWN = "reportInfZbChuantouDown";
     /**
      * 台区停电穿透数据
      * @param reportId		报表id
@@ -693,4 +698,291 @@ public class TQTDReportAction implements IMINAction {
     	
     	return res;
     }
+    
+    
+    @MINAction(value = REPORT_INF_ZB_CHUANTOU)
+    public MINActionResult reportInfZbChuantou(
+        @MINParam(key = "reportId") String reportId,
+        @MINParam(key = "chuantouType") String chuantouType,
+        MINSession session
+    ) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        MINActionResult res = new MINActionResult();
+        db = Service.lookup(IMINDataBaseService.class);
+		//分页
+		MINRowBounds rows = new MINRowBounds();
+		rows.setSeparateSql(true);
+		// 查询报表具体信息
+		DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, reportId);
+		// 报表时间范围
+		Map<String, Object> param = new HashMap<String, Object>();
+		String dayInterval = reportInf.getDayInterval();
+		String timeInterval = reportInf.getTimeInterval();
+		String[] dayIntervalArray = dayInterval.split("-");
+		String[] timeIntervalArray = timeInterval.split("-");
+		String beginTime = dayIntervalArray[0] + timeIntervalArray[0];
+		String endTime = dayIntervalArray[1] + timeIntervalArray[1];
+
+		param.put("beginTime", beginTime);
+		param.put("endTime", endTime);
+
+		// 停电台区数
+		if ("TQTD00".equals(chuantouType)) {
+			param.put("beginDay", beginTime);
+			param.put("endDay", endTime);
+			List<Map<String, String>> tqCountList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+			res.set(IMINBusinessConstant.F_PAGING_LAY, tqCountList);
+		// 本周累计停电台次
+		}else if ("TQTD01".equals(chuantouType)) {
+			DwFileDetail00Example example = new DwFileDetail00Example();
+			example.createCriteria().andStartTimeGreaterThanOrEqualTo(beginTime).andEndTimeLessThanOrEqualTo(endTime);
+			List<DwFileDetail00> selectByExample = db.selectByExample(DwFileDetail00Mapper.class, example);
+			selectByExample = Service.lookup(IFormatService.class).formatDate(selectByExample, "date");
+			selectByExample = Service.lookup(IFormatService.class).formatDateTime(selectByExample, "startTime", "endTime");
+			res.set(IMINBusinessConstant.F_PAGING_LAY, selectByExample);
+		// 本周重复停电台区数
+		} else if ("TQTD02".equals(chuantouType)) {
+			param.put("beginDay", beginTime);
+			param.put("endDay", endTime);
+			param.put("countNum", "2");
+			List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+			List<String> addressNumList = CommonUtil.getIdFromList(mountCountList, "addressNum");
+			if (addressNumList.size() == 0) {
+				return res;
+			}
+			param.put("addressNumList", addressNumList);
+			List<Map<String, String>> tqCountList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+			res.set(IMINBusinessConstant.F_PAGING_LAY, tqCountList);
+		// 本周督办频繁停电台次
+		} else if ("TQTD03".equals(chuantouType)) {
+			List<Map<String, String>> resList = new ArrayList<>();
+			String begin = dayIntervalArray[0];
+			String end = dayIntervalArray[1];
+			while (CommonUtil.compare(begin, end) != 1) {
+				param.put("yesterday", begin);
+				List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
+				if (yesterdayList.size() == 0) {
+					begin = DateUtil.dateAddDay(begin, 1);
+					continue;
+				}
+
+				param.put("yesterdayDetail", yesterdayList);
+				param.put("beginDay",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+				param.put("endDay", begin + endTime.substring(8, 14));
+				param.put("countNum", 3);
+				List<Map<String, String>> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+				List<String> addressNumList = CommonUtil.getIdFromList(sanciData, "addressNum");
+				if (addressNumList.size() != 0) {
+					param.put("beginTime",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+					param.put("endTime", begin + endTime.substring(8, 14));
+					param.put("addressNumList", addressNumList);
+					List<Map<String, String>> selectReportType00 = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00(param);
+					for (Map<String, String> map : selectReportType00) {
+						map.put("queryDate", begin);
+					}
+					resList.addAll(selectReportType00);
+				}
+				// 天数 + 1
+				begin = DateUtil.dateAddDay(begin, 1);
+			}
+			resList = Service.lookup(IFormatService.class).formatDate(resList, "date", "queryDate");
+			resList = Service.lookup(IFormatService.class).formatDateTime(resList, "startTime", "endTime");
+			res.set(IMINBusinessConstant.F_PAGING_LAY, resList);
+		// 本周督办频繁停电台区数
+		} else if ("TQTD04".equals(chuantouType)) {
+			List<Map<String, String>> resList = new ArrayList<>();
+			String begin = dayIntervalArray[0];
+			String end = dayIntervalArray[1];
+			while (CommonUtil.compare(begin, end) != 1) {
+				param.put("yesterday", begin);
+				List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
+				if (yesterdayList.size() == 0) {
+					begin = DateUtil.dateAddDay(begin, 1);
+					continue;
+				}
+
+				param.put("yesterdayDetail", yesterdayList);
+				param.put("beginDay",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+				param.put("endDay", begin + endTime.substring(8, 14));
+				param.put("countNum", 3);
+				List<Map<String, String>> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+
+				List<String> addressNumList = CommonUtil.getIdFromList(sanciData, "addressNum");
+				if (addressNumList.size() != 0) {
+					param.put("addressNumList", addressNumList);
+					List<Map<String, String>> tqCountList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+					for (Map<String, String> t : tqCountList) {
+						t.put("date", begin);
+					}
+					resList.addAll(tqCountList);
+				}
+				// 天数 + 1
+				begin = DateUtil.dateAddDay(begin, 1);
+			}
+			resList = Service.lookup(IFormatService.class).formatDate(resList, "date");
+			res.set(IMINBusinessConstant.F_PAGING_LAY, resList);
+		} 
+
+		return res;
+    }
+    
+    @MINAction(value = REPORT_INF_ZB_CHUANTOU_DOWN)
+    public MINActionResult reportInfZbChuantouDown(
+            @MINParam(key = "reportId") String reportId,
+            @MINParam(key = "chuantouType") String chuantouType,
+            HttpServletResponse response,
+            MINSession session
+         )throws MINBusinessException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ParseException{
+    	 MINActionResult res = new MINActionResult();
+         db = Service.lookup(IMINDataBaseService.class);
+ 		//分页
+ 		MINRowBounds rows = new MINRowBounds();
+ 		rows.setSeparateSql(true);
+ 		// 查询报表具体信息
+ 		DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, reportId);
+ 		// 报表时间范围
+ 		Map<String, Object> param = new HashMap<String, Object>();
+ 		String dayInterval = reportInf.getDayInterval();
+ 		String timeInterval = reportInf.getTimeInterval();
+ 		String[] dayIntervalArray = dayInterval.split("-");
+ 		String[] timeIntervalArray = timeInterval.split("-");
+ 		String beginTime = dayIntervalArray[0] + timeIntervalArray[0];
+ 		String endTime = dayIntervalArray[1] + timeIntervalArray[1];
+
+ 		param.put("beginTime", beginTime);
+ 		param.put("endTime", endTime);
+
+ 		List<Map<String, String>> excelList = new ArrayList<>();
+ 		// 停电台区数
+ 		if ("TQTD00".equals(chuantouType)) {
+ 			param.put("beginDay", beginTime);
+ 			param.put("endDay", endTime);
+ 			excelList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+ 		// 本周累计停电台次
+ 		}else if ("TQTD01".equals(chuantouType)) {
+ 			DwFileDetail00Example example = new DwFileDetail00Example();
+ 			example.createCriteria().andStartTimeGreaterThanOrEqualTo(beginTime).andEndTimeLessThanOrEqualTo(endTime);
+ 			List<DwFileDetail00> selectByExample = db.selectByExample(DwFileDetail00Mapper.class, example);
+ 			selectByExample = Service.lookup(IFormatService.class).formatDate(selectByExample, "date");
+ 			selectByExample = Service.lookup(IFormatService.class).formatDateTime(selectByExample, "startTime", "endTime");
+ 			for (DwFileDetail00 dwFileDetail00:selectByExample) {
+				Map<String, String> excelMap = new HashMap<String, String>();
+				excelMap.put("addressNum", dwFileDetail00.getAddressNum());
+				excelMap.put("addressName", dwFileDetail00.getAddressName());
+				excelMap.put("date", dwFileDetail00.getDate());
+				excelMap.put("area", dwFileDetail00.getArea());
+				excelMap.put("comonpanyName", dwFileDetail00.getComonpanyName());
+				excelMap.put("terminalName", dwFileDetail00.getTerminalName());
+				excelMap.put("terminalNum", dwFileDetail00.getTerminalNum());
+				excelMap.put("terminalAddress", dwFileDetail00.getTerminalAddress());
+				excelMap.put("startTime", dwFileDetail00.getStartTime());
+				excelMap.put("endTime", dwFileDetail00.getEndTime());
+				excelList.add(excelMap);
+			}
+ 		// 本周重复停电台区数
+ 		} else if ("TQTD02".equals(chuantouType)) {
+ 			param.put("beginDay", beginTime);
+ 			param.put("endDay", endTime);
+ 			param.put("countNum", "2");
+ 			List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+ 			List<String> addressNumList = CommonUtil.getIdFromList(mountCountList, "addressNum");
+ 			if (addressNumList.size() == 0) {
+ 				return res;
+ 			}
+ 			param.put("addressNumList", addressNumList);
+ 			excelList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+ 		// 本周督办频繁停电台次
+ 		} else if ("TQTD03".equals(chuantouType)) {
+ 			String begin = dayIntervalArray[0];
+ 			String end = dayIntervalArray[1];
+ 			while (CommonUtil.compare(begin, end) != 1) {
+ 				param.put("yesterday", begin);
+ 				List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
+ 				if (yesterdayList.size() == 0) {
+ 					begin = DateUtil.dateAddDay(begin, 1);
+ 					continue;
+ 				}
+
+ 				param.put("yesterdayDetail", yesterdayList);
+ 				param.put("beginDay",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+ 				param.put("endDay", begin + endTime.substring(8, 14));
+ 				param.put("countNum", 3);
+ 				List<Map<String, String>> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+ 				List<String> addressNumList = CommonUtil.getIdFromList(sanciData, "addressNum");
+ 				if (addressNumList.size() != 0) {
+ 					param.put("beginTime",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+ 					param.put("endTime", begin + endTime.substring(8, 14));
+ 					param.put("addressNumList", addressNumList);
+ 					List<Map<String, String>> selectReportType00 = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00(param);
+ 					for (Map<String, String> map : selectReportType00) {
+ 						map.put("queryDate", begin);
+ 					}
+ 					excelList.addAll(selectReportType00);
+ 				}
+ 				// 天数 + 1
+ 				begin = DateUtil.dateAddDay(begin, 1);
+ 			}
+ 			excelList = Service.lookup(IFormatService.class).formatDate(excelList, "date", "queryDate");
+ 			excelList = Service.lookup(IFormatService.class).formatDateTime(excelList, "startTime", "endTime");
+ 		// 本周督办频繁停电台区数
+ 		} else if ("TQTD04".equals(chuantouType)) {
+ 			String begin = dayIntervalArray[0];
+ 			String end = dayIntervalArray[1];
+ 			while (CommonUtil.compare(begin, end) != 1) {
+ 				param.put("yesterday", begin);
+ 				List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
+ 				if (yesterdayList.size() == 0) {
+ 					begin = DateUtil.dateAddDay(begin, 1);
+ 					continue;
+ 				}
+
+ 				param.put("yesterdayDetail", yesterdayList);
+ 				param.put("beginDay",	DateUtil.dateAddDay(DateUtil.dateAddMonth(begin, -2), 1)  + beginTime.substring(8, 14));
+ 				param.put("endDay", begin + endTime.substring(8, 14));
+ 				param.put("countNum", 3);
+ 				List<Map<String, String>> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
+
+ 				List<String> addressNumList = CommonUtil.getIdFromList(sanciData, "addressNum");
+ 				if (addressNumList.size() != 0) {
+ 					param.put("addressNumList", addressNumList);
+ 					List<Map<String, String>> tqCountList = db.getMybatisMapper(ReportServiceMapper.class).selectTqtdRbDetail(param);
+ 					for (Map<String, String> t : tqCountList) {
+ 						t.put("date", begin);
+ 					}
+ 					excelList.addAll(tqCountList);
+ 				}
+ 				// 天数 + 1
+ 				begin = DateUtil.dateAddDay(begin, 1);
+ 			}
+ 			excelList = Service.lookup(IFormatService.class).formatDate(excelList, "date");
+ 		} 
+ 		 OutputStream out=null;
+         try {
+         	out = response.getOutputStream();
+ 			HSSFWorkbook wb = null;
+ 			if ("TQTD00".equals(chuantouType)) {
+ 				String[] excelHeader = {"台区编号#addressNum","台区名称#addressName","单位#area","单位名称#comonpanyName","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电次数#num"};
+ 				wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
+ 			} else if ("TQTD01".equals(chuantouType)) {
+ 				String[] excelHeader = {"台区编号#addressNum","台区名称#addressName","数据日期#date","单位#area","单位名称#comonpanyName","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电时间#startTime","来电时间#endTime"};
+ 				wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
+ 			} else if ("TQTD02".equals(chuantouType)) {
+ 				String[] excelHeader = {"台区编号#addressNum","台区名称#addressName","单位#area","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电次数#num"};
+ 				wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
+ 			} else if ("TQTD03".equals(chuantouType)) {
+ 				String[] excelHeader = {"日报日期#queryDate","台区编号#addressNum","台区名称#addressName","数据日期#date","单位#area","单位名称#comonpanyName","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电时间#startTime","来电时间#endTime"};
+ 				wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
+ 			} else if ("TQTD04".equals(chuantouType)) {
+ 				String[] excelHeader = {"台区编号#addressNum","台区名称#addressName","单位#area","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电次数#num","日报日期#date"};
+ 				wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
+ 			}
+             if(wb != null){
+                 wb.write(out);
+             }
+             out.flush();
+             out.close();
+         } catch (Exception e) {
+             e.printStackTrace();
+         }
+ 		return res;
+    }
 }

+ 14 - 5
src/main/resources/com/minpay/db/table/own/mapper/ReportServiceMapper.xml

@@ -26,6 +26,13 @@
 			<if test="endTime != null  and endTime != ''">
 		    	and DFD0_END_TIME &lt;= #{endTime,jdbcType=VARCHAR}
 		   	</if>
+ 			<if test = "addressNumList != null">
+				and DFD0_ADDRESS_NUM in
+				<foreach item="item" index="index" collection="addressNumList" open="("
+						separator="," close=")">
+					#{item}
+				</foreach>
+			</if>
 		order by area
 	</select>
 	<select id="selectReportType00TqtdGS" resultType="hashmap" parameterType="java.util.Map">
@@ -608,11 +615,13 @@
 		where 
 			DFD0_END_TIME &gt;= #{beginDay,jdbcType=VARCHAR}
 			and DFD0_END_TIME &lt;= #{endDay,jdbcType=VARCHAR}
-			and DFD0_ADDRESS_NUM in
-			<foreach item="item" index="index" collection="addressNumList" open="("
-					separator="," close=")">
-				#{item}
-			</foreach>
+			<if test = "addressNumList != null">
+				and DFD0_ADDRESS_NUM in
+				<foreach item="item" index="index" collection="addressNumList" open="("
+						separator="," close=")">
+					#{item}
+				</foreach>
+			</if>
 		group by DFD0_ADDRESS_NUM
 		order by num desc
 	</select>

+ 46 - 1
src/main/webapp/admin/tqtd/reportManageDetailTqtd.html

@@ -65,7 +65,30 @@
 					tableHtml += '<tr>';
 					var childList = excelList[i];
 					for (var j = 0; j < childList.length; j ++) {
-						tableHtml += '<td>' + childList[j] + '</td>';
+						// 合计行
+						if (i == excelList.length - 1) {
+							// 停电台区数
+							if (j == 2) {
+								tableHtml += '<td style="cursor: pointer;background-color: #f8d61a;" title = "查看详情" onclick="tqtdZb0()">' + childList[j] + '</td>';
+							// 本周累计停电台次
+							} else if (j == 3) {
+								tableHtml += '<td style="cursor: pointer;background-color: #f8d61a;" title = "查看详情" onclick="tqtdZb1()">' + childList[j] + '</td>';
+							// 本周重复停电台区数
+							} else if (j == 6) {
+								tableHtml += '<td style="cursor: pointer;background-color: #f8d61a;" title = "查看详情" onclick="tqtdZb2()">' + childList[j] + '</td>';
+							// 本周督办频繁停电台次
+							} else if (j == 7) {
+								tableHtml += '<td style="cursor: pointer;background-color: #f8d61a;" title = "查看详情" onclick="tqtdZb3()">' + childList[j] + '</td>';
+							// 本周督办频繁停电台区数
+							} else if (j == 8) {
+								tableHtml += '<td style="cursor: pointer;background-color: #f8d61a;" title = "查看详情" onclick="tqtdZb4()">' + childList[j] + '</td>';
+							} else {
+								tableHtml += '<td>' + childList[j] + '</td>';
+							}
+						} else {
+							tableHtml += '<td>' + childList[j] + '</td>';
+						}
+						
 					}
 					tableHtml += '</tr>';
 				}
@@ -168,6 +191,28 @@
 	function goBack() {
 		deleteTabPageParent(pageId);
 	}
+	
+	/** 周报穿透 */
+	function tqtdZb0() {
+		var openPageId = pageId + "-zb00";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantouZB.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD00", '', pageId, null);
+	}
+	function tqtdZb1() {
+		var openPageId = pageId + "-zb01";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantouZB.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD01", '', pageId, null);
+	}
+	function tqtdZb2() {
+		var openPageId = pageId + "-zb02";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantouZB.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD02", '', pageId, null);
+	}
+	function tqtdZb3() {
+		var openPageId = pageId + "-zb03";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantouZB.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD03", '', pageId, null);
+	}
+	function tqtdZb4() {
+		var openPageId = pageId + "-zb04";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantouZB.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD04", '', pageId, null);
+	}
     </script>
 </body>