Browse Source

#电量报表增加合计

zhongwei
yang_shj 3 months ago
parent
commit
1b4dc39c86
  1. 88
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

88
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -279,9 +279,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据设备分组
@ -290,7 +290,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(key + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
@ -321,6 +321,13 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
// 年
@ -383,6 +390,13 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
return result;
@ -428,9 +442,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据区域分组
@ -446,7 +460,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(area.getDeptName() + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
result.put("tableHead",tableHeads);
@ -484,6 +498,13 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}else if(type == 2){
@ -503,9 +524,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据设备分组
@ -521,7 +542,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(area.getDeptName() + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
result.put("tableHead",tableHeads);
@ -559,6 +580,13 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
return result;
@ -602,9 +630,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据设备分组
@ -612,7 +640,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(device.getName() + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
result.put("tableHead",tableHeads);
@ -641,6 +669,14 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
// 总计
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
// 月
@ -661,9 +697,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据设备分组
@ -672,7 +708,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(key + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
@ -703,6 +739,14 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
// 总计
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
// 年
@ -723,9 +767,9 @@ public class ElectricReportServiceImpl implements IElectricReportService {
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("总计发电量");
secondHead.setTableName("总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("总有功","总无功"));
secondHead.setChildren(Arrays.asList("总有功","总无功"));
tableHeads.add(secondHead);
// 根据设备分组
@ -734,7 +778,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(key + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHead.setChildren(Arrays.asList("有功","无功"));
tableHeads.add(tableHead);
});
@ -765,6 +809,14 @@ public class ElectricReportServiceImpl implements IElectricReportService {
start = calendar.getTime();
tableDate.add(item);
}
// 总计
List<Object> item = new ArrayList<>();
item.add("合计");
for(int i = 1 ; i < tableDate.get(0).size() ; i++){
int index = i;
item.add(tableDate.stream().mapToDouble(o-> Double.parseDouble(o.get(index).toString())).sum());
}
tableDate.add(item);
result.put("tableDate",tableDate);
}
return result;

Loading…
Cancel
Save