package com.minpay.common.service.impl; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import com.minpay.common.util.*; import com.minpay.db.table.own.mapper.IReportBatchMapper; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import org.apache.commons.fileupload.FileItem; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import com.minpay.common.constant.Constant; import com.minpay.common.service.IReportService; import com.minpay.db.table.mapper.DwDdyFxbDetailMapper; import com.minpay.db.table.mapper.DwDdyFxbMapper; import com.minpay.db.table.mapper.DwFileDetail00Mapper; import com.minpay.db.table.mapper.DwFileDetail01Mapper; import com.minpay.db.table.mapper.DwFileDetail03Mapper; import com.minpay.db.table.mapper.DwFileDetail04Mapper; import com.minpay.db.table.mapper.DwFileDetail07Mapper; import com.minpay.db.table.mapper.DwReportDataMapper; import com.minpay.db.table.mapper.DwReportInfMapper; import com.minpay.db.table.mapper.PubAppparMapper; import com.minpay.db.table.mapper.PubSysparMapper; import com.minpay.db.table.model.DwDdyFxb; import com.minpay.db.table.model.DwDdyFxbDetail; import com.minpay.db.table.model.DwDdyFxbDetailExample; import com.minpay.db.table.model.DwDdyFxbExample; import com.minpay.db.table.model.DwFileDetail00; import com.minpay.db.table.model.DwFileDetail00Example; import com.minpay.db.table.model.DwFileDetail01; import com.minpay.db.table.model.DwFileDetail01Example; import com.minpay.db.table.model.DwFileDetail03; import com.minpay.db.table.model.DwFileDetail03Example; import com.minpay.db.table.model.DwFileDetail04; import com.minpay.db.table.model.DwFileDetail04Example; import com.minpay.db.table.model.DwFileDetail07; import com.minpay.db.table.model.DwFileDetail07Example; import com.minpay.db.table.model.DwReportData; import com.minpay.db.table.model.DwReportInf; import com.minpay.db.table.model.PubApppar; import com.minpay.db.table.model.PubAppparExample; import com.minpay.db.table.model.PubSyspar; import com.minpay.db.table.own.mapper.ReportServiceMapper; import com.startup.minpay.frame.business.MINHttpServletRequestContext; import com.startup.minpay.frame.exception.MINBusinessException; import com.startup.minpay.frame.jdbc.MINRowBounds; import com.startup.minpay.frame.service.base.IMINDataBaseService; import com.startup.minpay.frame.service.base.Service; import com.startup.minpay.frame.target.MINComponent; import net.sf.json.JSONArray; @MINComponent public class ReportServiceImpl implements IReportService { private static final int DEF_DIV_SCALE =10; static Map totalMap = new HashMap(); static String systemCode = null; //各区客户数 static Map customerMap = new HashMap(); // 各区域管辖台区数 static Map guanxiaTaiqu = new HashMap(); // 台区停电停电时长 static List> fenduanList = new ArrayList>(); static { //客户数 customerMap.put("新泰", "593100"); customerMap.put("岱岳", "323455"); customerMap.put("宁阳", "301682"); customerMap.put("泰山", "376298"); customerMap.put("东平", "298683"); customerMap.put("肥城", "375994"); customerMap.put("泰山景区", "120623"); customerMap.put("高新", "162627"); customerMap.put("直供区", "593000"); customerMap.put("陵城区", "278900"); customerMap.put("宁津", "232000"); customerMap.put("庆云", "130500"); customerMap.put("临邑", "220200"); customerMap.put("齐河", "221200"); customerMap.put("平原", "235000"); customerMap.put("夏津", "237200"); customerMap.put("武城", "191200"); customerMap.put("乐陵", "228400"); customerMap.put("禹城", "268100"); // 管辖台区数 guanxiaTaiqu.put("高新", "2308"); guanxiaTaiqu.put("岱岳", "3043"); guanxiaTaiqu.put("新泰", "4286"); guanxiaTaiqu.put("东平", "4000"); guanxiaTaiqu.put("宁阳", "3913"); guanxiaTaiqu.put("肥城", "1000"); guanxiaTaiqu.put("泰山景区", "2000"); guanxiaTaiqu.put("泰山", "1950"); guanxiaTaiqu.put("直供区", "3640"); guanxiaTaiqu.put("陵城区", "2672"); guanxiaTaiqu.put("宁津", "2293"); guanxiaTaiqu.put("庆云", "1538"); guanxiaTaiqu.put("临邑", "2858"); guanxiaTaiqu.put("齐河", "2972"); guanxiaTaiqu.put("平原", "2759"); guanxiaTaiqu.put("夏津", "2736"); guanxiaTaiqu.put("武城", "2311"); guanxiaTaiqu.put("乐陵", "2620"); guanxiaTaiqu.put("禹城", "2755"); // 0-1小时 Map map0To60 = new HashMap(); map0To60.put("start", "0"); map0To60.put("end", "3600"); map0To60.put("desc", "0-1小时"); fenduanList.add(map0To60); // 1-6小时 Map map60To360 = new HashMap(); map60To360.put("start", "3600"); map60To360.put("end", "21600"); map60To360.put("desc", "1-6小时"); fenduanList.add(map60To360); // 6-12小时 Map map360To720 = new HashMap(); map360To720.put("start", "21600"); map360To720.put("end", "43200"); map360To720.put("desc", "6-12小时"); fenduanList.add(map360To720); // 12-24小时 Map map720To1440 = new HashMap(); map720To1440.put("start", "43200"); map720To1440.put("end", "86400"); map720To1440.put("desc", "12-24小时"); fenduanList.add(map720To1440); // 24小时以上 Map mapGT1440 = new HashMap(); mapGT1440.put("start", "86400"); mapGT1440.put("desc", "24小时以上"); fenduanList.add(mapGT1440); } @Override public void init() throws MINBusinessException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); //查询系统市级编号 PubSyspar systemCodeSys = db.selectByPrimaryKey(PubSysparMapper.class, "SYSTEM_CODE"); systemCode = systemCodeSys.getValue(); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); String hejiNum = "0"; try { List appparList = db.selectByExample(PubAppparMapper.class, appparExample); for (PubApppar pub : appparList) { totalMap.put(pub.getValue(), pub.getShowmsg()); hejiNum = CommonUtil.add(hejiNum, pub.getShowmsg()); } } catch (MINBusinessException e) { e.printStackTrace(); } totalMap.put("合计", hejiNum); } public void reflush() { try { init(); } catch (MINBusinessException e) { e.printStackTrace(); } } @Override public Map reportNeedDetail(Map param) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InvalidFormatException, IOException { String range = (String)param.get("range"); String timeRange = (String)param.get("timeRange"); String reportTypeId = (String)param.get("reportTypeId"); String firstFileId = (String)param.get("firstFileId"); String secondFileId = (String)param.get("secondFileId"); String FADateRange = (String)param.get("FADateRange"); String yearChoose = (String)param.get("yearChoose"); String DdyDateRange = (String)param.get("DdyDateRange"); String ddyFxbId = (String)param.get("ddyFxbId"); MINHttpServletRequestContext request = (MINHttpServletRequestContext)param.get("request"); Map resMap = new HashMap(); // 台区停电日报 if (Constant.REPORT_TYPE_00.equals(reportTypeId)) { String monthNum = (String)param.get("monthNum"); String countNum = (String)param.get("countNum"); return reportTypeTQTDRB(range, timeRange, monthNum, countNum); // 台区停电周报 } else if (Constant.REPORT_TYPE_01.equals(reportTypeId)) { return reportTypeTQTDZB(range, timeRange); // 台区停电月报 } else if (Constant.REPORT_TYPE_02.equals(reportTypeId)) { return reportTypeTQTDYB(range, timeRange); // 终端投托运报表 } else if (Constant.REPORT_TYPE_03.equals(reportTypeId)) { List> resList = reportTypeZDDTYBB(firstFileId, secondFileId); resMap.put("resList", resList); // FA动作正确率 } else if (Constant.REPORT_TYPE_04.equals(reportTypeId)) { List> resList = reportTypeFADZBB(FADateRange, yearChoose); resMap.put("resList", resList); // 低电压分析表 } else if (Constant.REPORT_TYPE_05.equals(reportTypeId)){ return reportTypeDDYZLFXB(range, reportTypeId, 1, 100); // 低电压日报 } else if (Constant.REPORT_TYPE_06.equals(reportTypeId)){ List> resList = reportTypeDDYRB(DdyDateRange,yearChoose,range, reportTypeId); resMap.put("resList", resList); // 过电压分析表 } else if (Constant.REPORT_TYPE_07.equals(reportTypeId)){ List> resList = reportTypeGDYZLFXB(range, reportTypeId); resMap.put("resList", resList); // 95598工单月报 } else if (Constant.REPORT_TYPE_08.equals(reportTypeId)){ return reportType95598YB(range); // 低电压未治理完成 } else if (Constant.REPORT_TYPE_09.equals(reportTypeId)) { List> resList = reportTypeDDYWZL(ddyFxbId); resMap.put("resList", resList); // 低电压昨日新增 } else if (Constant.REPORT_TYPE_10.equals(reportTypeId)) { List> resList = reportTypeDDYZRXZ(ddyFxbId); resMap.put("resList", resList); // 低电压周报 } else if (Constant.REPORT_TYPE_11.equals(reportTypeId)) { return reportTypeDDYZB(ddyFxbId, range); // 低电压超30天 } else if (Constant.REPORT_TYPE_12.equals(reportTypeId)) { List> resList = reportTypeDDY30T(ddyFxbId); resMap.put("resList", resList); // 低电压月报 } else if (Constant.REPORT_TYPE_13.equals(reportTypeId)) { return reportTypeDDYYB(ddyFxbId); // 计停非计停周报 } else if (Constant.REPORT_TYPE_14.equals(reportTypeId)) { return reportTypeJTFJTRB(range,timeRange); // 终端投退运报表II } else if (Constant.REPORT_TYPE_15.equals(reportTypeId)) { List> resList = reportTypeZDDTYBBII(firstFileId, request); resMap.put("resList", resList); } else if(Constant.REPORT_TYPE_17.equals(reportTypeId)){//过重载日报 Map mm = new HashMap(); mm.put("range",range); mm.put("timeRange",timeRange); mm.put("reportTypeId",reportTypeId); Map resList = reportTypeXlgzzRb(mm, request); resMap.put("resList", resList); } else if(Constant.REPORT_TYPE_18.equals(reportTypeId)){//过重载周报 Map mm = new HashMap(); mm.put("range",range); mm.put("timeRange",timeRange); mm.put("reportTypeId",reportTypeId); Map resList = reportTypeXlgzzRb(mm, request); resMap.put("resList", resList); } return resMap; } /** *获取日报数据数据解析规则-重过载时长累加,平均负债率(?) * @param map * @param request * @return */ private Map reportTypeXlgzzRb(Map map, MINHttpServletRequestContext request) throws MINBusinessException { String range = StringUtil.ObjectToString(map.get("range"));//日期范围 String timeRange = StringUtil.ObjectToString(map.get("timeRange"));//时间范围 String[] s1 = range.split("-"); String[] s2 = timeRange.split("-"); String startDay = s1[0].trim(); String endDay = s1[1].trim(); String startTime = s2[0].trim(); String endTime = s2[1].trim(); String start =startDay.substring(0,4) + "-" + startDay.substring(4,6)+"-"+startDay.substring(6,8)+" " +startTime.substring(0,2) + ":" + startTime.substring(2,4)+":"+startTime.substring(4,6); String end =endDay.substring(0,4) + "-" + endDay.substring(4,6)+"-"+endDay.substring(6,8)+" " +endTime.substring(0,2) + ":" + endTime.substring(2,4)+":"+endTime.substring(4,6); Map rstMap = new HashMap(); if("".equals(range) || "".equals(timeRange)){ return new HashMap(); } else{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); map.put("start",start); map.put("end",end); map.put("type","1"); List> DDYZLFXBList = db.getMybatisMapper(IReportBatchMapper.class).selectXlgzzData(map); //线路重载 Float maxZzsc = 0f;// String maxXlName = "";//最长时长线路 Map ttMap = new HashMap(); JSONArray ja = new JSONArray(); if(DDYZLFXBList != null && !DDYZLFXBList.isEmpty()){ int size = DDYZLFXBList.size(); rstMap.put("total",size); JSONObject jo = new JSONObject(); for (int i = 0; i < size; i++) { Map temp2 = DDYZLFXBList.get(i); String key = temp2.get("KEYSS"); if(ttMap.containsKey(key)){ continue; }else{ jo = JSONObject.fromObject(temp2); ttMap.put(key,"1"); float f = StringUtil.ObjToFloat(jo.get("DFD10_GZSC")); if(maxZzsc < f){ maxZzsc = f; maxXlName = key; } jo.remove("DFD10_GZSC"); jo.remove("DFD10_FZL"); Map str = AuxiliaryTools.getXlgzzTjByParam(DDYZLFXBList,key); jo.put("sum",str.get("sc")); jo.put("avg",ArithUtils.div(str.get("pjfzl"),str.get("xlts"))); ja.add(jo); } } } map.put("type",null); //线路过载 List> DDYZLFXBList2 = db.getMybatisMapper(IReportBatchMapper.class).selectXlgzzData(map); Float maxZzsc2 = 0f;// String maxXlName2 = "";//最长时长线路 Map ttMap2 = new HashMap(); JSONArray ja2 = new JSONArray(); if(DDYZLFXBList2 != null && !DDYZLFXBList2.isEmpty()){ int size = DDYZLFXBList2.size(); rstMap.put("total2",size); JSONObject jo2 = new JSONObject(); for (int i = 0; i < size; i++) { Map temp2 = DDYZLFXBList.get(i); String key = temp2.get("KEYSS"); if(ttMap2.containsKey(key)){ continue; }else{ jo2 = JSONObject.fromObject(temp2); ttMap2.put(key,"1"); float f = StringUtil.ObjToFloat(jo2.get("DFD10_GZSC")); if(maxZzsc2 < f){ maxZzsc2 = f; maxXlName2 = key; } jo2.remove("DFD10_GZSC"); jo2.remove("DFD10_FZL"); Map str = AuxiliaryTools.getXlgzzTjByParam(DDYZLFXBList,key); jo2.put("sum",str.get("sc")); jo2.put("avg",ArithUtils.div(str.get("pjfzl"),str.get("xlts"))); ja2.add(jo2); } } } //配变 List> pbgzzList = db.getMybatisMapper(IReportBatchMapper.class).selectPbgzzData(map); Map pbTemp = new HashMap(); Map pbTemp2 = new HashMap(); JSONArray ja3 = new JSONArray(); JSONArray ja4 = new JSONArray(); JSONObject jo3 = new JSONObject(); JSONObject jo4 = new JSONObject(); if(pbgzzList != null && !pbgzzList.isEmpty()){ int size = pbgzzList.size(); for (int i = 0; i < pbgzzList.size(); i++) { Map temp = pbgzzList.get(i); Object fzl = temp.get("DFD9_FZL"); String key = temp.get("KEYSS"); if(StringUtil.ObjToFloat(fzl) > 100){//过载 if(pbTemp.containsKey(key)){ continue; }else{ jo3 = JSONObject.fromObject(temp); pbTemp.put(key,"1"); Map str = AuxiliaryTools.getXlPbgzzTjByParam(pbgzzList,key,"1"); jo3.put("sum",str.get("sc")); jo3.put("avg",ArithUtils.div(str.get("pjfzl"),str.get("xlts"))); ja3.add(jo3); } }else if(StringUtil.ObjToFloat(fzl) <= 100 && StringUtil.ObjToFloat(fzl) >= 80){//重载 if(pbTemp2.containsKey(key)){ continue; }else{ jo4 = JSONObject.fromObject(temp); pbTemp2.put(key,"1"); Map str = AuxiliaryTools.getXlPbgzzTjByParam(pbgzzList,key,"2"); jo4.put("sum",str.get("sc")); jo4.put("avg",ArithUtils.div(str.get("pjfzl"),str.get("xlts"))); ja4.add(jo4); } } } } //抢修类工单报表 List> qxlgdbbbList = db.getMybatisMapper(IReportBatchMapper.class).selectQxlgdbbData(map); JSONArray jagd = new JSONArray(); if (qxlgdbbbList != null && !qxlgdbbbList.isEmpty()){ Map gdTemp = new HashMap(); Map temp = null; String unit = ""; for (int i = 0; i < qxlgdbbbList.size(); i++) { temp = qxlgdbbbList.get(i); unit = temp.get("DFD11_GDDW");//单位 if (unit ==null || "".equals(unit) || gdTemp.containsKey(unit)){ continue; } else { gdTemp.put(unit,"1"); JSONObject tempjo = JSONObject.fromObject(temp); AuxiliaryTools.getQxgdByParam(qxlgdbbbList,unit,tempjo); jagd.add(tempjo); } } } JSONObject temp1 ,temp2 = new JSONObject(); temp2.put("DFD11_GDDW","公司累计"); temp2.put("KHZS",""); temp2.put("DDXCSJ",""); temp2.put("GDCLSJ",""); temp2.put("DDXCCSS",""); temp2.put("GDCSZS",""); temp2.put("YSXJHD",""); temp2.put("GDZS",""); temp2.put("WH",""); temp2.put("GZLS-A",""); temp2.put("GZLS-B",""); temp2.put("GZLS-C",""); temp2.put("GZLS-D",""); for (int i = 0; i < jagd.size(); i++) { temp1 = jagd.getJSONObject(i); temp2.put("KHZS",ArithUtils.addToInt(temp2.getString("KHZS"),temp1.getString("KHZS"))); temp2.put("DDXCSJ",ArithUtils.add(temp2.getString("DDXCSJ"),temp1.getString("DDXCSJ"))); temp2.put("GDCLSJ",ArithUtils.add(temp2.getString("GDCLSJ"),temp1.getString("GDCLSJ"))); temp2.put("DDXCCSS",ArithUtils.addToInt(temp2.getString("DDXCCSS"),temp1.getString("DDXCCSS"))); temp2.put("GDCSZS",ArithUtils.add(temp2.getString("GDCSZS"),temp1.getString("GDCSZS"))); temp2.put("GDZS",ArithUtils.addToInt(temp2.getString("GDZS"),temp1.getString("GDZS"))); temp2.put("YSXJHD",ArithUtils.add(temp2.getString("YSXJHD"),temp1.getString("YSXJHD"))); temp2.put("GZLS-A",ArithUtils.add(temp2.getString("GZLS-A"),temp1.getString("GZLS-A"))); temp2.put("GZLS-B",ArithUtils.add(temp2.getString("GZLS-B"),temp1.getString("GZLS-B"))); temp2.put("GZLS-C",ArithUtils.add(temp2.getString("GZLS-C"),temp1.getString("GZLS-C"))); temp2.put("GZLS-D",ArithUtils.add(temp2.getString("GZLS-D"),temp1.getString("GZLS-D"))); } jagd.add(temp2); for (int i = 0; i < jagd.size(); i++) { temp1 = jagd.getJSONObject(i); temp1.put("GDCLSJ",ArithUtils.div(temp1.getString("GDCLSJ"),temp1.getString("GDZS")));//工单处理时长平均 temp1.put("DDXCSJ",ArithUtils.div(temp1.getString("DDXCSJ"),temp1.getString("GDZS")));//到达现场平均 temp1.put("WH",ArithUtils.div(temp1.getString("GDZS"),temp1.getString("KHZS"))*1000); } rstMap.put("result",ja);//线路重载 rstMap.put("result2",ja2);//线路过载 rstMap.put("result3",ja3);//配变过载 rstMap.put("result4",ja4);//配变重载 rstMap.put("result5",jagd);//抢修工单 Map param = new HashMap(); param.put("maxZzsc",maxZzsc); param.put("maxXlName",maxXlName); param.put("maxZzsc2",maxZzsc2); param.put("maxXlName2",maxXlName2); //获取配变过载数据最大值 AuxiliaryTools.getMaxPbByParam(pbgzzList,param); //获取配变重载数据最大值 rstMap.put("descStr",AuxiliaryTools.getXlgzzDesc(ja,ja2,param)); rstMap.put("descStr2",AuxiliaryTools.getXlPbgzzDesc(ja3,ja4,param)); rstMap.put("descStr3",AuxiliaryTools.getQxgdDesc(jagd,param)); } return rstMap; } /** * 台区停电日报 * @param range 日期范围 * @param timeRange 时间段范围 * @param monthNum 几个月内停电 * @param countNum 停电次数 * @return * @throws MINBusinessException * @throws ParseException */ public Map reportTypeTQTDRB(String range, String timeRange, String monthNum, String countNum) throws MINBusinessException, ParseException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); Map resMap = new HashMap(); List> resList = new ArrayList>(); resMap.put("excelList", resList); Map param = new HashMap(); String beginTime = null; String endTime = null; range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); timeRange = timeRange.replaceAll(" ", ""); if (CommonUtil.isEmpty(timeRange)) { beginTime = rangeArray[0] + "000000"; endTime = rangeArray[1] + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = rangeArray[0] + timeRangeArray[0]; endTime = rangeArray[1] + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); List> fileList00 = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00(param); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); appparExample.setOrderByClause("APR_TYPE"); List appparList = db.selectByExample(PubAppparMapper.class, appparExample); Map countMap = new HashMap(); Map shihuMap = new HashMap(); for (PubApppar apppar : appparList) { countMap.put(apppar.getValue(), "0"); shihuMap.put(apppar.getValue(), "0"); } countMap.put("合计", "0"); shihuMap.put("合计", "0"); for (Map map : fileList00) { String minute = map.get("time"); String area = map.get("area"); if (countMap.containsKey(area)) { countMap.put(area,CommonUtil.add(countMap.get(area), "1")); shihuMap.put(area,CommonUtil.add(shihuMap.get(area), minute)); } else { continue; } countMap.put("合计",CommonUtil.add(countMap.get("合计"), "1")); shihuMap.put("合计",CommonUtil.add(shihuMap.get("合计"), minute)); } List childList0 = new ArrayList(); childList0.add("分类\\单位"); for (PubApppar apppar : appparList) { childList0.add(apppar.getValue()); } childList0.add("合计"); resList.add(childList0); List childList1 = new ArrayList(); childList1.add("管辖台区数量"); for (PubApppar apppar : appparList) { childList1.add(totalMap.get(apppar.getValue())); } childList1.add(totalMap.get("合计")); resList.add(childList1); List childList2 = new ArrayList(); childList2.add("台区停电次数"); for (PubApppar apppar : appparList) { childList2.add(countMap.get(apppar.getValue())); } childList2.add(countMap.get("合计")); resList.add(childList2); List childList9 = new ArrayList(); childList9.add("台区停电时户数"); for (PubApppar apppar : appparList) { childList9.add(CommonUtil.divide(shihuMap.get(apppar.getValue()), "60", 2)); } childList9.add(CommonUtil.divide(shihuMap.get("合计"), "60", 2)); resList.add(childList9); List childList3 = new ArrayList(); childList3.add("台区停运率"); for (PubApppar apppar : appparList) { childList3.add(CommonUtil.multiply(CommonUtil.divide(countMap.get(apppar.getValue()), totalMap.get(apppar.getValue()), 4), "100", 2) + "%"); } childList3.add(CommonUtil.multiply(CommonUtil.divide(countMap.get("合计"), totalMap.get("合计"), 4), "100", 2) + "%"); resList.add(childList3); // 台区停电个数统计 Map tqtdGsMap = new HashMap(); for (PubApppar apppar : appparList) { tqtdGsMap.put(apppar.getValue(), "0"); } tqtdGsMap.put("合计", "0"); List> tqtdGsList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00TqtdGS(param); for (Map map : tqtdGsList) { String area = map.get("area"); if (tqtdGsMap.containsKey(area)) { tqtdGsMap.put(area, CommonUtil.add(tqtdGsMap.get(area), map.get("num"))); } else { continue; } tqtdGsMap.put("合计",CommonUtil.add(tqtdGsMap.get("合计"), map.get("num"))); } List childList4 = new ArrayList(); childList4.add("台区停电个数"); for (PubApppar apppar : appparList) { childList4.add(tqtdGsMap.get(apppar.getValue())); } childList4.add(tqtdGsMap.get("合计")); resList.add(childList4); // monthNum个月内停电 countNum次以上的台区 String beginDay = DateUtil.dateAddDay(DateUtil.dateAddMonth(rangeArray[1], Integer.parseInt("-" + monthNum)), 1); param.put("beginDay", beginDay + beginTime.substring(8, 14)); param.put("endDay", rangeArray[1] + endTime.substring(8, 14)); param.put("countNum", countNum); List> mountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); Map taiQuMap = new HashMap(); for (PubApppar apppar : appparList) { taiQuMap.put(apppar.getValue(), 0); } taiQuMap.put("合计", 0); for (Map map : mountCountList) { String area = map.get("area"); if (taiQuMap.containsKey(area)) { taiQuMap.put(area,taiQuMap.get(area) + 1); } else { continue; } taiQuMap.put("合计",taiQuMap.get("合计") + 1); } List childList6 = new ArrayList(); childList6.add(monthNum+"个月停电" + countNum + "次及以上台区"); for (PubApppar apppar : appparList) { childList6.add(taiQuMap.get(apppar.getValue()).toString()); } childList6.add(taiQuMap.get("合计").toString()); resList.add(childList6); // 查询昨日停电的数据 改为当日停电 param.put("yesterday", rangeArray[1]); List> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param); List> yesterdayAndTDData = null; if (yesterdayList.size() != 0) { param.put("yesterdayDetail", yesterdayList); yesterdayAndTDData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); } else { yesterdayAndTDData = new ArrayList>(); } Map yesterdayTaiQuMap = new HashMap(); for (PubApppar apppar : appparList) { yesterdayTaiQuMap.put(apppar.getValue(), 0); } yesterdayTaiQuMap.put("合计", 0); for (Map map : yesterdayAndTDData) { String area = map.get("area"); if (yesterdayTaiQuMap.containsKey(area)) { yesterdayTaiQuMap.put(area,yesterdayTaiQuMap.get(area) + 1); } else { continue; } yesterdayTaiQuMap.put("合计",yesterdayTaiQuMap.get("合计") + 1); } List childList7 = new ArrayList(); childList7.add(monthNum+"个月停电" + countNum + "次及以上台区且当日停电"); for (PubApppar apppar : appparList) { childList7.add(yesterdayTaiQuMap.get(apppar.getValue()).toString()); } childList7.add(yesterdayTaiQuMap.get("合计").toString()); resList.add(childList7); // 2个月停电2次台区且昨日停电的台区数据 改为且当日停电 beginDay = DateUtil.dateAddMonth(rangeArray[1], -2); param.put("beginDay", beginDay + beginTime.substring(8, 14)); param.put("countNum", 2); List> yiciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); Map yiciMap = new HashMap(); for (PubApppar apppar : appparList) { yiciMap.put(apppar.getValue(), 0); } yiciMap.put("合计", 0); for (Map map : yiciData) { String area = map.get("area"); if (yiciMap.containsKey(area)) { yiciMap.put(area,yiciMap.get(area) + 1); } else { continue; } yiciMap.put("合计",yiciMap.get("合计") + 1); } List childList8 = new ArrayList(); childList8.add("2个月停电2次台区且当日停电"); for (PubApppar apppar : appparList) { childList8.add(yiciMap.get(apppar.getValue()).toString()); } childList8.add(yiciMap.get("合计").toString()); resList.add(childList8); // 2个月停电1次台区且昨日停电的台区数据 改为且当日停电 beginDay = DateUtil.dateAddMonth(rangeArray[1], -2); param.put("beginDay", beginDay + beginTime.substring(8, 14)); param.put("countNum", 1); List> yiciData00 = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); Map yici00Map = new HashMap(); for (PubApppar apppar : appparList) { yici00Map.put(apppar.getValue(), 0); } yici00Map.put("合计", 0); for (Map map : yiciData00) { String area = map.get("area"); if (yici00Map.containsKey(area)) { yici00Map.put(area,yici00Map.get(area) + 1); } else { continue; } yici00Map.put("合计",yici00Map.get("合计") + 1); } List childList10 = new ArrayList(); childList10.add("2个月停电1次台区且当日停电"); for (PubApppar apppar : appparList) { childList10.add(yici00Map.get(apppar.getValue()).toString()); } childList10.add(yici00Map.get("合计").toString()); resList.add(childList10); //合计 String tingdianNum = countMap.get("合计"); String tingdianNumDesc = ""; for (Map.Entry entry : countMap.entrySet()) { String mapKey = entry.getKey(); String mapValue = entry.getValue(); tingdianNumDesc += mapKey + mapValue + "个,"; } String sanciyishangNum = String.valueOf(taiQuMap.get("合计")); String sanciyishangNumDesc = ""; for (Map.Entry entry : taiQuMap.entrySet()) { String mapKey = entry.getKey(); Integer mapValue = entry.getValue(); sanciyishangNumDesc += mapKey + mapValue + "个,"; } // 恢复供电时间 DwFileDetail00Example example = new DwFileDetail00Example(); example.createCriteria().andEndTimeGreaterThanOrEqualTo(beginTime).andEndTimeLessThanOrEqualTo(endTime); List selectByExample = db.selectByExample(DwFileDetail00Mapper.class, example, new MINRowBounds(1, 1)); String huifu = ""; if (selectByExample.size() != 0) { System.out.println(selectByExample.get(0).getEndTime()); String hour = selectByExample.get(0).getEndTime().substring(8, 10); String min = selectByExample.get(0).getEndTime().substring(10, 12); if ("00".equals(min)) { huifu = hour; } else { huifu = CommonUtil.add(hour, "1"); } } Map dataMap = new HashMap(); dataMap.put("tingdianNum", tingdianNum); dataMap.put("tingdianNumDesc", tingdianNumDesc); dataMap.put("monthNum", monthNum); dataMap.put("countNum", countNum); dataMap.put("sanciyishangNum", sanciyishangNum); dataMap.put("sanciyishangNumDesc", sanciyishangNumDesc); dataMap.put("huifu", huifu); String descStr = "

监测发现台区停电${tingdianNum}个,按单位分:${tingdianNumDesc}其中${monthNum}个月内重复停电${countNum}次及以上的台区${sanciyishangNum},按单位分:${sanciyishangNumDesc}截止今日${huifu}时已全部恢复送电。

"; resMap.put("dataMap", dataMap); resMap.put("descStr", descStr); return resMap; } /** * 台区停电周报 * @param range * @param timeRange * @return * @throws MINBusinessException * @throws ParseException */ public Map reportTypeTQTDZB(String range, String timeRange) throws MINBusinessException, ParseException { Map resMap = new HashMap(); IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); Map param = new HashMap(); String beginTime = null; String endTime = null; range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); timeRange = timeRange.replaceAll(" ", ""); if (CommonUtil.isEmpty(timeRange)) { beginTime = rangeArray[0] + "000000"; endTime = rangeArray[1] + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = rangeArray[0] + timeRangeArray[0]; endTime = rangeArray[1] + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); List> resList = new ArrayList>(); List title = new ArrayList(); title.add("单位\\分类"); title.add("管理台区总数"); title.add("本周累计停电台次"); title.add("停电时户数"); title.add("本周平均停电时长(小时)"); title.add("本周重复停电台区数"); title.add("本周督办频繁停电台次"); title.add("本周督办频繁停电台区数"); resList.add(title); List areaList = new ArrayList(); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); appparExample.setOrderByClause("APR_TYPE"); List appparList = db.selectByExample(PubAppparMapper.class, appparExample); for (PubApppar apppar : appparList) { areaList.add(apppar.getValue()); List list = new ArrayList(); list.add(apppar.getValue()); list.add(totalMap.get(apppar.getValue())); resList.add(list); } List heji = new ArrayList(); heji.add("合计"); heji.add(totalMap.get("合计")); resList.add(heji); //累计停电台次 List> areaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param); String totalCount = "0"; for (Map map : areaCountList) { String area = map.get("area"); String count = map.get("count"); if (areaList.contains(area)) { int index = areaList.indexOf(area); List child = resList.get(index + 1); child.add(count); } else { continue; } totalCount = CommonUtil.add(totalCount, count); } heji.add(totalCount); // 没有数据的区域数值为0 for (List list : resList) { if (list.size() == 2) { list.add("0"); } } // 平均停电时长 String shihuArea = ""; // 时户最大区域 String shihuNum = "0"; // 时户最大数 String totalHour = "0"; //总时长 String totalCountSC = "0"; List> areaTimeList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param); for (Map map : areaTimeList) { 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); // 平均时长 if (areaList.contains(area)) { int index = areaList.indexOf(area); List child = resList.get(index + 1); child.add(hour); child.add(hourPJ); } else { continue; } if (CommonUtil.compare(shihuNum, hour) == -1) { shihuNum = hour; shihuArea = area; } totalHour = CommonUtil.add(totalHour, hour); totalCountSC = CommonUtil.add(totalCountSC, count); } heji.add(totalHour); heji.add(CommonUtil.divide(totalHour, totalCountSC, 2)); // 没有数据的区域数值为0 for (List list : resList) { if (list.size() == 3) { list.add("0"); list.add("0"); } } // 本周重复停电台区数 param.put("beginDay", beginTime); param.put("endDay", endTime); param.put("countNum", "2"); // 停电次数最多的台区 String mostAddressNumDesc = ""; // 停电最多的次数 String mostAddressNum = ""; String totalChongfu = "0"; List> twiceCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); for (Map map : twiceCountList) { String area = map.get("area"); String num = map.get("num"); String addressName = map.get("addressName"); if (areaList.contains(area)) { int index = areaList.indexOf(area); List child = resList.get(index + 1); if (child.size() >= 6) { child.set(5, CommonUtil.add(child.get(5), "1")); } else { child.add(5, "1"); } } else { continue; } totalChongfu = CommonUtil.add(totalChongfu, "1"); if (CommonUtil.isEmpty(mostAddressNum)) { mostAddressNum = num; } if (mostAddressNum.equals(num)) { mostAddressNumDesc += addressName + "、"; } } // 去除最后一个符号 if (!CommonUtil.isEmpty(mostAddressNumDesc)) { mostAddressNumDesc = mostAddressNumDesc.substring(0, mostAddressNumDesc.length() - 1); } heji.add(totalChongfu); // 没有数据的区域数值为0 for (List list : resList) { if (list.size() == 5) { list.add("0"); } } // 最长时长 List> zuichangTaiquList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00ZuichangTaiqu(param); String zuichangTaiqu = ""; String zuichangSj = ""; if (zuichangTaiquList.size() > 1) { zuichangTaiqu = zuichangTaiquList.get(0).get("addressName"); zuichangSj = CommonUtil.divide(zuichangTaiquList.get(0).get("timeMinute"), "60", 2); } // 本周督办频繁停电台次 String begin = rangeArray[0]; String end = rangeArray[1]; List> dubanList = new ArrayList>(); for (PubApppar apppar : appparList) { List childList = new ArrayList(); dubanList.add(childList); } // 查询每天的停电三次以上且当日停电的台次 while (CommonUtil.compare(begin, end) != 1) { param.put("yesterday", begin); List> 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> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); for (Map map : sanciData) { String area = map.get("area"); if (areaList.contains(area)) { int index = areaList.indexOf(area); List child = resList.get(index + 1); if (child.size() >= 7) { child.set(6, CommonUtil.add(child.get(6), "1")); } else { child.add("1"); } List dubanChildList = dubanList.get(index); if (!dubanChildList.contains(map.get("addressNum"))) { dubanChildList.add(map.get("addressNum")); } } else { continue; } // 合计 if (heji.size() >= 7) { heji.set(6, CommonUtil.add(heji.get(6), "1")); } else { heji.add("1"); } } // 天数 + 1 begin = DateUtil.dateAddDay(begin, 1); } // 没有数据的区域数值为0 for (List list : resList) { if (list.size() == 6) { list.add("0"); } } int totalDuban = 0; for (int i = 1; i < resList.size() - 1; i ++) { List child = resList.get(i); child.add(String .valueOf(dubanList.get(i - 1).size())); totalDuban = totalDuban + dubanList.get(i - 1).size(); } heji.add(String.valueOf(totalDuban)); // 督办总次数 String totalMonthChongfuTaici = heji.get(6); if (CommonUtil.isEmpty(timeRange)) { param.put("beginDay", DateUtil.dateAddDay(DateUtil.dateAddMonth(rangeArray[1], -2), 1) + "000000"); } else { String[] timeRangeArray = timeRange.split("-"); param.put("beginDay", DateUtil.dateAddDay(DateUtil.dateAddMonth(rangeArray[1], -2), 1) + timeRangeArray[0]); } param.put("endDay", endTime); param.put("countNum", "1"); param.put("yesterdayDetail", null); List> twiceMonthCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); // 停电次数最多的台区 String liangyueMostAddressNumDesc = ""; // 停电最多的次数 String liangyueMostAddressNum = ""; // 本周督办频繁停电台区数 for (Map map : twiceMonthCountList) { String addressName = map.get("addressName"); String num = map.get("num"); if (CommonUtil.isEmpty(liangyueMostAddressNum)) { liangyueMostAddressNum = num; } if (liangyueMostAddressNum.equals(num)) { liangyueMostAddressNumDesc += addressName + "、"; } } if(!"".equals(liangyueMostAddressNumDesc)){ // 去除最后一个符号 liangyueMostAddressNumDesc = liangyueMostAddressNumDesc.substring(0, liangyueMostAddressNumDesc.length() - 1); } // 环比 String huanbi = "0"; String huanbiBegin = DateUtil.dateAddMonth(rangeArray[0], -2); // 环比周开始时间 String huanbiEnd = DateUtil.dateAddMonth(rangeArray[1], -2); // 环比周结束时间 while (CommonUtil.compare(huanbiBegin, huanbiEnd) != 1) { param.put("yesterday", huanbiBegin); List> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param); if (yesterdayList.size() == 0) { huanbiBegin = DateUtil.dateAddDay(huanbiBegin, 1); continue; } param.put("yesterdayDetail", yesterdayList); param.put("beginDay", DateUtil.dateAddDay(DateUtil.dateAddMonth(huanbiBegin, -2), 1) + beginTime.substring(8, 14)); param.put("endDay", huanbiBegin + endTime.substring(8, 14)); param.put("countNum", 3); List> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); huanbi = CommonUtil.add(huanbi, String.valueOf(sanciData.size())); // 天数 + 1 huanbiBegin = DateUtil.dateAddDay(huanbiBegin, 1); } // 同比 String tongbi = "0"; String tongbiBegin = DateUtil.dateAddYear(rangeArray[0], -1); // 同比周开始时间 String tongbiEnd = DateUtil.dateAddYear(rangeArray[1], -1); // 同比周结束时间 while (CommonUtil.compare(tongbiBegin, tongbiEnd) != 1) { param.put("yesterday", tongbiBegin); List> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param); if (yesterdayList.size() == 0) { tongbiBegin = DateUtil.dateAddDay(tongbiBegin, 1); continue; } param.put("yesterdayDetail", yesterdayList); param.put("beginDay", DateUtil.dateAddDay(DateUtil.dateAddMonth(tongbiBegin, -2), 1) + beginTime.substring(8, 14)); param.put("endDay", tongbiBegin + endTime.substring(8, 14)); param.put("countNum", 3); List> sanciData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); tongbi = CommonUtil.add(tongbi, String.valueOf(sanciData.size())); // 天数 + 1 tongbiBegin = DateUtil.dateAddDay(tongbiBegin, 1); } // 返回excel数据 resMap.put("excelList", resList); // 描述数据 Map dataMap = new HashMap(); dataMap.put("totalCount", totalCount); dataMap.put("totalHour", totalHour); dataMap.put("shihuArea", shihuArea); dataMap.put("shihuNum", shihuNum); dataMap.put("pingjun", CommonUtil.divide(totalHour, totalCount, 2)); dataMap.put("twiceCount", totalChongfu); dataMap.put("mostAddressNumDesc", mostAddressNumDesc); dataMap.put("mostAddressNum", mostAddressNum); dataMap.put("dubanCount", totalMonthChongfuTaici); dataMap.put("zuichangTaiqu", zuichangTaiqu); dataMap.put("zuichangSj", zuichangSj); dataMap.put("liangyueMostAddressNumDesc", liangyueMostAddressNumDesc); dataMap.put("liangyueMostAddressNum", liangyueMostAddressNum); // 停电两次描述 String twiceCountDesc = ""; // 督办台次 String dubantaiciDesc = ""; // 重复停电台区描述 for (int i = 1; i < resList.size(); i ++) { List childList = resList.get(i); String area = childList.get(0); String num = childList.get(5); if (CommonUtil.compare(num, "0") != 0) { twiceCountDesc += area + num + "个,"; } num = childList.get(6); if (CommonUtil.compare(num, "0") != 0) { dubantaiciDesc += area + num + "次,"; } } dataMap.put("twiceCountDesc", twiceCountDesc); dataMap.put("dubantaiciDesc", dubantaiciDesc); // 环比 if (CommonUtil.compare(totalMonthChongfuTaici, huanbi) == 1) { dataMap.put("huanbi", "环比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(totalMonthChongfuTaici, huanbi), huanbi, 4), "100", 2) + "%"); } else { dataMap.put("huanbi", "环比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(huanbi, totalMonthChongfuTaici), huanbi, 4), "100", 2) + "%"); } // 同比 if (CommonUtil.compare(totalMonthChongfuTaici, tongbi) == 1) { dataMap.put("tongbi", "同比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(totalMonthChongfuTaici, tongbi), tongbi, 4), "100", 2) + "%。"); } else { dataMap.put("tongbi", "同比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(tongbi, totalMonthChongfuTaici), tongbi, 4), "100", 2) + "%。"); } resMap.put("dataMap", dataMap); String descStr = "

上周,台区累计停电${totalCount}台次(${totalHour}时户),平均停电时长${pingjun}小时/台,${shihuArea}停电时户数最多为${shihuNum}时户。停电两次及以上台区${twiceCount}个,${twiceCountDesc}${mostAddressNumDesc}重复停电次数最多为${mostAddressNum}次。${zuichangTaiqu}停电时长最长为${zuichangSj}小时。

" +"上周,督办频繁停电(两个月内三次及以上)共计${dubanCount}台次,${huanbi},${tongbi}${dubantaiciDesc}${liangyueMostAddressNumDesc}两个月内频繁停电次数最多为${liangyueMostAddressNum}次。"; resMap.put("descStr", descStr); return resMap; } /** * 台区停电月报 * @param range * @param timeRange * @return * @throws MINBusinessException * @throws ParseException */ public Map reportTypeTQTDYB(String range, String timeRange) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); Map param = new HashMap(); String beginTime = null; String endTime = null; range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); timeRange = timeRange.replaceAll(" ", ""); if (CommonUtil.isEmpty(timeRange)) { beginTime = rangeArray[0] + "000000"; endTime = rangeArray[1] + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = rangeArray[0] + timeRangeArray[0]; endTime = rangeArray[1] + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); /** 本月数据---- start ----*/ //停电台次 List> areaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00TqtdGS(param); //停电时长 List> areaTimeList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param); // 台次数 List> tcList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByAddress(param); //停电台区数 param.put("beginDay", beginTime); param.put("endDay", endTime); param.put("countNum", "1"); List> taiquCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); /** 本月数据---- end ----*/ /** 去年同月数据---- start ----*/ if (CommonUtil.isEmpty(timeRange)) { beginTime = DateUtil.dateAddYear(rangeArray[0], -1) + "000000"; endTime = DateUtil.dateAddYear(rangeArray[1], -1) + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = DateUtil.dateAddYear(rangeArray[0], -1) + timeRangeArray[0]; endTime = DateUtil.dateAddYear(rangeArray[1], -1) + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); List> tbAreaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00TqtdGS(param); List> tbAreaTimeList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param); List> tbTcList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByAddress(param); // 台次 /** 去年同月数据---- end ----*/ /** 上月月数据---- start ----*/ if (CommonUtil.isEmpty(timeRange)) { beginTime = DateUtil.dateAddMonth(rangeArray[0], -1) + "000000"; endTime = DateUtil.dateAddMonth(rangeArray[1], -1) + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = DateUtil.dateAddMonth(rangeArray[0], -1) + timeRangeArray[0]; endTime = DateUtil.dateAddMonth(rangeArray[1], -1) + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); List> hbAreaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00TqtdGS(param); List> hbAreaTimeList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param); List> hbTcList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByAddress(param); // 台次 /** 上月月数据---- end ----*/ /** 停电台区数 ----start----*/ String totalCount = "0"; for (int i = 0; i < taiquCountList.size(); i++) { totalCount = CommonUtil.add(taiquCountList.get(i).get("num"), totalCount); } /** 停电台区数 ---- end ----*/ /**停电次数数据处理----start----*/ Integer month = Integer.parseInt(rangeArray[1].substring(4,6)); String benyueCount = "0"; String tbCount = "0"; String hbCount = "0"; for (int i = 0; i < areaCountList.size(); i++) { benyueCount = CommonUtil.add(areaCountList.get(i).get("num"), benyueCount); } for (int i = 0; i < tbAreaCountList.size(); i++) { tbCount = CommonUtil.add(tbAreaCountList.get(i).get("num"), tbCount); } for (int i = 0; i < hbAreaCountList.size(); i++) { hbCount = CommonUtil.add(hbAreaCountList.get(i).get("num"), hbCount); } // 同比描述 String tongbi = ""; if (CommonUtil.compare(tbCount, "0") != 0) { if (CommonUtil.compare(benyueCount, tbCount) == 1) { tongbi = "增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(benyueCount, tbCount), tbCount,4), "100", 2) + "%"; } else { tongbi = "减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(tbCount, benyueCount), tbCount,4), "100", 2) + "%"; } } // 环比描述 String huanbi = ""; if (CommonUtil.compare(hbCount, "0") != 0) { if (CommonUtil.compare(benyueCount, hbCount) == 1) { huanbi = "增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(benyueCount, hbCount), hbCount,4), "100", 2) + "%"; } else { huanbi = "减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(hbCount, benyueCount), hbCount,4), "100", 2) + "%"; } } // 台次数 String shejiNum = "0"; for (Map map : tcList) { shejiNum = CommonUtil.add(shejiNum, map.get("num")); } // 去年数据台次数 String tbShejiNum = "0"; for (Map map : tbTcList) { tbShejiNum = CommonUtil.add(tbShejiNum, map.get("num")); } // 上月数据台次数 String hbShejiNum = "0"; for (Map map : hbTcList) { hbShejiNum = CommonUtil.add(hbShejiNum, map.get("num")); } String shejiDesc = ""; for (int i = 0; i < areaCountList.size(); i++) { if (i == areaCountList.size() - 1) { shejiDesc += areaCountList.get(i).get("area") +areaCountList.get(i).get("num")+"台次,占比"+CommonUtil.multiply(CommonUtil.divide(areaCountList.get(i).get("num"), benyueCount, 4), "100", 2)+"%。"; } else { shejiDesc += areaCountList.get(i).get("area") +areaCountList.get(i).get("num")+"台次,占比"+CommonUtil.multiply(CommonUtil.divide(areaCountList.get(i).get("num"), benyueCount, 4), "100", 2)+"%,"; } } /**停电次数数据处理----end----*/ /**停电时长数据处理----start----*/ String benyueTime = "0"; String tbTime = "0"; String hbTime = "0"; for (int i = 0; i < areaTimeList.size(); i++) { benyueTime = CommonUtil.add(areaTimeList.get(i).get("timeMinute"), benyueTime); } for (int i = 0; i < tbAreaTimeList.size(); i++) { tbTime = CommonUtil.add(tbAreaTimeList.get(i).get("timeMinute"), tbTime); } for (int i = 0; i < hbAreaTimeList.size(); i++) { hbTime = CommonUtil.add(hbAreaTimeList.get(i).get("timeMinute"), hbTime); } // sql算的是分钟,转换成小时 benyueTime = CommonUtil.divide(benyueTime, "60", 2); tbTime = CommonUtil.divide(tbTime, "60", 2); hbTime = CommonUtil.divide(hbTime, "60", 2); // 平均时长 String pingjunHour = "0"; if (CommonUtil.compare(shejiNum, "0") != 0) { pingjunHour = CommonUtil.divide(benyueTime, shejiNum, 2); } // 同比数据 String tongbiPingjunHour = ""; if (CommonUtil.compare(tbTime, "0") != 0) { tongbiPingjunHour = CommonUtil.divide(tbTime, tbShejiNum, 2); if (CommonUtil.compare(pingjunHour, tongbiPingjunHour) == 1) { tongbiPingjunHour = "增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(pingjunHour, tongbiPingjunHour), tongbiPingjunHour, 4), "100", 2)+"%"; } else { tongbiPingjunHour = "下降" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(tongbiPingjunHour, pingjunHour), tongbiPingjunHour, 4), "100", 2)+"%"; } } // 环比数据 String huanbiPingjunHour = ""; if (CommonUtil.compare(hbTime, "0") != 0) { huanbiPingjunHour = CommonUtil.divide(hbTime, hbShejiNum, 2); if (CommonUtil.compare(pingjunHour, huanbiPingjunHour) == 1) { huanbiPingjunHour = "增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(pingjunHour, huanbiPingjunHour), huanbiPingjunHour, 4), "100", 2)+"%"; } else { huanbiPingjunHour = "下降" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(huanbiPingjunHour, pingjunHour), huanbiPingjunHour, 4), "100", 2)+"%"; } } // 台区平均停电时长描述 String areaPingjunDesc = ""; for (int i = 0; i < tcList.size(); i++) { String pingjunTime = CommonUtil.divide(CommonUtil.divide(tcList.get(i).get("time"), tcList.get(i).get("num"), 2),"60", 2); if (tcList.size() - 1 == i) { areaPingjunDesc += tcList.get(i).get("area")+pingjunTime+"小时;"; } else { areaPingjunDesc += tcList.get(i).get("area")+pingjunTime+"小时、"; } } // 区域平均时长同比 String tbAreaPingjunDesc = ""; for (int i = 0; i < tcList.size(); i++) { String pingjunTime = CommonUtil.divide(CommonUtil.divide(tcList.get(i).get("time"), tcList.get(i).get("num"), 2),"60", 2); for (int j = 0; j < tbTcList.size(); j++) { if (tcList.get(i).get("area").equals(tbTcList.get(j).get("area"))) { String tbPingjunTime = CommonUtil.divide(CommonUtil.divide(tbTcList.get(j).get("time"), tbTcList.get(j).get("num"), 2),"60", 2); if (CommonUtil.compare(pingjunTime, tbPingjunTime) == 1) { if (i == tcList.size() - 1) { tbAreaPingjunDesc += tcList.get(i).get("area") + "同比上升" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(pingjunTime, tbPingjunTime), tbPingjunTime, 4), "100", 2)+"%。"; } else { tbAreaPingjunDesc += tcList.get(i).get("area") + "同比上升" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(pingjunTime, tbPingjunTime), tbPingjunTime, 4), "100", 2)+"%、"; } } else { if (i == tcList.size() - 1) { tbAreaPingjunDesc += tcList.get(i).get("area") + "同比下降" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(tbPingjunTime, pingjunTime), tbPingjunTime, 4), "100", 2)+"%。"; } else { tbAreaPingjunDesc += tcList.get(i).get("area") + "同比下降" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(tbPingjunTime, pingjunTime), tbPingjunTime, 4), "100", 2)+"%、"; } } break; } } } // 重新计算开始时间和结束时间 if (CommonUtil.isEmpty(timeRange)) { beginTime = rangeArray[0] + "000000"; endTime = rangeArray[1] + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = rangeArray[0] + timeRangeArray[0]; endTime = rangeArray[1] + timeRangeArray[1]; } // 分段台区数 String fenduanDesc = ""; for (int i = 0; i < fenduanList.size(); i ++) { Map shiduanMap = fenduanList.get(i); shiduanMap.put("beginTime", beginTime); shiduanMap.put("endTime", endTime); String num = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00FenDuan(shiduanMap); String zhanbi = CommonUtil.multiply(CommonUtil.divide(num, totalCount, 4), "100", 2); if (i == fenduanList.size() - 1) { fenduanDesc += shiduanMap.get("desc")+ "的" + num+ "台,占比"+zhanbi+"%。"; } else { fenduanDesc += shiduanMap.get("desc")+ "的" + num+ "台,占比"+zhanbi+"%;"; } } param.put("beginTime", beginTime); param.put("endTime", endTime); // 最长停电台区 List> zuichangTaiquList = db.getMybatisMapper(ReportServiceMapper.class).selectReportType00ZuichangTaiqu(param); String zuichangTaiQu = ""; String zuichangTaiQuTime = ""; String qiciTaiQu = ""; String qiciTaiQuTime = ""; if (zuichangTaiquList.size() > 0) { zuichangTaiQu = zuichangTaiquList.get(0).get("addressName"); zuichangTaiQuTime = CommonUtil.divide(zuichangTaiquList.get(0).get("timeMinute"), "60", 2); if (zuichangTaiquList.size() > 1) { qiciTaiQu = zuichangTaiquList.get(1).get("addressName"); qiciTaiQuTime = CommonUtil.divide(zuichangTaiquList.get(1).get("timeMinute"), "60", 2); } } // 两个月内停电2次以上的数据 String beginDay = DateUtil.dateAddDay(DateUtil.dateAddMonth(rangeArray[1], Integer.parseInt("-2")), 1); param.put("beginDay", beginDay + beginTime.substring(8,14)); param.put("endDay", rangeArray[1] + endTime.substring(8,14)); param.put("countNum", "2"); List> twiceMountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); Map taiQuMapTwice = new HashMap();//区域统计 String totalCountTwice = "0"; for (Map map : twiceMountCountList) { String area = map.get("area"); // 已存在 if (taiQuMapTwice.containsKey(area)) { taiQuMapTwice.put(map.get("area"), taiQuMapTwice.get(map.get("area"))+1); } else { taiQuMapTwice.put(map.get("area"), 1); } totalCountTwice = CommonUtil.add(totalCountTwice, "1"); } String totalCountTwiceDesc = ""; for (Map.Entry entry : taiQuMapTwice.entrySet()) { totalCountTwiceDesc += entry.getKey() + entry.getValue()+"台,占比"+CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;"; } if(!"".equals(totalCountTwiceDesc)){ totalCountTwiceDesc = totalCountTwiceDesc.substring(0,totalCountTwiceDesc.length() - 1) + "。"; } Map countMapTwice = new HashMap(); for (Map map : twiceMountCountList) { String num = map.get("num"); // 已存在 if (countMapTwice.containsKey(num)) { countMapTwice.put(num, countMapTwice.get(num) + 1); } else { countMapTwice.put(num, 1); } } String countMapTwiceDesc = ""; for (Map.Entry entry : countMapTwice.entrySet()) { countMapTwiceDesc += "停电" + entry.getKey() + "次的" + entry.getValue() + "台,占比" + CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;"; } if(!"".equals(countMapTwiceDesc)){ countMapTwiceDesc = countMapTwiceDesc.substring(0,countMapTwiceDesc.length() - 1) + "。"; } // 两个月内停电3次以上的数据 param.put("countNum", "3"); List> thipleMountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param); String totalCountthiple = String.valueOf(thipleMountCountList.size()); /**停电次数数据处理----end----*/ String descStr = "

(1)台区停电总体情况${month}月份,台区累计停电${benyueCount}台次,同比${tongbi},环比${huanbi},涉及${shejiNum}个台区,${shejiDesc}

" + "

(2)台区停电时长情况${shejiNum}个台区累计停电时间${benyueTime}小时,平均停电时长${pingjunHour}小时,同比${tongbiPingjunHour},环比${huanbiPingjunHour}。台区平均停电时间为${areaPingjunDesc}从同比情况看,${tbAreaPingjunDesc}

" + "

台区停电时长在${fenduanDesc}停电时长最长的为${zuichangTaiQu},停电${zuichangTaiQuTime}小时,其次是${qiciTaiQu},停电时长${qiciTaiQuTime}小时。

" + "

(3)台区重复停电情况两个月内停电2次及以上的台变${totalCountTwice}个,其中${totalCountTwiceDesc}${totalCountTwice}个重复停电台变中,${countMapTwiceDesc}两个月内停电3次及以上的台变${totalCountthiple}个。

"; Map dataMap = new HashMap(); dataMap.put("month", month); dataMap.put("benyueCount", benyueCount); dataMap.put("tongbi", tongbi); dataMap.put("huanbi", huanbi); dataMap.put("shejiNum", shejiNum); dataMap.put("shejiDesc", shejiDesc); dataMap.put("totalCount", totalCount); dataMap.put("benyueTime", benyueTime); dataMap.put("pingjunHour", pingjunHour); dataMap.put("tongbiPingjunHour", tongbiPingjunHour); dataMap.put("huanbiPingjunHour", huanbiPingjunHour); dataMap.put("areaPingjunDesc", areaPingjunDesc); dataMap.put("tbAreaPingjunDesc", tbAreaPingjunDesc); dataMap.put("fenduanDesc", fenduanDesc); dataMap.put("zuichangTaiQu", zuichangTaiQu); dataMap.put("zuichangTaiQuTime", zuichangTaiQuTime); dataMap.put("qiciTaiQu", qiciTaiQu); dataMap.put("qiciTaiQuTime", qiciTaiQuTime); dataMap.put("totalCountTwice", totalCountTwice); dataMap.put("totalCountTwiceDesc", totalCountTwiceDesc); dataMap.put("countMapTwiceDesc", countMapTwiceDesc); dataMap.put("totalCountthiple", totalCountthiple); Map resMap = new HashMap(); resMap.put("dataMap", dataMap); resMap.put("descStr", descStr); return resMap; } public List> reportTypeZDDTYBB(String firstFileId, String secondFileId) throws MINBusinessException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("ID"); titleList.add("TNAME"); titleList.add("SRC"); resList.add(titleList); DwFileDetail01Example fileDetail01Example = new DwFileDetail01Example(); fileDetail01Example.createCriteria().andFileIdEqualTo(firstFileId); // 选择文件 List firstList = db.selectByExample(DwFileDetail01Mapper.class, fileDetail01Example); fileDetail01Example.clear(); // 对比文件 fileDetail01Example.createCriteria().andFileIdEqualTo(secondFileId); List secondList = db.selectByExample(DwFileDetail01Mapper.class, fileDetail01Example); for (DwFileDetail01 first : firstList) { String firstExcelId = first.getExcelId(); boolean flag = false; for (DwFileDetail01 second : secondList) { String secondExcelId = second.getExcelId(); if (firstExcelId.equals(secondExcelId)) { flag = true; break; } } if (!flag) { List resChildList = new ArrayList(); resChildList.add(first.getExcelId()); resChildList.add(first.getExcelTname()); resChildList.add("退出"); resList.add(resChildList); } } for (DwFileDetail01 second : secondList) { String secondExcelId = second.getExcelId(); boolean flag = false; for (DwFileDetail01 first : firstList) { String firstExcelId = first.getExcelId(); if (secondExcelId.equals(firstExcelId)) { flag = true; break; } } if (!flag) { List resChildList = new ArrayList(); resChildList.add(second.getExcelId()); resChildList.add(second.getExcelTname()); resChildList.add("投入"); resList.add(resChildList); } } return resList; } public List> reportTypeFADZBB(String FADateRange, String yearChoose) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("故障区间判断正确率"); titleList.add("故障区间判断正确环比"); titleList.add("故障前后段恢复正确率"); titleList.add("故障前后段恢复正确环比"); titleList.add("配电线路故障自愈成功率"); titleList.add("配电线路故障自愈成功环比"); resList.add(titleList); Date beginTimeDate = DateUtil.parseDate(yearChoose + FADateRange.substring(0, 4), "yyyyMMdd"); String beginTime = DateUtil.format(beginTimeDate, "yyyyMMdd"); String endTime = yearChoose + FADateRange.substring(4, 8); // 开始月份是12,年份取下一年 if ("12".equals(beginTime.substring(0, 2))) { endTime = CommonUtil.add(yearChoose, "1") + FADateRange.substring(4, 8); } Map param = new HashMap(); param.put("beginTime", beginTime); param.put("endTime", endTime); List> GZQJPDList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQJPD(param); List> GZQHDHFList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQHDHF(param); List> GZQJPDAndGZQHDHFList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQJPDAndGZQHDHF(param); // 环比日期 String huanbiEndTime = DateUtil.dateAddDay(beginTime, -1); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("FADateRange").andValueLike("%"+huanbiEndTime.substring(4, 8)); List appparList = db.getMybatisMapper(PubAppparMapper.class).selectByExample(appparExample); if (appparList.size() != 1) { throw new MINBusinessException("FA动作正确率日期区间获取错误!"); } PubApppar apppar = appparList.get(0); String value = apppar.getValue(); String huanbiBeginTime = huanbiEndTime.substring(0, 4) + value.substring(0, 4); // 结束月是1月,年份取上一年 if ("01".equals(huanbiBeginTime.substring(4, 6))) { huanbiBeginTime = CommonUtil.subtract(huanbiEndTime.substring(0, 4), "1") + value.substring(0, 4); } List> huanbiGZQJPDList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQJPD(param); List> huanbiGZQHDHFList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQHDHF(param); List> huanbiGZQJPDAndGZQHDHFList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail02ByGZQJPDAndGZQHDHF(param); List childList = new ArrayList(); // 故障区间判断正确率 if (GZQJPDList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : GZQJPDList) { if ("正确".equals(dataMap.get("gzqjpd").trim())) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } // 故障区间判断正确环比 if (huanbiGZQJPDList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : huanbiGZQJPDList) { if ("正确".equals(dataMap.get("gzqjpd").trim())) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } // 故障前后段恢复正确率 if (GZQHDHFList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : GZQHDHFList) { if ("正确".equals(dataMap.get("gzqhdhf").trim())) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } // 故障前后段恢复正确环比 if (huanbiGZQHDHFList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : huanbiGZQHDHFList) { if ("正确".equals(dataMap.get("gzqhdhf").trim())) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } // 配电线路故障自愈成功率 if (GZQJPDAndGZQHDHFList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : huanbiGZQHDHFList) { // 故障区间判断、故障前后段恢复均为正确的数量/总数量 if ("正确".equals(dataMap.get("gzqhdhf")) && "正确".equals(dataMap.get("gzqjpd"))) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } // 配电线路故障自愈成功环比 if (huanbiGZQJPDAndGZQHDHFList.size() == 0) { childList.add("无数据"); } else { String zhengqueCount = "0"; String totalNum = "0"; for (Map dataMap : huanbiGZQJPDAndGZQHDHFList) { // 故障区间判断、故障前后段恢复均为正确的数量/总数量 if ("正确".equals(dataMap.get("gzqhdhf").trim()) && "正确".equals(dataMap.get("gzqjpd").trim())) { zhengqueCount = dataMap.get("num"); } totalNum = CommonUtil.add(totalNum, dataMap.get("num")); } childList.add(CommonUtil.multiply(CommonUtil.divide(zhengqueCount, totalNum, 4), "100", 2) + "%"); } resList.add(childList); return resList; } /** * 低电压治理分析表 * @param range * @param reportTypeId * @return * @throws MINBusinessException * @throws ParseException * @throws InvocationTargetException * @throws IllegalArgumentException * @throws IllegalAccessException * @throws SecurityException * @throws NoSuchMethodException */ public Map reportTypeDDYZLFXB(String range, String reportTypeId, int page, int limit) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{ Map resMap = new HashMap(); IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); resMap.put("resList", resList); List titleList = new ArrayList(); titleList.add("序号"); titleList.add("县公司名称"); titleList.add("用户管理单位名称"); titleList.add("线路名称"); titleList.add("台区ID"); titleList.add("变压器名称"); titleList.add("用户编号"); titleList.add("低电压时长"); titleList.add("累计天数"); titleList.add("低电压主要原因(点选)"); titleList.add("具体原因"); titleList.add("治理措施"); titleList.add("是否治理(点选)"); titleList.add("治理完成时间"); titleList.add("是否消除"); titleList.add("昨日新增"); titleList.add("全年累计天数"); range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); String beginTime = rangeArray[0]; String endTime = rangeArray[1]; List childLists = new ArrayList(); childLists.add("

1.数据来源:智能化供电服务指挥系统;因系统数据滞后,统计时间为:"+CommonUtil.dateFormat(beginTime,"yyyy年MM月dd日")+"——"+CommonUtil.dateFormat(endTime,"yyyy年MM月dd日")+",每日发生低电压客户已标红,受考核用户已标黄,累计时长≥15小时的预警用户标褐红色需重点治理。每日新增预警及考核用户编号已标红。

2.反馈要求:请各单位照实填写,按时反馈,具体原因请填写详细,治理完成的填写治理完成时间。未填写或填写不详细的一律列入考核,请知悉。

3.低电压是否消除:以供电服务指挥系统数据为依据,连续7天未发生低电压视为低电压消除。

"); resList.add(childLists); int count = DateUtil.diffDate(beginTime, endTime); //日期集合 List dateList = new ArrayList(); for(int i=0;i<=count;i++){ String beginDate = DateUtil.dateAddDay(endTime,-i); dateList.add(beginDate); beginDate = beginDate.substring(4,6)+"/"+beginDate.substring(6); titleList.add(beginDate+"低电压时长"); } //子类数据 resList.add(titleList); //查询累计天数以及累计时长 Map param = new HashMap(); param.put("beginTime", beginTime); param.put("endTime", endTime); // 分析表数据过大,分页处理 MINRowBounds rows = new MINRowBounds(page, limit); rows.setSeparateSql(true); List> DDYZLFXBList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, rows); resMap.put("resList", resList); resMap.put("count", rows.getCount()); //取所有用户ID List yhidList = CommonUtil.getIdFromList(DDYZLFXBList, "yhid"); //如果用户ID为空,添加默认用户XXXXXXXX if(yhidList == null || yhidList.isEmpty()){ yhidList = new ArrayList(); yhidList.add("XXXXXXXX"); } DwFileDetail03Example example03 = new DwFileDetail03Example(); example03.createCriteria().andSjrqBetween(beginTime, endTime).andYhidIn(yhidList); example03.setOrderByClause("DFD3_YHID,DFD3_SJRQ desc"); //查询数据-用户ID,开始日期、结束日期 List detailList = db.selectByExample(DwFileDetail03Mapper.class, example03); // 获取全年累计天数 String year = endTime.substring(0, 4); param.put("beginTime", CommonUtil.subtract(year, "1") + "1226"); param.put("endTime", year + "1225"); param.put("yhidList", yhidList); List> yearDataList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, new MINRowBounds()); int a = 0; for(Map map :DDYZLFXBList){ List childList = Arrays.asList(new String[titleList.size()]); String dysc = map.get("dysc");//低压时长 String ljts = map.get("ljts");//累计天数 a++; childList.set(0, a+""); childList.set(1, map.get("xgsmc")); childList.set(2, map.get("yhgldw")); childList.set(3, map.get("xlmc")); childList.set(4, map.get("tqid")); childList.set(5, map.get("byqmc")); childList.set(6, map.get("yhid")); childList.set(7, dysc); childList.set(8, ljts); childList.set(9, ""); childList.set(10, ""); childList.set(11, ""); childList.set(12, ""); childList.set(13, ""); childList.set(14, ""); String yhid = String.valueOf(map.get("yhid")); int num = 0; // 最后一日时长 String zuoriSc = "0"; // 总时长,不含最后一日 String scNozuori = "0"; for (int i = 0; i < detailList.size(); i ++) { // 是同一用户 if (detailList.get(i).getYhid().equals(yhid)) { num ++; String sjrq = detailList.get(i).getSjrq(); // 首条数据判断是否消除 if (num == 1) { int countJg = DateUtil.diffDate(sjrq, endTime); //查询是否低电压已消除 if(countJg >= 7){ if (CommonUtil.compare(dysc, "48") != -1) { childList.set(12, "是"); childList.set(14, "是"); } else if (CommonUtil.compare(dysc, "15") != -1) { childList.set(14, "是"); } }else{ childList.set(14, ""); } } int index = DateUtil.diffDate(sjrq, endTime); childList.set(17 + index, detailList.get(i).getDysc()); // 获取昨日时长 if (index == 0) { zuoriSc = detailList.get(i).getDysc(); } else { scNozuori = CommonUtil.add(scNozuori, detailList.get(i).getDysc()); } // 移除已计算数据,减少循环次数 detailList.remove(i); i --; // 排序顺序一致,用户编号不一样退出循环 } else { if (num != 0) { break; } } } // 获取全年数 for (int i = 0; i < yearDataList.size(); i ++) { if (yhid.equals(yearDataList.get(i).get("yhid"))) { childList.set(16, yearDataList.get(i).get("ljts")); yearDataList.remove(i); break; } } // 昨日有时长 且 昨日之前总时长小于48小时 且 昨日+之前时长大于48小时 if (CommonUtil.compare(zuoriSc, "0") != 0 && CommonUtil.compare(scNozuori, "48") == -1 && CommonUtil.compare(CommonUtil.add(zuoriSc, scNozuori), "48") != -1) { childList.set(15, "是"); } else { childList.set(15, "否"); } resList.add(childList); } return resMap; } /** * 低电压日报 * @param range * @param reportTypeId * @return * @throws MINBusinessException * @throws ParseException */ public List> reportTypeDDYRB(String DdyDateRange, String yearChoose,String range, String reportTypeId) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); Date beginTimeDate = DateUtil.parseDate(yearChoose + DdyDateRange.substring(0, 4), "yyyyMMdd"); String beginTime = DateUtil.format(beginTimeDate, "yyyyMMdd"); String endTime = yearChoose + DdyDateRange.substring(4, 8); // 开始月份是12,年份取下一年 if ("12".equals(beginTime.substring(0, 2))) { endTime = CommonUtil.add(yearChoose, "1") + DdyDateRange.substring(4, 8); } PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); appparExample.setOrderByClause("APR_TYPE"); List appparList = db.selectByExample(PubAppparMapper.class, appparExample); Map countMap = new HashMap(); for (PubApppar apppar : appparList) { countMap.put(apppar.getValue(), "0"); } countMap.put("合计", "0"); List title = new ArrayList(); //标题 List childList0 = new ArrayList(); childList0.add("分类\\单位"); for (PubApppar apppar : appparList) { childList0.add(apppar.getValue()); } childList0.add("合计"); //客户总数 List childList1 = new ArrayList(); childList1.add("客户总数"); String heji = "0"; for (PubApppar apppar : appparList) { childList1.add(customerMap.get(apppar.getValue())); heji = CommonUtil.add(heji, customerMap.get(apppar.getValue())); } childList1.add(heji); //低电压客户数 List childList2 = new ArrayList(); childList2.add("低电压客户数"); for(String name:childList0){ if("分类\\单位".equals(name)){ continue; } DwFileDetail03Example example03 = new DwFileDetail03Example(); if("合计".equals(name)){ example03.createCriteria().andSjrqBetween(beginTime, endTime); }else{ example03.createCriteria().andSjrqBetween(beginTime, endTime).andXgsmcLike(name+"%"); } List DateList = db.selectByExample(DwFileDetail03Mapper.class, example03); childList2.add(DateList.size()+""); } //低电压客户占比 List childList3 = new ArrayList(); childList3.add("低电压客户占比"); for(int i=1;i childList4 = new ArrayList(); childList4.add("昨日新增考核户数"); for(int i=1;i map = new HashMap(); if(!"合计".equals(childList0.get(i))){ map.put("area", childList0.get(i)); } map.put("beginTime", beginTime); map.put("endTime", endTimes); List> fileList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map, new MINRowBounds()); map.put("endTime", endTime); List> fileList1 = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map, new MINRowBounds()); childList4.add((fileList1.size()-fileList.size())+""); } //截至目前未治理完成户数 List childList5 = new ArrayList(); childList5.add("截至目前未治理完成户数"); //用户id List childList6 = new ArrayList(); for(int i=1;i map = new HashMap(); if(!"合计".equals(childList0.get(i))){ map.put("area", childList0.get(i)); } map.put("beginTime", beginTime); map.put("endTime", range); List> fileList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map, new MINRowBounds()); if(dayCount<6){ childList5.add(fileList.size()+""); }else{ for(Map maps:fileList){ childList6.add(maps.get("yhid")); } if (childList6.size() == 0) { childList5.add("0"); } else { example.createCriteria().andSjrqBetween(beginTimes, range).andYhidIn(childList6); List DateList = db.selectByExample(DwFileDetail03Mapper.class, example); childList5.add(DateList.size()+""); } } } String content = "昨日新增受考核低电压客户"+childList4.get(childList4.size()-1)+"户,按单位分:"; for(int i=1;i> reportTypeGDYZLFXB(String range, String reportTypeId) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("序号"); titleList.add("县公司名称"); titleList.add("用户管理单位名称"); titleList.add("线路名称"); titleList.add("台区ID"); titleList.add("变压器名称"); titleList.add("用户编号"); titleList.add("过电压时长"); titleList.add("低电压主要原因(点选)"); titleList.add("具体原因"); titleList.add("治理措施"); titleList.add("是否治理(点选)"); titleList.add("治理完成时间"); titleList.add("是否消除"); range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); String beginTime = rangeArray[0]; String endTime = rangeArray[1]; List childLists = new ArrayList(); String content = "1.数据来源:智能化供电服务指挥系统;因系统数据滞后,统计时间为:" + CommonUtil.dateFormat(beginTime,"yyyy年MM月dd日")+"——"+CommonUtil.dateFormat(endTime,"yyyy年MM月dd日")+";每日过电压时长24小时客户已标红,受考核用户已标黄(连续48小时过电压),需重点治理。2.反馈要求:" + "请各单位照实填写,按时反馈,具体原因请详细填写,现场治理完成的填写现场治理时间(格式为20200101),未填写或填写不详细的一律列入考核,请知悉。" + "3.过电压是否消除:以供电服务指挥系统数据为依据,连续7天未发生过电压视为过电压消除。"; childLists.add(content); resList.add(childLists); int count = DateUtil.diffDate(beginTime, endTime); //日期集合 List dateList = new ArrayList(); for(int i=0;i<=count;i++){ String beginDate = DateUtil.dateAddDay(endTime,-i); dateList.add(beginDate); beginDate = beginDate.substring(4,6)+"/"+beginDate.substring(6); titleList.add(beginDate+"过电压时长"); } //子类数据 resList.add(titleList); //查询累计天数以及累计时长 Map param = new HashMap(); param.put("beginTime", beginTime); param.put("endTime", endTime); List> GDYZLFXBList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail04ByGDYZLFXB(param); int a = 0; for(Map map :GDYZLFXBList){ List childList = new ArrayList(); String dysc = String.format("%.0f",map.get("gdysc")); a++; childList.add(a+""); childList.add(map.get("xgsmc")); childList.add(map.get("yhgldw")); childList.add(map.get("xlmc")); childList.add(map.get("tqid")); childList.add(map.get("byqmc")); childList.add(map.get("yhid")); childList.add(dysc); childList.add(""); childList.add(""); childList.add(""); childList.add(""); childList.add(""); //查询该用户低电压明细 DwFileDetail04Example example04 = new DwFileDetail04Example(); example04.createCriteria().andYhidEqualTo(map.get("yhid")).andSjrqBetween(beginTime, endTime); example04.setOrderByClause("DFD4_SJRQ desc"); List DateList = db.selectByExample(DwFileDetail04Mapper.class, example04); int countJg = DateUtil.diffDate(DateList.get(0).getSjrq(), endTime); //查询是否低电压已消除 if(countJg>=7){ childList.add("是"); }else{ childList.add(""); } int bs=0; //循环加载低电压时长 for(String date:dateList){ int b = 0; for(DwFileDetail04 detail:DateList){ if(date.equals(detail.getSjrq())){ childList.add(detail.getGdysc()); b=1; bs++; break; } } if(b == 0){ if(bs<2){ bs=0; } childList.add(""); } } childList.add(bs+""); resList.add(childList); } // resList.add(DDYZLFXBList); return resList; } public Map reportType95598YB(String range) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); Map resMap = new HashMap(); range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); String beginTime = rangeArray[0]; String endTime = rangeArray[1]; // 类型列表 List typeList = new ArrayList(); // 统计表格 List> tongjiList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("类型"); titleList.add("去年同月"); titleList.add("上月"); titleList.add("本月"); titleList.add("同比"); titleList.add("环比"); tongjiList.add(titleList); Map param = new HashMap(); String totalBenyueNum = "0"; String totalShangyueNum = "0"; String totalQunianNum = "0"; // 本月数据 param.put("beginTime", beginTime); param.put("endTime", endTime); // 类型统计数据 List> benyueTongjiMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByType(param); // 区域统计数据 List> benyueByAreaMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByArea(param); for (Map map : benyueTongjiMap) { String type = String.valueOf(map.get("type")); String num = String.valueOf(map.get("num")); // 不包含该类型,新增一个类型 if (!typeList.contains(type)) { typeList.add(type); List typeDataList = Arrays.asList(new String[6]); typeDataList.set(0,type); typeDataList.set(3, num); tongjiList.add(typeDataList); // 已包含该类型,原数据中增加数据 } else { int index = typeList.indexOf(type); List typeDataList = tongjiList.get(index + 1); typeDataList.set(3, num); } totalBenyueNum = CommonUtil.add(totalBenyueNum, num); } // 上月数据 String lastBeginTime = DateUtil.dateAddMonth(beginTime, -1); String lastEndTime = DateUtil.dateAddMonth(endTime, -1); param.put("beginTime", lastBeginTime); param.put("endTime", lastEndTime); List> shangyueTongjiMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByType(param); // 区域统计数据 List> shangyueByAreaMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByArea(param); for (Map map : shangyueTongjiMap) { String type = String.valueOf(map.get("type")); String num = String.valueOf(map.get("num")); // 不包含该类型,新增一个类型 if (!typeList.contains(type)) { typeList.add(type); List typeDataList = Arrays.asList(new String[6]); typeDataList.set(0,type); typeDataList.set(2, num); tongjiList.add(typeDataList); // 已包含该类型,原数据中增加数据 } else { int index = typeList.indexOf(type); List typeDataList = tongjiList.get(index + 1); typeDataList.set(2, num); } totalShangyueNum = CommonUtil.add(totalShangyueNum, num); } // 去年同期数据 String qinianBeginTime = DateUtil.dateAddYear(beginTime, -1); String qunianEndTime = DateUtil.dateAddYear(endTime, -1); param.put("beginTime", qinianBeginTime); param.put("endTime", qunianEndTime); List> qunianTongjiMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByType(param); // 区域统计数据 List> qunianByAreaMap = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05ByArea(param); for (Map map : qunianTongjiMap) { String type = String.valueOf(map.get("type")); String num = String.valueOf(map.get("num")); // 不包含该类型,新增一个类型 if (!typeList.contains(type)) { typeList.add(type); List typeDataList = Arrays.asList(new String[6]); typeDataList.set(0,type); typeDataList.set(1, num); tongjiList.add(typeDataList); // 已包含该类型,原数据中增加数据 } else { int index = typeList.indexOf(type); List typeDataList = tongjiList.get(index + 1); typeDataList.set(1, num); } totalQunianNum = CommonUtil.add(totalQunianNum, num); } // 合计 List hejiList = new ArrayList(); hejiList.add("总计"); hejiList.add(totalQunianNum); hejiList.add(totalShangyueNum); hejiList.add(totalBenyueNum); hejiList.add(""); hejiList.add(""); tongjiList.add(hejiList); // 计算同比环比 for (int i = 1; i < tongjiList.size(); i ++) { List childList = tongjiList.get(i); String qunianNum = CommonUtil.isEmpty(childList.get(1))?"0":childList.get(1); String shangyueNum = CommonUtil.isEmpty(childList.get(2))?"0":childList.get(2); String benyueNum = CommonUtil.isEmpty(childList.get(3))?"0":childList.get(3); // 本月有数据 if (CommonUtil.compare(benyueNum, "0") != 0) { // 去年有数据 if (CommonUtil.compare(qunianNum, "0") != 0) { String tongbi = CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(benyueNum, qunianNum), qunianNum, 4), "100", 2) + "%"; childList.set(4, tongbi); } // 上月有数据 if (CommonUtil.compare(shangyueNum, "0") != 0) { String huanbi = CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(benyueNum, shangyueNum), shangyueNum, 4), "100", 2) + "%"; childList.set(5, huanbi); } } } resMap.put("tongjiList", tongjiList); // 详细数据 param.put("benyueBeginTime", beginTime); param.put("benyueEndTime", endTime); param.put("lastBeginTime", lastBeginTime); param.put("lastEndTime", lastEndTime); param.put("qinianBeginTime", qinianBeginTime); param.put("qunianEndTime", qunianEndTime); List areaList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail05GetArea(param); List>> areaDetailList = new ArrayList>>(); resMap.put("areaDetailList", areaDetailList); for (String type : typeList) { List> benyueDetailList = new ArrayList>(); List benyueTitleList = new ArrayList(); benyueTitleList.add(beginTime + "-" + endTime); benyueTitleList.add("业务类型"); benyueTitleList.add("一级分类"); benyueTitleList.add("二级分类"); benyueTitleList.add("业务子类"); benyueDetailList.add(benyueTitleList); List> shangyueDetailList = new ArrayList>(); List shangyueTitleList = new ArrayList(); shangyueTitleList.add(lastBeginTime + "-" + lastEndTime); shangyueTitleList.add("业务类型"); shangyueTitleList.add("一级分类"); shangyueTitleList.add("二级分类"); shangyueTitleList.add("业务子类"); shangyueDetailList.add(shangyueTitleList); List> qunianDetailList = new ArrayList>(); List qunianTitleList = new ArrayList(); qunianTitleList.add(qinianBeginTime + "-" + qunianEndTime); qunianTitleList.add("业务类型"); qunianTitleList.add("一级分类"); qunianTitleList.add("二级分类"); qunianTitleList.add("业务子类"); qunianDetailList.add(qunianTitleList); // 区域数据 for (String area : areaList) { benyueTitleList.add(area); shangyueTitleList.add(area); qunianTitleList.add(area); } benyueTitleList.add("总计"); shangyueTitleList.add("总计"); qunianTitleList.add("总计"); areaDetailList.add(benyueDetailList); areaDetailList.add(shangyueDetailList); areaDetailList.add(qunianDetailList); // 报表详情生成 until95598(benyueByAreaMap, type, benyueDetailList); until95598(shangyueByAreaMap, type, shangyueDetailList); until95598(qunianByAreaMap, type, qunianDetailList); } // 计算总计 for (int i = 0; i < areaDetailList.size(); i ++) { List> excelList = areaDetailList.get(i); List zongji = new ArrayList(); zongji.add("总计"); zongji.add(""); zongji.add(""); zongji.add(""); zongji.add(""); // 合计汇总 String[] zongjiNum = new String[excelList.get(0).size()- 5]; String totalNum = "0"; for (int j = 1; j < excelList.size(); j ++) { List childList = excelList.get(j); int index = 0; String zongjiType = "0"; for (int k = 5; k < childList.size(); k ++) { zongjiType = CommonUtil.add(zongjiType, childList.get(k)); zongjiNum[index] = CommonUtil.add(zongjiNum[index], childList.get(k)); index ++; } childList.set(childList.size() - 1, zongjiType); totalNum = CommonUtil.add(totalNum, zongjiType); } zongjiNum[zongjiNum.length - 1] = totalNum; for (int j = 0; j < zongjiNum.length; j++) { zongji.add(zongjiNum[j]); } excelList.add(zongji); } return resMap; } /** * 报表数据处理 * @param areaMap * @param type * @param detailList */ public void until95598(List> areaMap, String type, List> detailList) { for (int i = 0; i < areaMap.size(); i ++) { Map map = areaMap.get(i); String dataType = String.valueOf(map.get("type")); // 同一类型的数据 if (dataType.equals(type)) { // 供电单位 String gddw = String.valueOf(map.get("gddw")); // 数量 String num = String.valueOf(map.get("num")); // 业务类型 String ywlx = String.valueOf(map.get("ywlx")); // 一级分类 String yjfl = String.valueOf(map.get("yjfl")); // 二级分类 String ejfl = String.valueOf(map.get("ejfl")); // 业务子类 String ywzl = String.valueOf(map.get("ywzl")); // 不是第一条数据 if (i != 0) { // 下一条数据 Map lastMap = areaMap.get(i - 1); // 业务类型 String lastYwlx = String.valueOf(lastMap.get("ywlx")); // 一级分类 String lastYjfl = String.valueOf(lastMap.get("yjfl")); // 二级分类 String lastEjfl = String.valueOf(lastMap.get("ejfl")); // 业务子类 String lastYwzl = String.valueOf(lastMap.get("ywzl")); // 业务类型等数据相同,是同一行数据 if (lastYwlx.equals(ywlx) && lastYjfl.equals(yjfl) && lastEjfl.equals(ejfl) && lastYwzl.equals(ywzl)) { // 获取区域位置 int index = detailList.get(0).indexOf(gddw); // 获取最后一条数据 List childList = detailList.get(detailList.size() - 1); childList.set(index, num); // 数据不同,新增一条数据 } else { List childList = Arrays.asList(new String[detailList.get(0).size()]); childList.set(0, dataType); childList.set(1, ywlx); childList.set(2, yjfl); childList.set(3, ejfl); childList.set(4, ywzl); // 获取区域位置 int index = detailList.get(0).indexOf(gddw); childList.set(index, num); detailList.add(childList); } } else { List childList = Arrays.asList(new String[detailList.get(0).size()]); childList.set(0, dataType); childList.set(1, ywlx); childList.set(2, yjfl); childList.set(3, ejfl); childList.set(4, ywzl); // 获取区域位置 int index = detailList.get(0).indexOf(gddw); childList.set(index, num); detailList.add(childList); } } } } private List> reportTypeDDYWZL(String ddyFxbId) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); // 报告信息 DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, ddyFxbId); String range = reportInf.getDayInterval(); String beginTime = range.split("-")[0]; String endTime = range.split("-")[1]; List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("序号"); titleList.add("县公司名称"); titleList.add("用户管理单位名称"); titleList.add("线路名称"); titleList.add("台区ID"); titleList.add("变压器名称"); titleList.add("用户编号"); titleList.add("低电压时长"); titleList.add("累计天数"); titleList.add("低电压主要原因(点选)"); titleList.add("具体原因"); titleList.add("治理措施"); titleList.add("是否治理(点选)"); titleList.add("治理完成时间"); titleList.add("是否消除"); int count = DateUtil.diffDate(beginTime, endTime); //日期集合 List dateList = new ArrayList(); for(int i=0;i<=count;i++){ String beginDate = DateUtil.dateAddDay(endTime,-i); dateList.add(beginDate); beginDate = beginDate.substring(4,6)+"/"+beginDate.substring(6); titleList.add(beginDate+"低电压时长"); } resList.add(titleList); DwDdyFxbExample ddyFxbExample = new DwDdyFxbExample(); ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andSfxcNotEqualTo("是").andDdysjGreaterThanOrEqualTo(48); ddyFxbExample.setOrderByClause("DDF_ID"); List ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample); List fxbIdList = CommonUtil.getIdFromList(ddyFxbList, "id"); if (fxbIdList.size() == 0) { return resList; } DwDdyFxbDetailExample ddyFxbDetailExample = new DwDdyFxbDetailExample(); ddyFxbDetailExample.createCriteria().andFxbIdIn(fxbIdList); ddyFxbDetailExample.setOrderByClause("DDFD_FXB_ID"); List detailList = db.selectByExample(DwDdyFxbDetailMapper.class, ddyFxbDetailExample); for (DwDdyFxb ddyFxb : ddyFxbList) { List childList = Arrays.asList(new String[titleList.size()]); childList.set(0, ddyFxb.getXh()); childList.set(1, ddyFxb.getXgsmc()); childList.set(2, ddyFxb.getYhgldwmc()); childList.set(3, ddyFxb.getXlmc()); childList.set(4, ddyFxb.getTqid()); childList.set(5, ddyFxb.getByqmc()); childList.set(6, ddyFxb.getYhbh()); childList.set(7, String.valueOf(ddyFxb.getDdysj())); childList.set(8, String.valueOf(ddyFxb.getLjts())); childList.set(9, ddyFxb.getDdyzymc()); childList.set(10, ddyFxb.getJtyy()); childList.set(11, ddyFxb.getZlcs()); childList.set(12, ddyFxb.getSfzl()); childList.set(13, ddyFxb.getZlwcsj()); childList.set(14, ddyFxb.getSfxc()); String fxbId = ddyFxb.getId(); for (int i = 0; i < detailList.size(); i++) { // 分析表id一致 if (fxbId.equals(detailList.get(i).getFxbId())) { String sjrq = detailList.get(i).getDate(); int index = DateUtil.diffDate(sjrq, endTime); childList.set(15 + index, detailList.get(i).getSc()); detailList.remove(i); i --; } else { break; } } resList.add(childList); } return resList; } private List> reportTypeDDYZRXZ(String ddyFxbId) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); // 报告信息 DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, ddyFxbId); String range = reportInf.getDayInterval(); String beginTime = range.split("-")[0]; String endTime = range.split("-")[1]; List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("序号"); titleList.add("县公司名称"); titleList.add("用户管理单位名称"); titleList.add("线路名称"); titleList.add("台区ID"); titleList.add("变压器名称"); titleList.add("用户编号"); titleList.add("低电压时长"); titleList.add("累计天数"); titleList.add("低电压主要原因(点选)"); titleList.add("具体原因"); titleList.add("治理措施"); titleList.add("是否治理(点选)"); titleList.add("治理完成时间"); titleList.add("是否消除"); int count = DateUtil.diffDate(beginTime, endTime); //日期集合 List dateList = new ArrayList(); for(int i=0;i<=count;i++){ String beginDate = DateUtil.dateAddDay(endTime,-i); dateList.add(beginDate); beginDate = beginDate.substring(4,6)+"/"+beginDate.substring(6); titleList.add(beginDate+"低电压时长"); } resList.add(titleList); DwDdyFxbExample ddyFxbExample = new DwDdyFxbExample(); ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andZrxzEqualTo("是"); ddyFxbExample.setOrderByClause("DDF_ID"); List ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample); List fxbIdList = CommonUtil.getIdFromList(ddyFxbList, "id"); if (fxbIdList.size() == 0) { return resList; } DwDdyFxbDetailExample ddyFxbDetailExample = new DwDdyFxbDetailExample(); ddyFxbDetailExample.createCriteria().andFxbIdIn(fxbIdList); ddyFxbDetailExample.setOrderByClause("DDFD_FXB_ID"); List detailList = db.selectByExample(DwDdyFxbDetailMapper.class, ddyFxbDetailExample); for (DwDdyFxb ddyFxb : ddyFxbList) { List childList = Arrays.asList(new String[titleList.size()]); childList.set(0, ddyFxb.getXh()); childList.set(1, ddyFxb.getXgsmc()); childList.set(2, ddyFxb.getYhgldwmc()); childList.set(3, ddyFxb.getXlmc()); childList.set(4, ddyFxb.getTqid()); childList.set(5, ddyFxb.getByqmc()); childList.set(6, ddyFxb.getYhbh()); childList.set(7, String.valueOf(ddyFxb.getDdysj())); childList.set(8, String.valueOf(ddyFxb.getLjts())); childList.set(9, ddyFxb.getDdyzymc()); childList.set(10, ddyFxb.getJtyy()); childList.set(11, ddyFxb.getZlcs()); childList.set(12, ddyFxb.getSfzl()); childList.set(13, ddyFxb.getZlwcsj()); childList.set(14, ddyFxb.getSfxc()); String fxbId = ddyFxb.getId(); for (int i = 0; i < detailList.size(); i++) { // 分析表id一致 if (fxbId.equals(detailList.get(i).getFxbId())) { String sjrq = detailList.get(i).getDate(); int index = DateUtil.diffDate(sjrq, endTime); childList.set(15 + index, detailList.get(i).getSc()); detailList.remove(i); i --; } else { break; } } resList.add(childList); } return resList; } /** * 低电压周报 * @param ddyFxbId * @param range * @return * @throws MINBusinessException * @throws ParseException * @throws NoSuchMethodException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException * @throws InvocationTargetException */ public Map reportTypeDDYZB(String ddyFxbId, String range) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); appparExample.setOrderByClause("APR_TYPE"); List appparList = db.selectByExample(PubAppparMapper.class, appparExample); Map resMap = new HashMap(); // 本周开始时间和结束时间 range = range.replaceAll(" ", ""); String weekBegin = range.split("-")[0]; String weekEnd = range.split("-")[1]; DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, ddyFxbId); // 当月开始时间和结束时间 String monthBegin = reportInf.getDayInterval().split("-")[0]; // 全年开始时间和结束时间 String yearBegin = CommonUtil.subtract(monthBegin.substring(0, 4), "1") + "1226"; // if ("12".equals(monthBegin.substring(4,6))) { yearBegin = monthBegin.substring(0, 4) + "1226"; } // 全年累计考核数 Map param = new HashMap(); param.put("reportId", ddyFxbId); param.put("beginTime", yearBegin); param.put("endTime", weekEnd); List> yearTotal = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param, new MINRowBounds()); // 本月之前全年考核数 param.put("beginTime", yearBegin); param.put("endTime", DateUtil.dateAddDay(monthBegin, -1)); List> yearTotalNoBenyue = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param, new MINRowBounds()); // 本周之前全年考核数 param.put("beginTime", yearBegin); param.put("endTime", DateUtil.dateAddDay(weekBegin, -1)); List> yearTotalNoBenzhou = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param, new MINRowBounds()); // 本月新增考核数 int benyueXZ = yearTotal.size() - yearTotalNoBenyue.size(); // 本周新增考核数 int benzhouXZ = yearTotal.size() - yearTotalNoBenzhou.size(); // 本周之前用户编号集合 List bzzqYhbhList = CommonUtil.getIdFromList(yearTotalNoBenzhou, "yhid"); // 本周新增明细 List> bzzxmxDescList = new ArrayList>(); for (int i = 0; i < yearTotal.size(); i ++) { String yhbh = yearTotal.get(i).get("yhid"); String xgsmc = yearTotal.get(i).get("xgsmc"); // 本周新增数据 if (!bzzqYhbhList.contains(yhbh)) { boolean isContain = false; for (int j = 0; j < bzzxmxDescList.size(); j ++) { String name = bzzxmxDescList.get(j).get("name"); String num = bzzxmxDescList.get(j).get("num"); // 数量+1 if (xgsmc.contains(name)) { isContain = true; bzzxmxDescList.get(j).put("num", CommonUtil.add(num, "1")); } } if (!isContain) { Map descMap = new HashMap(); boolean flag = false; for (PubApppar apppar : appparList) { if (xgsmc.contains(apppar.getValue())) { descMap.put("name", apppar.getValue()); flag = true; continue; } } if (!flag) { continue; } descMap.put("num", "1"); bzzxmxDescList.add(descMap); } } } String danweiDesc = ""; for (int j = 0; j < bzzxmxDescList.size(); j ++) { String name = bzzxmxDescList.get(j).get("name"); String num = bzzxmxDescList.get(j).get("num"); if (j == bzzxmxDescList.size() - 1) { danweiDesc += (name + num + "户。"); } else { danweiDesc += (name + num + "户,"); } } // 正在治理用户数 String zzliNum = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbZZZL(param).get("num"); // 治理后再次出现 List> zlhzccxList = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbZlhzccx(param); String zlhzccxNum = "0"; String zlhzccxDesc = ""; for (int i = 0; i < zlhzccxList.size(); i ++) { Map map = zlhzccxList.get(i); String area = map.get("area").substring(0, 2); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (apppar.getValue().equals(area)) { flag = true; continue; } } if (!flag) { continue; } zlhzccxNum = CommonUtil.add(zlhzccxNum, num); // 最后一条数据 if (i == zlhzccxList.size() - 1) { zlhzccxDesc += area + num + "户;"; } else { zlhzccxDesc += area + num + "户,"; } } // 未开始治理用户区域分组 List> wkszlList = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbWKSZL(param); String wkszlNum = "0"; String wkszlDesc = ""; for (int i = 0; i < wkszlList.size(); i ++) { Map map = wkszlList.get(i); String area = map.get("area").substring(0, 2); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (apppar.getValue().equals(area)) { flag = true; continue; } } if (!flag) { continue; } wkszlNum = CommonUtil.add(wkszlNum, num); // 最后一条数据 if (i == wkszlList.size() - 1) { wkszlDesc += area + num + "户。"; } else { wkszlDesc += area + num + "户,"; } } String wzlwcNum = CommonUtil.add(CommonUtil.add(zzliNum, zlhzccxNum), wkszlNum); String desc = "本月新增受考核低电压客户${benyueXZ}户,其中本周新增${benzhouXZ}户,按单位分${danweiDesc}截至目前未治理完成${wzlwcNum}户,${zzliNum}户正在治理;${zlhzccxNum}户治理后再次出现,${zlhzccxDesc}${wkszlNum}户未开始治理,${wkszlDesc}"; Map reportMap = new HashMap(); reportMap.put("benyueXZ", String.valueOf(benyueXZ)); reportMap.put("benzhouXZ", String.valueOf(benzhouXZ)); reportMap.put("danweiDesc", danweiDesc); reportMap.put("wzlwcNum", wzlwcNum); reportMap.put("zzliNum", zzliNum); reportMap.put("zlhzccxNum", zlhzccxNum); reportMap.put("zlhzccxDesc", zlhzccxDesc); reportMap.put("wkszlNum", wkszlNum); reportMap.put("wkszlDesc", wkszlDesc); resMap.put("reportMap", reportMap); resMap.put("descStr", desc); List> excelList = new ArrayList>(); // 表头 List titleList = new ArrayList(); titleList.add("分类\\单位"); for (PubApppar apppar : appparList) { titleList.add(apppar.getValue()); } titleList.add("合计"); excelList.add(titleList); // 合计栏 List child0 = new ArrayList(); child0.add("管理客户总数"); String total = "0"; for (PubApppar apppar : appparList) { child0.add(customerMap.get(apppar.getValue())); total = CommonUtil.add(total, customerMap.get(apppar.getValue())); } child0.add(total); excelList.add(child0); // 本月之前用户编号集合 List byzqYhbhList = CommonUtil.getIdFromList(yearTotalNoBenyue, "yhid"); // 本月新增明细 List> byzxmxDescList = new ArrayList>(); for (PubApppar apppar : appparList) { Map byzxTaian = new HashMap(); byzxTaian.put("name", apppar.getValue()); byzxTaian.put("num", "0"); byzxmxDescList.add(byzxTaian); } for (int i = 0; i < yearTotal.size(); i ++) { String yhbh = yearTotal.get(i).get("yhid"); String xgsmc = yearTotal.get(i).get("xgsmc"); // 本月新增数据 if (!byzqYhbhList.contains(yhbh)) { for (int j = 0; j < byzxmxDescList.size(); j ++) { String name = byzxmxDescList.get(j).get("name"); String num = byzxmxDescList.get(j).get("num"); // 数量+1 if (xgsmc.contains(name)) { byzxmxDescList.get(j).put("num", CommonUtil.add(num, "1")); } } } } List child1 = new ArrayList(); child1.add("本月新增受考核客户数"); for (int j = 0; j < byzxmxDescList.size(); j ++) { String num = byzxmxDescList.get(j).get("num"); child1.add(num); } child1.add(String.valueOf(benyueXZ)); excelList.add(child1); // 全年数据 List> quanianDetailList = new ArrayList>(); for (PubApppar apppar : appparList) { Map quannianTaian = new HashMap(); quannianTaian.put("name", apppar.getValue()); quannianTaian.put("num", "0"); quanianDetailList.add(quannianTaian); } for (int i = 0; i < yearTotal.size(); i ++) { String xgsmc = yearTotal.get(i).get("xgsmc"); for (int j = 0; j < quanianDetailList.size(); j ++) { String name = quanianDetailList.get(j).get("name"); String num = quanianDetailList.get(j).get("num"); // 数量+1 if (xgsmc.contains(name)) { quanianDetailList.get(j).put("num", CommonUtil.add(num, "1")); } } } List child2 = new ArrayList(); child2.add("全年累计受考核客户数"); for (int j = 0; j < quanianDetailList.size(); j ++) { String num = quanianDetailList.get(j).get("num"); child2.add(num); } child2.add(String.valueOf(yearTotal.size())); excelList.add(child2); resMap.put("excelList", excelList); return resMap; } /** * 低电压超30天 * @param ddyFxbId * @return * @throws MINBusinessException * @throws ParseException * @throws NoSuchMethodException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException * @throws InvocationTargetException */ private List> reportTypeDDY30T(String ddyFxbId) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); // 报告信息 DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, ddyFxbId); String range = reportInf.getDayInterval(); String beginTime = range.split("-")[0]; String endTime = range.split("-")[1]; List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("序号"); titleList.add("县公司名称"); titleList.add("用户管理单位名称"); titleList.add("线路名称"); titleList.add("台区ID"); titleList.add("变压器名称"); titleList.add("用户编号"); titleList.add("低电压时长"); titleList.add("累计天数"); titleList.add("低电压主要原因(点选)"); titleList.add("具体原因"); titleList.add("治理措施"); titleList.add("是否治理(点选)"); titleList.add("治理完成时间"); titleList.add("是否消除"); titleList.add("全年累计天数"); int count = DateUtil.diffDate(beginTime, endTime); //日期集合 List dateList = new ArrayList(); for(int i=0;i<=count;i++){ String beginDate = DateUtil.dateAddDay(endTime,-i); dateList.add(beginDate); beginDate = beginDate.substring(4,6)+"/"+beginDate.substring(6); titleList.add(beginDate+"低电压时长"); } resList.add(titleList); DwDdyFxbExample ddyFxbExample = new DwDdyFxbExample(); ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andSfxcNotEqualTo("是").andDdysjGreaterThanOrEqualTo(48).andQnljtsGreaterThan(30); ddyFxbExample.setOrderByClause("DDF_ID"); List ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample); List fxbIdList = CommonUtil.getIdFromList(ddyFxbList, "id"); if (fxbIdList.size() == 0) { return resList; } DwDdyFxbDetailExample ddyFxbDetailExample = new DwDdyFxbDetailExample(); ddyFxbDetailExample.createCriteria().andFxbIdIn(fxbIdList); ddyFxbDetailExample.setOrderByClause("DDFD_FXB_ID"); List detailList = db.selectByExample(DwDdyFxbDetailMapper.class, ddyFxbDetailExample); for (DwDdyFxb ddyFxb : ddyFxbList) { List childList = Arrays.asList(new String[titleList.size()]); childList.set(0, ddyFxb.getXh()); childList.set(1, ddyFxb.getXgsmc()); childList.set(2, ddyFxb.getYhgldwmc()); childList.set(3, ddyFxb.getXlmc()); childList.set(4, ddyFxb.getTqid()); childList.set(5, ddyFxb.getByqmc()); childList.set(6, ddyFxb.getYhbh()); childList.set(7, String.valueOf(ddyFxb.getDdysj())); childList.set(8, String.valueOf(ddyFxb.getLjts())); childList.set(9, ddyFxb.getDdyzymc()); childList.set(10, ddyFxb.getJtyy()); childList.set(11, ddyFxb.getZlcs()); childList.set(12, ddyFxb.getSfzl()); childList.set(13, ddyFxb.getZlwcsj()); childList.set(14, ddyFxb.getSfxc()); childList.set(15, String.valueOf(ddyFxb.getQnljts())); String fxbId = ddyFxb.getId(); for (int i = 0; i < detailList.size(); i++) { // 分析表id一致 if (fxbId.equals(detailList.get(i).getFxbId())) { String sjrq = detailList.get(i).getDate(); int index = DateUtil.diffDate(sjrq, endTime); childList.set(16 + index, detailList.get(i).getSc()); detailList.remove(i); i --; } else { break; } } resList.add(childList); } return resList; } /** * * @param ddyFxbId * @return * @throws MINBusinessException * @throws ParseException * @throws NoSuchMethodException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException * @throws InvocationTargetException */ private Map reportTypeDDYYB(String ddyFxbId) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); PubAppparExample appparExample = new PubAppparExample(); appparExample.createCriteria().andCodeEqualTo("tqtd_num_" + systemCode); appparExample.setOrderByClause("APR_TYPE"); List appparList = db.selectByExample(PubAppparMapper.class, appparExample); Map resMap = new HashMap(); // 报告信息 DwReportInf reportInf = db.selectByPrimaryKey(DwReportInfMapper.class, ddyFxbId); String range = reportInf.getDayInterval(); String beginTime = range.split("-")[0]; String endTime = range.split("-")[1]; // 报表月份 String month = Integer.parseInt(endTime.substring(4, 6)) + "月"; String year = Integer.parseInt(beginTime.substring(0, 4)) + "年"; Map param = new HashMap(); param.put("reportId", ddyFxbId); List> areaNum = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByXgsmc(param); // 公司低电压用户数 String totalNum = "0"; String totalNumDetailDesc = ""; for (int i = 0; i < areaNum.size(); i ++) { Map map = areaNum.get(i); String area = map.get("area"); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } if (i == areaNum.size() - 1) { totalNumDetailDesc += area+ num + "户,占所辖营业户数" + CommonUtil.multiply(CommonUtil.divide(num, customerMap.get(area), 4), "100", 2)+ "%。"; } else { totalNumDetailDesc += area + num + "户,占所辖营业户数" + CommonUtil.multiply(CommonUtil.divide(num, customerMap.get(area), 4), "100", 2)+ "%;"; } totalNum = CommonUtil.add(totalNum, num); } String heji = "0"; for (PubApppar apppar : appparList) { heji = CommonUtil.add(heji, customerMap.get(apppar.getValue())); } // 公司低电压用户数占比 String totalNumZb = CommonUtil.multiply(CommonUtil.divide(totalNum, heji, 4), "100", 2); // 去年同期数 param.put("beginTime", DateUtil.dateAddYear(beginTime, -1)); param.put("endTime", DateUtil.dateAddYear(endTime, -1)); MINRowBounds rows = new MINRowBounds(); rows.setSeparateSql(true); db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, rows); String qunianTotalNum = String.valueOf(rows.getCount()); // 上月数 param.put("beginTime", DateUtil.dateAddMonth(beginTime, -1)); param.put("endTime", DateUtil.dateAddMonth(endTime, -1)); db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, rows); String shangyueTotalNum = String.valueOf(rows.getCount()); String totalNumHB = ""; if (CommonUtil.compare(shangyueTotalNum, "0") != 0) { if (CommonUtil.compare(totalNum, shangyueTotalNum) == 1) { totalNumHB = "环比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(totalNum, shangyueTotalNum), shangyueTotalNum, 4), "100", 2) + "%,"; } else { totalNumHB = "环比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(shangyueTotalNum, totalNum), shangyueTotalNum, 4), "100", 2) + "%,"; } } String totalNumTB = ""; if (CommonUtil.compare(qunianTotalNum, "0") != 0) { if (CommonUtil.compare(totalNum, qunianTotalNum) == 1) { totalNumTB = "同比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(totalNum, qunianTotalNum), qunianTotalNum, 4), "100", 2) + "%,"; } else { totalNumTB = "同比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(qunianTotalNum, totalNum), qunianTotalNum, 4), "100", 2) + "%,"; } } // 受考核数 List> kaoheArea = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByXgsmcAndZl(param); // 公司低电压用户数 String kaoheNum = "0"; String kaoheAreaDesc = ""; Map keheAreaMap = new HashMap(); for (int i = 0; i < kaoheArea.size(); i ++) { Map map = kaoheArea.get(i); String area = map.get("area"); String num = map.get("num"); keheAreaMap.put(area, num); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } if (i == areaNum.size() - 1) { kaoheAreaDesc += area + num + "户,占比" + CommonUtil.multiply(CommonUtil.divide(num, customerMap.get(area), 4), "100", 4)+ "%。"; } else { kaoheAreaDesc += area + num + "户,占比" + CommonUtil.multiply(CommonUtil.divide(num, customerMap.get(area), 4), "100", 4)+ "%;"; } kaoheNum = CommonUtil.add(kaoheNum, num); } // 受考核数占比 String kaoheNumZb = CommonUtil.multiply(CommonUtil.divide(kaoheNum, heji, 4), "100", 4); // 去年受考核数 param.put("beginTime", DateUtil.dateAddYear(beginTime, -1)); param.put("endTime", DateUtil.dateAddYear(endTime, -1)); db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param, rows); String kaoheNumQunian = String.valueOf(rows.getCount()); // 上月受考核数 param.put("beginTime", DateUtil.dateAddMonth(beginTime, -1)); param.put("endTime", DateUtil.dateAddMonth(endTime, -1)); db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param, rows); String kaoheNumShangyue = String.valueOf(rows.getCount()); String kaoheNumHB = ""; if (CommonUtil.compare(kaoheNumShangyue, "0") != 0) { if (CommonUtil.compare(kaoheNum, kaoheNumShangyue) == 1) { kaoheNumHB = "环比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(kaoheNum, kaoheNumShangyue), kaoheNumShangyue, 4), "100", 2) + "%,"; } else { kaoheNumHB = "环比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(kaoheNumShangyue, kaoheNum), kaoheNumShangyue, 4), "100", 2) + "%,"; } } String kaoheNumTB = ""; if (CommonUtil.compare(kaoheNumQunian, "0") != 0) { if (CommonUtil.compare(kaoheNum, kaoheNumQunian) == 1) { kaoheNumTB = "同比增加" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(kaoheNum, kaoheNumQunian), kaoheNumQunian, 4), "100", 2) + "%。"; } else { kaoheNumTB = "同比减少" + CommonUtil.multiply(CommonUtil.divide(CommonUtil.subtract(kaoheNumQunian, kaoheNum), kaoheNumQunian, 4), "100", 2) + "%。"; } } // 治理完成数 param.put("zlwc", "是"); List> kaoheZlArea = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByXgsmcAndZl(param); String kaoheZlNum = "0"; String kaoheZlDesc = ""; for (int i = 0; i < kaoheZlArea.size(); i ++) { Map map = kaoheZlArea.get(i); String area = map.get("area").substring(0, 2); String num = map.get("num"); String wanchenglv = CommonUtil.multiply(CommonUtil.divide(num, keheAreaMap.get(area), 4), "100", 2); if (i == areaNum.size() - 1) { kaoheZlDesc += area + "治理完成" + num + "户,治理完成率" + wanchenglv+ "%。"; } else { kaoheZlDesc += area + "治理完成" + num + "户,治理完成率" + wanchenglv+ "%;"; } kaoheZlNum = CommonUtil.add(kaoheZlNum, num); } String kaoheZlNumLv = "0"; if (CommonUtil.compare(kaoheNum, "0") != 0) { kaoheZlNumLv = CommonUtil.multiply(CommonUtil.divide(kaoheZlNum, kaoheNum, 4), "100", 2); } String desc1 = "

1.用户低电压情况

" + "

(1)总体情况(说明:用户电压低于198伏且持续超过1小时为低电压)

" + "

${month},公司低电压用户${totalNum}户,占公司总营业户数${totalNumZb}%,${totalNumHB}${totalNumTB}其中,${totalNumDetailDesc}

" + "

(2)受考核情况(说明:月度累计低电压时长超过48小时低电压用户为受考核用户)

" + "

6月,公司低电压受考核客户${kaoheNum}户,占公司总营业户数${kaoheNumZb},${kaoheNumHB}${kaoheNumTB}其中,${kaoheAreaDesc}治理完成${kaoheZlNum}户,治理完成率${kaoheZlNumLv}%,其中${kaoheZlDesc} ${year}${month}各单位低电压受考核及预警情况统计见表3-1。

" + "

图表3-1 ${year}${month}各单位低电压受考核及预警情况统计

"; List> tableArray1 = new ArrayList>(); List tableArray1Title = new ArrayList(); tableArray1Title.add("单位"); tableArray1Title.add("总户数"); tableArray1Title.add("预警户数(≥15h)"); tableArray1Title.add("预警治理完成"); tableArray1Title.add("预警治理完成率"); tableArray1Title.add("受考核低电压户数"); tableArray1Title.add("考核低电压客户占比"); tableArray1Title.add("考核治理完成户数"); tableArray1Title.add("考核治理完成率"); tableArray1.add(tableArray1Title); // 预警数据 List> yujingNum = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByXgsmcYuJing(param); List areaList = new ArrayList(); for (PubApppar apppar : appparList) { areaList.add(apppar.getValue()); List tableArrayJingqu = new ArrayList(); tableArrayJingqu.add(apppar.getValue()); tableArrayJingqu.add(customerMap.get(apppar.getValue())); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArrayJingqu.add("0"); tableArray1.add(tableArrayJingqu); } List tableArrayHeji = new ArrayList(); tableArrayHeji.add("合计"); tableArrayHeji.add(heji); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArrayHeji.add("0"); tableArray1.add(tableArrayHeji); // 预警合计 String yujingHeji = "0"; String yujingHejiZl = "0"; // 预警情况 for (Map map : yujingNum) { String area = map.get("area"); String num = map.get("num"); String sfxc = map.get("sfxc"); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } int index = areaList.indexOf(area); List tableArrayChild = tableArray1.get(index + 1); tableArrayChild.set(2, CommonUtil.add(tableArrayChild.get(2), num)); if ("是".equals(sfxc)) { tableArrayChild.set(3, num); } if ("是".equals(sfxc)) { yujingHejiZl = CommonUtil.add(yujingHejiZl, num); } yujingHeji = CommonUtil.add(yujingHeji, num); } tableArrayHeji.set(2, yujingHeji); tableArrayHeji.set(3, yujingHejiZl); // 考核合计 String kaoheHeji = "0"; // 考核情况 for(Map.Entry entry : keheAreaMap.entrySet()){ String area = entry.getKey(); String num = entry.getValue(); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } int index = areaList.indexOf(area); List tableArrayChild = tableArray1.get(index + 1); tableArrayChild.set(5, num); tableArrayChild.set(6, CommonUtil.multiply(CommonUtil.divide(num, customerMap.get(area), 6), "100", 4) + "%"); kaoheHeji = CommonUtil.add(kaoheHeji, num); } tableArrayHeji.set(5, kaoheHeji); tableArrayHeji.set(6, CommonUtil.multiply(CommonUtil.divide(kaoheHeji, heji, 6), "100", 4) + "%"); // 考核治理合计 String kaoheHejiZl = "0"; // 考核治理情况 for (int i = 0; i < kaoheZlArea.size(); i ++) { Map map = kaoheZlArea.get(i); String area = map.get("area").substring(0, 2); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } int index = areaList.indexOf(area); List tableArrayChild = tableArray1.get(index + 1); tableArrayChild.set(7, num); String kaohe = tableArrayChild.get(5); if (CommonUtil.compare(kaohe, "0") != 0) { tableArrayChild.set(8, CommonUtil.multiply(CommonUtil.divide(num, kaohe, 4), "100", 2) + "%"); } kaoheHejiZl = CommonUtil.add(kaoheHejiZl, num); } tableArrayHeji.set(7, kaoheHejiZl); if (CommonUtil.compare(kaoheHeji, "0") != 0) { tableArrayHeji.set(8, CommonUtil.multiply(CommonUtil.divide(kaoheHejiZl, kaoheHeji, 4), "100", 2) + "%"); } for (int i = 1; i < tableArray1.size(); i ++) { List childList = tableArray1.get(i); String yujingzl = childList.get(3); String yujing = childList.get(2); if (CommonUtil.compare(yujingzl, "0") != 0 && CommonUtil.compare(yujing, "0") != 0) { childList.set(4, CommonUtil.multiply(CommonUtil.divide(yujingzl, yujing, 4), "100", 2) + "%"); } } List tubiaoData1Array1 = new ArrayList(); List tubiaoData1Array2 = new ArrayList(); List tubiaoData1Array3 = new ArrayList(); for (int i = 1; i < tableArray1.size() - 1; i ++) { tubiaoData1Array1.add(tableArray1.get(i).get(7)); tubiaoData1Array2.add(tableArray1.get(i).get(8)); tubiaoData1Array3.add(tableArray1.get(i).get(6)); } List> tubiaoData1 = new ArrayList>(); Map zlwcMap = new HashMap(); zlwcMap.put("name", "治理完成户数"); zlwcMap.put("type", "bar"); zlwcMap.put("yAxisIndex", 0); zlwcMap.put("data", tubiaoData1Array1); tubiaoData1.add(zlwcMap); Map zlwcLvMap = new HashMap(); zlwcLvMap.put("name", "治理完成率"); zlwcLvMap.put("type", "bar"); zlwcLvMap.put("yAxisIndex", 1); zlwcLvMap.put("data", tubiaoData1Array2); tubiaoData1.add(zlwcLvMap); Map kaoheZbMap = new HashMap(); kaoheZbMap.put("name", "考核低压占比"); kaoheZbMap.put("type", "line"); kaoheZbMap.put("yAxisIndex", 2); kaoheZbMap.put("data", tubiaoData1Array3); tubiaoData1.add(kaoheZbMap); String desc2 = "

(3)重复发生情况

" + "

${month},公司重复低电压15天以上用户${ljtsGt15}户,${ljtsGt15Desc}${year}${month}公司低电压重复发生15天以上用户明细见表3-2。

" + "

表3-2 ${year}${month}公司低电压重复发生15天以上明细

"; // 重复停电15天以上数据 DwDdyFxbExample ddyFxbExample = new DwDdyFxbExample(); ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andLjtsGreaterThan(15); ddyFxbExample.setOrderByClause("DDF_XGSMC"); List ddyFxb15List = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample); int numFlag = 0; String ljtsGt15Desc = ""; String ljtsGt15 = String.valueOf(ddyFxb15List.size()); for (int i = 0; i < ddyFxb15List.size(); i ++) { DwDdyFxb dq = ddyFxb15List.get(i); // 不是最后一条数据 if (i != ddyFxb15List.size() - 1) { // 获取下一条数据 DwDdyFxb next = ddyFxb15List.get(i + 1); // 县公司名称相同 if (dq.getXgsmc().equals(next.getXgsmc())) { numFlag ++; } else { ljtsGt15Desc += dq.getXgsmc().substring(0, 2) + numFlag + "户,"; numFlag = 0; } } else { ljtsGt15Desc += dq.getXgsmc().substring(0, 2) + numFlag + "户。"; } } List> tableArray2 = new ArrayList>(); List tableArray2Title = new ArrayList(); tableArray2Title.add("序号"); tableArray2Title.add("单位"); tableArray2Title.add("用户管理单位"); tableArray2Title.add("台区ID"); tableArray2Title.add("变压器名称"); tableArray2Title.add("用户编号"); tableArray2Title.add("低电压时长"); tableArray2Title.add("累计天数"); tableArray2.add(tableArray2Title); for (int i = 0; i < ddyFxb15List.size(); i ++) { DwDdyFxb dq = ddyFxb15List.get(i); List child = new ArrayList(); child.add(i + 1 + ""); child.add(dq.getXgsmc().substring(0, 2)); child.add(dq.getYhgldwmc()); child.add(dq.getTqid()); child.add(dq.getByqmc()); child.add(dq.getYhbh()); child.add(dq.getDdysj() + ""); child.add(dq.getLjts() + ""); tableArray2.add(child); } String desc3 = "

(4)涉及台区情况

" + "

${month},公司低电压涉及台区数量${tqIdTotalNum}个,其中存在受考核用户的台区${tqIdKaoheTotalNum}个,占比${tqIdKaoheTotalNumZB}%,其中${tqIdKaoheDesc}

" + "

表3-3 ${year}${month}公司低电压考核用户涉及台区情况统计

"; List> tableArray3 = new ArrayList>(); List tableArray3Title = new ArrayList(); tableArray3Title.add("单位"); tableArray3Title.add("管理的台区数"); tableArray3Title.add("存在低电压用户的台区数量"); tableArray3Title.add("存在受考核用户的台区"); tableArray3Title.add("受考核用户涉及台区占比"); tableArray3.add(tableArray3Title); String guanxiaHeji = "0"; for (PubApppar apppar : appparList) { guanxiaHeji = CommonUtil.add(guanxiaHeji, guanxiaTaiqu.get(apppar.getValue())); List tableArray3Gaoxin = new ArrayList(); tableArray3Gaoxin.add(apppar.getValue()); tableArray3Gaoxin.add(guanxiaTaiqu.get(apppar.getValue())); tableArray3.add(tableArray3Gaoxin); } List tableArray3Heji = new ArrayList(); tableArray3Heji.add("合计"); tableArray3Heji.add(guanxiaHeji); tableArray3.add(tableArray3Heji); List> tqIdList = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByTQID(param); String tqIdTotalNum = "0"; for (Map map : tqIdList) { String area = map.get("area"); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } int index = areaList.indexOf(area); List tableArray3Child = tableArray3.get(index + 1); tableArray3Child.add(num); tqIdTotalNum = CommonUtil.add(tqIdTotalNum, num); } tableArray3Heji.add(tqIdTotalNum); // 没有数据的补零 for (List child : tableArray3) { if (child.size() < 3) { child.add("0"); } } param.put("taiQuKaohe", "1"); String tqIdKaoheTotalNum = "0"; String tqIdKaoheDesc = ""; List> tqIdKaoheList = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByTQID(param); for (int i = 0; i < tqIdKaoheList.size(); i ++) { Map map = tqIdKaoheList.get(i); String area = map.get("area"); String num = map.get("num"); boolean flag = false; for (PubApppar apppar : appparList) { if (area.contains(apppar.getValue())) { area = apppar.getValue(); flag = true; } } if (!flag) { continue; } String guanxiaNum = null; String zb = null; int index = areaList.indexOf(area); List tableArray3Child = tableArray3.get(index + 1); tableArray3Child.add(num); guanxiaNum = tableArray3Child.get(1); zb = CommonUtil.multiply(CommonUtil.divide(num, guanxiaNum, 4), "100", 2); tableArray3Child.add(zb + "%"); tqIdKaoheTotalNum = CommonUtil.add(tqIdKaoheTotalNum, num); if (i != tqIdKaoheList.size() - 1) { tqIdKaoheDesc += area + num + "个,占比" + zb + "%,"; } else { tqIdKaoheDesc += area + num + "个,占比" + zb + "%。"; } } // 占比 String tqIdKaoheTotalNumZB = CommonUtil.multiply(CommonUtil.divide(tqIdKaoheTotalNum, guanxiaHeji, 4), "100", 2); tableArray3Heji.add(tqIdKaoheTotalNum); tableArray3Heji.add(tqIdKaoheTotalNumZB); // 没有数据的补零 for (List child : tableArray3) { if (child.size() < 5) { child.add("0"); child.add("0.00%"); } } String desc4 = "

(5)原因分析

" + "

按受考核低电压用户原因分:${ddyzymcDesc}${year}${month}公司受考核低电压用户原因分类情况统计见图表3-4。

" + "

图表3-4 ${year}${month}公司受考核低电压用户原因分类情况统计

"; List> tableArray4 = new ArrayList>(); List tableArray4Title = new ArrayList(); tableArray4Title.add("原因分类"); tableArray4Title.add("受考核低电压户数"); tableArray4Title.add("原因占比"); tableArray4.add(tableArray4Title); String ddyzymcNumTotal = "0"; List> ddyzymcList = db.getMybatisMapper(ReportServiceMapper.class).selectDdyFxbByDDYZYMC(param); for (Map map : ddyzymcList) { List child = new ArrayList(); child.add(map.get("ddyzymc")); child.add(map.get("num")); tableArray4.add(child); ddyzymcNumTotal = CommonUtil.add(ddyzymcNumTotal, map.get("num")); } String ddyzymcDesc = ""; List> tubiaoData2Data = new ArrayList>(); // 饼状图数据 for (int i = 1; i < tableArray4.size(); i ++) { List child = tableArray4.get(i); String zb = CommonUtil.multiply(CommonUtil.divide(child.get(1), ddyzymcNumTotal, 4), "100", 2) + "%"; child.add(zb); if (i != tableArray4.size() - 1) { ddyzymcDesc += child.get(0) + child.get(1) + "户,占比" + zb + ";"; } else { ddyzymcDesc += child.get(0) + child.get(1) + "户,占比" + zb + "。"; } // 饼状图数据 Map dataMap = new HashMap(); dataMap.put("name", child.get(0)); dataMap.put("value", Integer.parseInt(child.get(1))); tubiaoData2Data.add(dataMap); } List> tubiaoData2 = new ArrayList>(); Map tubiaoData2Map = new HashMap(); tubiaoData2Map.put("name", "受考核低电压用户原因"); tubiaoData2Map.put("type", "pie"); tubiaoData2Map.put("radius", "55%"); List centerList = new ArrayList(); centerList.add("50%"); centerList.add("60%"); tubiaoData2Map.put("center", centerList); tubiaoData2Map.put("data", tubiaoData2Data); Map emphasisMap = new HashMap(); Map itemStyle = new HashMap(); itemStyle.put("shadowBlur", 10); itemStyle.put("shadowOffsetX", 0); itemStyle.put("shadowColor", "rgba(1, 1, 0, 0.5)"); emphasisMap.put("itemStyle", itemStyle); tubiaoData2Map.put("emphasisMap", emphasisMap); tubiaoData2.add(tubiaoData2Map); Map dataMap = new HashMap(); dataMap.put("month", month); dataMap.put("year", year); dataMap.put("totalNum", totalNum); dataMap.put("totalNumZb", totalNumZb); dataMap.put("totalNumTB", totalNumTB); dataMap.put("totalNumHB", totalNumHB); dataMap.put("totalNumDetailDesc", totalNumDetailDesc); dataMap.put("kaoheNum", kaoheNum); dataMap.put("kaoheNumZb", kaoheNumZb); dataMap.put("kaoheNumHB", kaoheNumHB); dataMap.put("kaoheNumTB", kaoheNumTB); dataMap.put("kaoheAreaDesc", kaoheAreaDesc); dataMap.put("kaoheZlNum", kaoheZlNum); dataMap.put("kaoheZlNumLv", kaoheZlNumLv); dataMap.put("kaoheZlDesc", kaoheZlDesc); dataMap.put("ljtsGt15Desc", ljtsGt15Desc); dataMap.put("ljtsGt15", ljtsGt15); dataMap.put("ddyzymcDesc", ddyzymcDesc); dataMap.put("tqIdTotalNum", tqIdTotalNum); dataMap.put("tqIdKaoheTotalNum", tqIdKaoheTotalNum); dataMap.put("tqIdKaoheTotalNumZB", tqIdKaoheTotalNumZB); dataMap.put("tqIdKaoheDesc", tqIdKaoheDesc); resMap.put("dataMap", dataMap); resMap.put("desc1", desc1); resMap.put("tableArray1", tableArray1); resMap.put("tubiaoData1", tubiaoData1); resMap.put("areaList", areaList); resMap.put("desc2", desc2); resMap.put("desc3", desc3); resMap.put("desc4", desc4); resMap.put("tableArray2", tableArray2); resMap.put("tableArray3", tableArray3); resMap.put("tableArray4", tableArray4); resMap.put("tubiaoData2", tubiaoData2); return resMap; } /** * 计停非计停日报 * @param range * @param timeRange * @return * @throws MINBusinessException * @throws ParseException */ public Map reportTypeJTFJTRB(String range, String timeRange) throws MINBusinessException, ParseException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); Map param = new HashMap(); String beginTime = null; String endTime = null; range = range.replaceAll(" ", ""); String[] rangeArray = range.split("-"); timeRange = timeRange.replaceAll(" ", ""); if (CommonUtil.isEmpty(timeRange)) { beginTime = rangeArray[0] + "000000"; endTime = rangeArray[1] + "235959"; } else { String[] timeRangeArray = timeRange.split("-"); beginTime = rangeArray[0] + timeRangeArray[0]; endTime = rangeArray[1] + timeRangeArray[1]; } param.put("beginTime", beginTime); param.put("endTime", endTime); /** --计停--start--*/ //主线 DwFileDetail07Example example = new DwFileDetail07Example(); example.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("计停").andTriptypeLike("主线%"); List listZx = db.selectByExample(DwFileDetail07Mapper.class, example); //支线 DwFileDetail07Example example1 = new DwFileDetail07Example(); example1.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("计停").andTriptypeLike("支线%"); List listZx1 = db.selectByExample(DwFileDetail07Mapper.class, example1); String descStr ="

国网泰安供电公司供电服务指挥中心(配网调控中心)

工单日报("+beginTime.substring(0, 4)+"年"+beginTime.substring(4, 6)+"月"+beginTime.substring(6, 8)+"日)

一、当日直供区配网运行情况

"; descStr = descStr+ "

当日配网10kV主线计划停电"+listZx.size()+"项,支线计划停电"+listZx1.size()+"项,启动送电 项。因线路计停造成停电高压用户 户,停电低压用户 户。

"; descStr = descStr +""; if(listZx.size()>0 || listZx1.size()>0){ descStr = descStr +""; } for(int i=0;i"; } for(int i=0;i"; } descStr = descStr +"
设备名称管理单位停电高压用户数停电居民用户数执行情况
"+listZx.get(i).getDevice()+""+listZx.get(i).getUnit()+"
"+listZx1.get(i).getDevice()+""+listZx1.get(i).getUnit()+"
"; //非计停 //主线 DwFileDetail07Example fjtExample = new DwFileDetail07Example(); fjtExample.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("非计停").andTriptypeLike("主线%"); List listFjtZx = db.selectByExample(DwFileDetail07Mapper.class, fjtExample); //支线 DwFileDetail07Example fjtExample1 = new DwFileDetail07Example(); fjtExample1.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("非计停").andTriptypeLike("支线%"); List listFjtZx1 = db.selectByExample(DwFileDetail07Mapper.class, fjtExample1); descStr = descStr +"

当日配网10kV主线非计停"+listFjtZx.size()+"项,支线非计停"+listFjtZx1.size()+"项,因线路非计停造成停电高压用户 户,停电低压用户 户。

"; descStr = descStr +""; if(listFjtZx.size()>0 || listFjtZx1.size()>0){ descStr = descStr +""; } for(int i=0;i"; } for(int i=0;i"; } descStr = descStr +"
设备名称管理单位停电高压用户数停电居民用户数备注
"+listFjtZx.get(i).getDevice()+""+listFjtZx.get(i).getUnit()+"
"+listFjtZx1.get(i).getDevice()+""+listFjtZx1.get(i).getUnit()+"
"; //跳闸 //主线 DwFileDetail07Example tzExample = new DwFileDetail07Example(); tzExample.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("跳闸").andTriptypeLike("主线%"); List listTzZx = db.selectByExample(DwFileDetail07Mapper.class, tzExample); //支线 DwFileDetail07Example tzExample1 = new DwFileDetail07Example(); tzExample1.createCriteria().andTimeBetween(beginTime, endTime).andTypeEqualTo("跳闸").andTriptypeLike("支线%"); List listTzZx1 = db.selectByExample(DwFileDetail07Mapper.class, tzExample1); descStr = descStr +"

当日配网发生10kV主线跳闸"+listTzZx.size()+"条次,支线跳闸"+listTzZx1.size()+"条次。因线路跳闸无重合闸造成停电高压用户 户,停电低压用户 户。

"; descStr = descStr +""; if(listTzZx.size()>0 || listTzZx1.size()>0){ descStr = descStr +""; } for(int i=0;i"; } for(int i=0;i"; } descStr = descStr +"
设备名称管理单位故障原因重合情况停电高压用户数停电居民用户数
"+listTzZx.get(i).getDevice()+""+listTzZx.get(i).getUnit()+""+listTzZx.get(i).getCause()+""+listTzZx.get(i).getChzdzqk()+"
"+listTzZx1.get(i).getDevice()+""+listTzZx1.get(i).getUnit()+""+listTzZx1.get(i).getCause()+""+listTzZx1.get(i).getChzdzqk()+"
"; Map resMap = new HashMap(); // resMap.put("dataMap", dataMap); resMap.put("descStr", descStr); return resMap; } public List> reportTypeZDDTYBBII(String firstFileId, MINHttpServletRequestContext request) throws MINBusinessException, InvalidFormatException, IOException{ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class); List> resList = new ArrayList>(); List titleList = new ArrayList(); titleList.add("ID"); titleList.add("TNAME"); titleList.add("SRC"); resList.add(titleList); // 选择文件 DwReportData reportData = db.selectByPrimaryKey(DwReportDataMapper.class, firstFileId); String jsonArrayStr = reportData.getData(); JSONArray array = JSONArray.fromObject(jsonArrayStr); // 对比文件 // 获取文件 FileItem fileItem = request.getFile("file"); String fileName = fileItem.getName(); if (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls")) { throw new MINBusinessException("文件格式错误!"); } String[] titleKey = new String[]{"gdbh","gdlx","gdfqsj","hjmc", "bdzmc","xlmc","gddw","zrdw","zrbz","ywmc","zdsbscmc","jhtysj","xttysj"}; List> secondList = FilesUtil.readExecleasy(fileItem, titleKey, 1); for (Object first : array) { List child = (List)first; String tname = child.get(0); String id = child.get(1); boolean flag = false; for (Map second : secondList) { String zdsbscmc = second.get("zdsbscmc"); if (tname.equals(zdsbscmc)) { flag = true; break; } } if (!flag) { List resChildList = new ArrayList(); resChildList.add(id); resChildList.add(tname); resChildList.add("投运"); resList.add(resChildList); } } return resList; } public String getSystemCode() { return systemCode; } }