|
@@ -9,6 +9,7 @@ import org.jeecg.modules.dataCurrent.mapper.DataCurrentMapper;
|
|
|
import org.jeecg.modules.dataElectricity.mapper.DataElectricityMapper;
|
|
|
import org.jeecg.modules.dataPower.mapper.DataPowerMapper;
|
|
|
import org.jeecg.modules.dataVoltage.mapper.DataVoltageMapper;
|
|
|
+import org.jeecg.modules.elecfeeBase.entity.ElecfeeBase;
|
|
|
import org.jeecg.modules.elecfeeBase.mapper.ElecfeeBaseMapper;
|
|
|
import org.jeecg.modules.emsStatistics.entity.EmsStatistics;
|
|
|
import org.jeecg.modules.emsStatistics.mapper.EmsStatisticsMapper;
|
|
@@ -278,7 +279,37 @@ public class IEmsStatisticsServiceImpl implements IEmsStatisticsService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result<Object> DemandAnalysis(String spaceId, String beginTime, String endTime) {
|
|
|
- return null;
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ LambdaQueryWrapper<TpmEquipment> eq = new LambdaQueryWrapper<TpmEquipment>()
|
|
|
+ .eq(TpmEquipment::getSpaceid, spaceId)
|
|
|
+ .select(TpmEquipment::getId);
|
|
|
+ List<TpmEquipment> equipments = equipmentMapper.selectList(eq);
|
|
|
+ List<String> equipmentids = new ArrayList<>();
|
|
|
+ if (equipments != null && !equipments.isEmpty()) {
|
|
|
+ equipmentids = equipments.stream().map(TpmEquipment::getId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<String> months = DateUtils.MonthSplit(beginTime, endTime);
|
|
|
+ List<String> monthSplit = new ArrayList<>();
|
|
|
+ List<Double> mubiao = new ArrayList<>();
|
|
|
+ List<Float> shiji = new ArrayList<>();
|
|
|
+
|
|
|
+ // 循环遍历年月
|
|
|
+ for (String month : months) {
|
|
|
+ monthSplit.add(month.substring(5));
|
|
|
+
|
|
|
+ Float demand = 0f;
|
|
|
+ if (equipmentids.size() > 0) {
|
|
|
+ demand = emsStatisticsMapper.SelectMaxDmand(equipmentids, month);
|
|
|
+ }
|
|
|
+ shiji.add(demand == null ? 0f : demand);
|
|
|
+
|
|
|
+ ElecfeeBase elecfeeBase = elecfeeBaseMapper.selectDemandByYearmonth(month);
|
|
|
+ mubiao.add(elecfeeBase == null ? 0f : elecfeeBase.getKva());
|
|
|
+ }
|
|
|
+ map.put("monthsplit", monthSplit);
|
|
|
+ map.put("mubiao", mubiao);
|
|
|
+ map.put("shiji", shiji);
|
|
|
+ return Result.OK(map);
|
|
|
}
|
|
|
|
|
|
/**
|