|
@@ -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;
|
|
|
+ }
|
|
|
}
|