|
@@ -53,7 +53,8 @@ public class TQTDReportAction implements IMINAction {
|
|
|
|
|
|
|
|
/** 台区数量编辑 */
|
|
/** 台区数量编辑 */
|
|
|
public final static String AREA_NUM_UPDATE = "areaNumUpdate";
|
|
public final static String AREA_NUM_UPDATE = "areaNumUpdate";
|
|
|
-
|
|
|
|
|
|
|
+ /**穿透导出详情*/
|
|
|
|
|
+ public final static String REPORT_INF_FUJIAN_CHUANTOU="reportInfFujianChuantou";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 台区停电穿透数据
|
|
* 台区停电穿透数据
|
|
@@ -222,6 +223,274 @@ public class TQTDReportAction implements IMINAction {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @MINAction(value = REPORT_INF_FUJIAN_CHUANTOU)
|
|
|
|
|
+ public HttpServletResponse reportInfFujianChuantou(
|
|
|
|
|
+ @MINParam(key = "reportId") String reportId,
|
|
|
|
|
+ @MINParam(key = "chuantouType") String chuantouType,
|
|
|
|
|
+ HttpServletResponse response,
|
|
|
|
|
+ MINSession session
|
|
|
|
|
+ )throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
|
|
|
|
+ //分页
|
|
|
|
|
+ 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<Map<String,String>>();
|
|
|
|
|
+
|
|
|
|
|
+ // 台区次数穿透数据
|
|
|
|
|
+ if ("TQTD01".equals(chuantouType)) {
|
|
|
|
|
+ List<Map<String, String>> fileList00 = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00(param);
|
|
|
|
|
+ fileList00 = Service.lookup(IFormatService.class).formatDate(fileList00, "date");
|
|
|
|
|
+ fileList00 = Service.lookup(IFormatService.class).formatDateTime(fileList00, "startTime", "endTime");
|
|
|
|
|
+
|
|
|
|
|
+ for (Map<String,String> map:fileList00) {
|
|
|
|
|
+ Map<String, String> excelMap = new HashMap<String, String>();
|
|
|
|
|
+ excelMap.put("addressNum", map.get("addressNum"));
|
|
|
|
|
+ excelMap.put("addressName", map.get("addressName"));
|
|
|
|
|
+ excelMap.put("date", map.get("date"));
|
|
|
|
|
+ excelMap.put("area", map.get("area"));
|
|
|
|
|
+ excelMap.put("comonpanyName", map.get("comonpanyName"));
|
|
|
|
|
+ excelMap.put("terminalName", map.get("terminalName"));
|
|
|
|
|
+ excelMap.put("terminalNum", map.get("terminalNum"));
|
|
|
|
|
+ excelMap.put("terminalAddress", map.get("terminalAddress"));
|
|
|
|
|
+ excelMap.put("startTime", map.get("startTime"));
|
|
|
|
|
+ excelMap.put("endTime", map.get("endTime"));
|
|
|
|
|
+ excelList.add(excelMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // month个月停电count次及以上台区穿透
|
|
|
|
|
+ } else if ("TQTD02".equals(chuantouType)) {
|
|
|
|
|
+ String monthNum = reportInf.getTqtdMonth();
|
|
|
|
|
+ String countNum = reportInf.getTqtdCount();
|
|
|
|
|
+ // monthNum个月内停电 countNum次以上的台区
|
|
|
|
|
+ String beginDay = DateUtil.dateAddMonth(dayIntervalArray[1], Integer.parseInt("-" + monthNum));
|
|
|
|
|
+ param.put("beginDay", beginDay);
|
|
|
|
|
+ param.put("endDay", dayIntervalArray[1]);
|
|
|
|
|
+ param.put("countNum", countNum);
|
|
|
|
|
+ List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
|
|
|
|
|
+ List<String> addressNumList = CommonUtil.getIdFromList(mountCountList, "addressNum");
|
|
|
|
|
+ if (addressNumList.size() == 0) {
|
|
|
|
|
+ // return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ DwFileDetail00Example example = new DwFileDetail00Example();
|
|
|
|
|
+ example.createCriteria().andAddressNumIn(addressNumList).andStartTimeGreaterThanOrEqualTo(beginDay).andEndTimeLessThanOrEqualTo(dayIntervalArray[1]);
|
|
|
|
|
+ example.setOrderByClause("DFD0_ADDRESS_NUM");
|
|
|
|
|
+ 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);
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // month个月停电count次及以上台区且当日停电穿透
|
|
|
|
|
+ } else if ("TQTD03".equals(chuantouType)) {
|
|
|
|
|
+ String monthNum = reportInf.getTqtdMonth();
|
|
|
|
|
+ String countNum = reportInf.getTqtdCount();
|
|
|
|
|
+ // monthNum个月内停电 countNum次以上的台区
|
|
|
|
|
+ String beginDay = DateUtil.dateAddMonth(dayIntervalArray[1], Integer.parseInt("-" + monthNum));
|
|
|
|
|
+ param.put("beginDay", beginDay + timeIntervalArray[0]);
|
|
|
|
|
+ param.put("endDay", dayIntervalArray[1] + timeIntervalArray[1]);
|
|
|
|
|
+ param.put("countNum", countNum);
|
|
|
|
|
+
|
|
|
|
|
+ // 查询当日停电的数据
|
|
|
|
|
+ param.put("yesterday", dayIntervalArray[1]);
|
|
|
|
|
+ List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
|
|
|
|
|
+ param.put("yesterdayDetail", yesterdayList);
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
|
|
|
|
|
+ if (mountCountList.size() == 0) {
|
|
|
|
|
+ //return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> addressNumList = CommonUtil.getIdFromList(mountCountList, "addressNum");
|
|
|
|
|
+ DwFileDetail00Example example = new DwFileDetail00Example();
|
|
|
|
|
+ example.createCriteria().andAddressNumIn(addressNumList)
|
|
|
|
|
+ //TODO 暂时改为只查当天的
|
|
|
|
|
+// .andStartTimeGreaterThanOrEqualTo(beginDay + timeIntervalArray[0])
|
|
|
|
|
+ .andStartTimeGreaterThanOrEqualTo(dayIntervalArray[1] + timeIntervalArray[0])
|
|
|
|
|
+ .andEndTimeLessThanOrEqualTo(dayIntervalArray[1] + timeIntervalArray[1])
|
|
|
|
|
+ ;
|
|
|
|
|
+ example.setOrderByClause("DFD0_ADDRESS_NUM");
|
|
|
|
|
+ List<DwFileDetail00> selectByExample = db.selectByExample(DwFileDetail00Mapper.class, example);
|
|
|
|
|
+ //res.set(IMINBusinessConstant.F_PAGING_LAY, selectByExample);
|
|
|
|
|
+ for (int j = 0; j < selectByExample.size(); j ++ ) {
|
|
|
|
|
+ DwFileDetail00 dwFileDetail00 = selectByExample.get(j);
|
|
|
|
|
+ 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", CommonUtil.timeFormat(dwFileDetail00.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelMap.put("endTime", CommonUtil.timeFormat(dwFileDetail00.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelList.add(excelMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 2个月停电2次台区且当日停电穿透
|
|
|
|
|
+ } else if ("TQTD04".equals(chuantouType)) {
|
|
|
|
|
+ String monthNum = "2";
|
|
|
|
|
+ String countNum = "2";
|
|
|
|
|
+ // monthNum个月内停电 countNum次以上的台区
|
|
|
|
|
+ String beginDay = DateUtil.dateAddMonth(dayIntervalArray[1], Integer.parseInt("-" + monthNum));
|
|
|
|
|
+ param.put("beginDay", beginDay + timeIntervalArray[0]);
|
|
|
|
|
+ param.put("endDay", dayIntervalArray[1] + timeIntervalArray[1]);
|
|
|
|
|
+ param.put("countNum", countNum);
|
|
|
|
|
+
|
|
|
|
|
+ // 查询当日停电的数据
|
|
|
|
|
+ param.put("yesterday", dayIntervalArray[1]);
|
|
|
|
|
+ List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ param.put("yesterdayDetail", yesterdayList);
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount01(param);
|
|
|
|
|
+ if (mountCountList.size() == 0) {
|
|
|
|
|
+ // return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> addressNumList = CommonUtil.getIdFromList(yesterdayList, "addressNum");
|
|
|
|
|
+ DwFileDetail00Example example = new DwFileDetail00Example();
|
|
|
|
|
+ example.createCriteria().andAddressNumIn(addressNumList).andStartTimeGreaterThanOrEqualTo(beginDay + timeIntervalArray[0]).andEndTimeLessThanOrEqualTo(dayIntervalArray[1] + timeIntervalArray[1]);
|
|
|
|
|
+ example.setOrderByClause("DFD0_ADDRESS_NUM");
|
|
|
|
|
+ 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);
|
|
|
|
|
+ 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", CommonUtil.timeFormat(dwFileDetail00.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelMap.put("endTime", CommonUtil.timeFormat(dwFileDetail00.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelList.add(excelMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 台区停电时户数
|
|
|
|
|
+ } else if ("TQTD05".equals(chuantouType)) {
|
|
|
|
|
+ List<Map<String, String>> fileList00 = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00(param);
|
|
|
|
|
+ fileList00 = Service.lookup(IFormatService.class).formatDate(fileList00, "date");
|
|
|
|
|
+ fileList00 = Service.lookup(IFormatService.class).formatDateTime(fileList00, "startTime", "endTime");
|
|
|
|
|
+ // res.set(IMINBusinessConstant.F_PAGING_LAY, fileList00);
|
|
|
|
|
+ for (Map<String,String> map:fileList00) {
|
|
|
|
|
+ Map<String, String> excelMap = new HashMap<String, String>();
|
|
|
|
|
+ excelMap.put("addressNum", map.get("addressNum"));
|
|
|
|
|
+ excelMap.put("addressName", map.get("addressName"));
|
|
|
|
|
+ excelMap.put("date", map.get("date"));
|
|
|
|
|
+ excelMap.put("area", map.get("area"));
|
|
|
|
|
+ excelMap.put("comonpanyName", map.get("comonpanyName"));
|
|
|
|
|
+ excelMap.put("terminalName", map.get("terminalName"));
|
|
|
|
|
+ excelMap.put("terminalNum", map.get("terminalNum"));
|
|
|
|
|
+ excelMap.put("terminalAddress", map.get("terminalAddress"));
|
|
|
|
|
+ excelMap.put("startTime", map.get("startTime"));
|
|
|
|
|
+ excelMap.put("endTime", map.get("endTime"));
|
|
|
|
|
+ excelList.add(excelMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 2个月停电1次台区且当日停电穿透
|
|
|
|
|
+ }else if ("TQTD06".equals(chuantouType)) {
|
|
|
|
|
+ String monthNum = "2";
|
|
|
|
|
+ String countNum = "1";
|
|
|
|
|
+ // monthNum个月内停电 countNum次以上的台区
|
|
|
|
|
+ String beginDay = DateUtil.dateAddMonth(dayIntervalArray[1], Integer.parseInt("-" + monthNum));
|
|
|
|
|
+ param.put("beginDay", beginDay + timeIntervalArray[0]);
|
|
|
|
|
+ param.put("endDay", dayIntervalArray[1] + timeIntervalArray[1]);
|
|
|
|
|
+ param.put("countNum", countNum);
|
|
|
|
|
+
|
|
|
|
|
+ // 查询当日停电的数据
|
|
|
|
|
+ param.put("yesterday", dayIntervalArray[1]);
|
|
|
|
|
+ List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
|
|
|
|
|
+ if (yesterdayList.size() == 0) {
|
|
|
|
|
+ // return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ param.put("yesterdayDetail", yesterdayList);
|
|
|
|
|
+
|
|
|
|
|
+// List<Map<String, String>> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount01(param);
|
|
|
|
|
+
|
|
|
|
|
+ List<String> addressNumList = CommonUtil.getIdFromList(yesterdayList, "addressNum");
|
|
|
|
|
+ DwFileDetail00Example example = new DwFileDetail00Example();
|
|
|
|
|
+ example.createCriteria().andAddressNumIn(addressNumList).andStartTimeGreaterThanOrEqualTo(beginDay + timeIntervalArray[0]).andEndTimeLessThanOrEqualTo(dayIntervalArray[1] + timeIntervalArray[1]);
|
|
|
|
|
+ example.setOrderByClause("DFD0_ADDRESS_NUM");
|
|
|
|
|
+ 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);
|
|
|
|
|
+
|
|
|
|
|
+ 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", CommonUtil.timeFormat(dwFileDetail00.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelMap.put("endTime", CommonUtil.timeFormat(dwFileDetail00.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ excelList.add(excelMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ OutputStream out=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ String[] excelHeader = {"台区名称#addressName","数据日期#date","台区编号#addressNum","单位#area","单位名称#comonpanyName","终端名称#terminalName","终端编号#terminalNum","终端地址码#terminalAddress","停电时间#startTime","来电时间#endTime"};
|
|
|
|
|
+ out = response.getOutputStream();
|
|
|
|
|
+ HSSFWorkbook wb = ExportExcelUtil.export(response, reportInf.getFileName(), excelHeader, excelList);
|
|
|
|
|
+ if(wb != null){
|
|
|
|
|
+ wb.write(out);
|
|
|
|
|
+ }
|
|
|
|
|
+ out.flush();
|
|
|
|
|
+ out.close();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return response;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 台区停电附件导出
|
|
* 台区停电附件导出
|
|
|
* @param reportId
|
|
* @param reportId
|