|
@@ -10,8 +10,6 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import org.apache.poi.hssf.record.CommonObjectDataSubRecord;
|
|
|
-
|
|
|
import com.minpay.common.constant.Constant;
|
|
|
import com.minpay.common.service.IReportService;
|
|
|
import com.minpay.common.util.CommonUtil;
|
|
@@ -38,6 +36,7 @@ import com.minpay.db.table.model.PubApppar;
|
|
|
import com.minpay.db.table.model.PubAppparExample;
|
|
|
import com.minpay.db.table.own.mapper.ReportServiceMapper;
|
|
|
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;
|
|
@@ -141,21 +140,21 @@ public class ReportServiceImpl implements IReportService {
|
|
|
} else if (Constant.REPORT_TYPE_04.equals(reportTypeId)) {
|
|
|
List<List<String>> resList = reportTypeFADZBB(FADateRange, yearChoose);
|
|
|
resMap.put("resList", resList);
|
|
|
- //低电压分析表
|
|
|
+ // 低电压分析表
|
|
|
} else if (Constant.REPORT_TYPE_05.equals(reportTypeId)){
|
|
|
- List<List<String>> resList = reportTypeDDYZLFXB(range, reportTypeId);
|
|
|
- resMap.put("resList", resList);
|
|
|
- //低电压日报
|
|
|
+ return reportTypeDDYZLFXB(range, reportTypeId, 1, 100);
|
|
|
+ // 低电压日报
|
|
|
} else if (Constant.REPORT_TYPE_06.equals(reportTypeId)){
|
|
|
List<List<String>> resList = reportTypeDDYRB(DdyDateRange,yearChoose,range, reportTypeId);
|
|
|
resMap.put("resList", resList);
|
|
|
- //过电压分析表
|
|
|
+ // 过电压分析表
|
|
|
} else if (Constant.REPORT_TYPE_07.equals(reportTypeId)){
|
|
|
List<List<String>> 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<List<String>> resList = reportTypeDDYWZL(ddyFxbId);
|
|
|
resMap.put("resList", resList);
|
|
@@ -163,8 +162,13 @@ public class ReportServiceImpl implements IReportService {
|
|
|
} else if (Constant.REPORT_TYPE_10.equals(reportTypeId)) {
|
|
|
List<List<String>> resList = reportTypeDDYZRXZ(ddyFxbId);
|
|
|
resMap.put("resList", resList);
|
|
|
+ // 低电压昨日新增
|
|
|
} else if (Constant.REPORT_TYPE_11.equals(reportTypeId)) {
|
|
|
return reportTypeDDYZB(yearChoose, monthChoose, range);
|
|
|
+ // 低电压超30天
|
|
|
+ } else if (Constant.REPORT_TYPE_12.equals(reportTypeId)) {
|
|
|
+ List<List<String>> resList = reportTypeDDY30T(ddyFxbId);
|
|
|
+ resMap.put("resList", resList);
|
|
|
}
|
|
|
return resMap;
|
|
|
}
|
|
@@ -1426,10 +1430,19 @@ public class ReportServiceImpl implements IReportService {
|
|
|
* @return
|
|
|
* @throws MINBusinessException
|
|
|
* @throws ParseException
|
|
|
+ * @throws InvocationTargetException
|
|
|
+ * @throws IllegalArgumentException
|
|
|
+ * @throws IllegalAccessException
|
|
|
+ * @throws SecurityException
|
|
|
+ * @throws NoSuchMethodException
|
|
|
*/
|
|
|
- public List<List<String>> reportTypeDDYZLFXB(String range, String reportTypeId) throws MINBusinessException, ParseException{
|
|
|
+ public Map<String, Object> reportTypeDDYZLFXB(String range, String reportTypeId, int page, int limit) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
|
|
|
+ Map<String, Object> resMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
|
|
|
List<List<String>> resList = new ArrayList<List<String>>();
|
|
|
+ resMap.put("resList", resList);
|
|
|
+
|
|
|
List<String> titleList = new ArrayList<String>();
|
|
|
titleList.add("序号");
|
|
|
titleList.add("县公司名称");
|
|
@@ -1447,6 +1460,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
titleList.add("治理完成时间");
|
|
|
titleList.add("是否消除");
|
|
|
titleList.add("昨日新增");
|
|
|
+ titleList.add("全年累计天数");
|
|
|
range = range.replaceAll(" ", "");
|
|
|
String[] rangeArray = range.split("-");
|
|
|
String beginTime = rangeArray[0];
|
|
@@ -1466,21 +1480,37 @@ public class ReportServiceImpl implements IReportService {
|
|
|
//子类数据
|
|
|
resList.add(titleList);
|
|
|
//查询累计天数以及累计时长
|
|
|
- Map<String, String> param = new HashMap<String, String>();
|
|
|
+ Map<String, Object> param = new HashMap<String, Object>();
|
|
|
param.put("beginTime", beginTime);
|
|
|
param.put("endTime", endTime);
|
|
|
- List<Map<String, String>> DDYZLFXBList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param);
|
|
|
|
|
|
+ // 分析表数据过大,分页处理
|
|
|
+ MINRowBounds rows = new MINRowBounds(page, limit);
|
|
|
+ rows.setSeparateSql(true);
|
|
|
+
|
|
|
+ List<Map<String, String>> DDYZLFXBList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, rows);
|
|
|
+
|
|
|
+ resMap.put("resList", resList);
|
|
|
+ resMap.put("count", rows.getCount());
|
|
|
+
|
|
|
+ List<String> yhidList = CommonUtil.getIdFromList(DDYZLFXBList, "yhid");
|
|
|
DwFileDetail03Example example03 = new DwFileDetail03Example();
|
|
|
- example03.createCriteria().andSjrqBetween(beginTime, endTime);
|
|
|
+ example03.createCriteria().andSjrqBetween(beginTime, endTime).andYhidIn(yhidList);
|
|
|
example03.setOrderByClause("DFD3_YHID,DFD3_SJRQ desc");
|
|
|
List<DwFileDetail03> 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<Map<String, String>> yearDataList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYZLFXB(param, new MINRowBounds());
|
|
|
+
|
|
|
int a = 0;
|
|
|
for(Map<String, String> map :DDYZLFXBList){
|
|
|
List<String> childList = Arrays.asList(new String[titleList.size()]);
|
|
|
- String dysc = String.format("%.0f",map.get("dysc"));
|
|
|
- String ljts = String.format("%.0f",map.get("ljts"));
|
|
|
+ String dysc = map.get("dysc");
|
|
|
+ String ljts = map.get("ljts");
|
|
|
a++;
|
|
|
childList.set(0, a+"");
|
|
|
childList.set(1, map.get("xgsmc"));
|
|
@@ -1524,7 +1554,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
}
|
|
|
|
|
|
int index = DateUtil.diffDate(sjrq, endTime);
|
|
|
- childList.set(16 + index, detailList.get(i).getDysc());
|
|
|
+ childList.set(17 + index, detailList.get(i).getDysc());
|
|
|
|
|
|
// 获取昨日时长
|
|
|
if (index == 0) {
|
|
@@ -1543,6 +1573,15 @@ public class ReportServiceImpl implements IReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 获取全年数
|
|
|
+ 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, "是");
|
|
@@ -1553,7 +1592,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
resList.add(childList);
|
|
|
}
|
|
|
|
|
|
- return resList;
|
|
|
+ return resMap;
|
|
|
}
|
|
|
/**
|
|
|
* 低电压日报
|
|
@@ -2173,7 +2212,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
resList.add(titleList);
|
|
|
|
|
|
DwDdyFxbExample ddyFxbExample = new DwDdyFxbExample();
|
|
|
- ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andSfxcNotEqualTo("是").andDdysjGreaterThanOrEqualTo("48");
|
|
|
+ ddyFxbExample.createCriteria().andReportIdEqualTo(ddyFxbId).andSfxcNotEqualTo("是").andDdysjGreaterThanOrEqualTo(48);
|
|
|
ddyFxbExample.setOrderByClause("DDF_ID");
|
|
|
List<DwDdyFxb> ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample);
|
|
|
|
|
@@ -2196,8 +2235,8 @@ public class ReportServiceImpl implements IReportService {
|
|
|
childList.set(4, ddyFxb.getTqid());
|
|
|
childList.set(5, ddyFxb.getByqmc());
|
|
|
childList.set(6, ddyFxb.getYhbh());
|
|
|
- childList.set(7, ddyFxb.getDdysj());
|
|
|
- childList.set(8, ddyFxb.getLjts());
|
|
|
+ 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());
|
|
@@ -2287,8 +2326,8 @@ public class ReportServiceImpl implements IReportService {
|
|
|
childList.set(4, ddyFxb.getTqid());
|
|
|
childList.set(5, ddyFxb.getByqmc());
|
|
|
childList.set(6, ddyFxb.getYhbh());
|
|
|
- childList.set(7, ddyFxb.getDdysj());
|
|
|
- childList.set(8, ddyFxb.getLjts());
|
|
|
+ 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());
|
|
@@ -2587,4 +2626,109 @@ public class ReportServiceImpl implements IReportService {
|
|
|
|
|
|
return resMap;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 低电压超30天
|
|
|
+ * @param ddyFxbId
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ * @throws ParseException
|
|
|
+ * @throws NoSuchMethodException
|
|
|
+ * @throws SecurityException
|
|
|
+ * @throws IllegalAccessException
|
|
|
+ * @throws IllegalArgumentException
|
|
|
+ * @throws InvocationTargetException
|
|
|
+ */
|
|
|
+ private List<List<String>> 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<List<String>> resList = new ArrayList<List<String>>();
|
|
|
+
|
|
|
+ List<String> titleList = new ArrayList<String>();
|
|
|
+ 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<String> dateList = new ArrayList<String>();
|
|
|
+ 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<DwDdyFxb> ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample);
|
|
|
+
|
|
|
+ List<String> 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<DwDdyFxbDetail> detailList = db.selectByExample(DwDdyFxbDetailMapper.class, ddyFxbDetailExample);
|
|
|
+
|
|
|
+ for (DwDdyFxb ddyFxb : ddyFxbList) {
|
|
|
+ List<String> 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;
|
|
|
+ }
|
|
|
}
|