|
|
|
@ -3,9 +3,11 @@ package com.op.energy.report.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.energy.base.domain.BaseBuildInfo;
|
|
|
|
|
import com.op.energy.base.domain.BaseBusinessType;
|
|
|
|
|
import com.op.energy.base.domain.BaseMonitorInfo;
|
|
|
|
|
import com.op.energy.base.domain.BaseTypeRelation;
|
|
|
|
|
import com.op.energy.base.mapper.BaseBuildInfoMapper;
|
|
|
|
|
import com.op.energy.base.mapper.BaseBusinessTypeMapper;
|
|
|
|
|
import com.op.energy.base.mapper.BaseTypeRelationMapper;
|
|
|
|
|
import com.op.energy.base.service.IBaseMonitorInfoService;
|
|
|
|
|
import com.op.energy.base.utils.DateUtils;
|
|
|
|
@ -53,6 +55,9 @@ public class EnergyPreviewServiceImpl implements IEnergyPreviewService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private BaseBuildInfoMapper baseBuildInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private BaseBusinessTypeMapper baseBusinessTypeMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RecordDnbInstantMapper recordDnbInstantMapper;
|
|
|
|
|
|
|
|
|
@ -810,6 +815,7 @@ public class EnergyPreviewServiceImpl implements IEnergyPreviewService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 产品单耗对比
|
|
|
|
|
*
|
|
|
|
|
* @param energyDTO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -841,4 +847,93 @@ public class EnergyPreviewServiceImpl implements IEnergyPreviewService {
|
|
|
|
|
result.put("data", dataMap);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 业态能耗分析
|
|
|
|
|
*
|
|
|
|
|
* @param paramMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public Map<String, Object> businessEnergyConsumptionAnalysis(Map paramMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
List<HashMap<String, String>> tableList = new ArrayList<>();
|
|
|
|
|
List<String> electricityList = new ArrayList<>();
|
|
|
|
|
HashMap<String, BigDecimal> pieMap = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
|
|
if (!paramMap.containsKey("type") || !paramMap.containsKey("energyType") ||
|
|
|
|
|
String.valueOf(paramMap.get("startTime")).equals("") || String.valueOf(paramMap.get("endTime")).equals("")) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
String energyType = String.valueOf(paramMap.get("energyType"));
|
|
|
|
|
//小时 天 月 年
|
|
|
|
|
String type = String.valueOf(paramMap.get("type"));
|
|
|
|
|
if (!paramMap.containsKey("businessId")) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
Long businessId = Long.valueOf(String.valueOf(paramMap.get("businessId")));
|
|
|
|
|
|
|
|
|
|
BaseBusinessType businessType = new BaseBusinessType();
|
|
|
|
|
businessType.setParentId(businessId);
|
|
|
|
|
List<BaseBusinessType> businessTypeList = baseBusinessTypeMapper.selectBaseBusinessTypeList(businessType);
|
|
|
|
|
// BaseBusinessType baseBusinessType = baseBusinessTypeMapper.selectBaseBusinessTypeByObjid(businessId);
|
|
|
|
|
BigDecimal totalExpend = BigDecimal.ZERO;
|
|
|
|
|
for (BaseBusinessType business : businessTypeList) {
|
|
|
|
|
Long objId = business.getObjid();
|
|
|
|
|
String businessName = business.getBusinessName();
|
|
|
|
|
BaseTypeRelation relation = new BaseTypeRelation();
|
|
|
|
|
relation.setType(1L);
|
|
|
|
|
relation.setRelationId(objId);
|
|
|
|
|
List<BaseTypeRelation> baseTypeRelations = baseTypeRelationMapper.selectBaseTypeRelationList(relation);
|
|
|
|
|
List<String> monitorIdList = baseTypeRelations.stream().map(BaseTypeRelation::getMonitorId).collect(Collectors.toList());
|
|
|
|
|
electricityList.addAll(monitorIdList);
|
|
|
|
|
paramMap.put("monitorIdList", monitorIdList);
|
|
|
|
|
if (energyType.equals("2") && !monitorIdList.isEmpty()) {
|
|
|
|
|
ReportPointDnb pointDnb = new ReportPointDnb();
|
|
|
|
|
pointDnb.setParams(paramMap);
|
|
|
|
|
List<ReportPointDnb> pointDnbList = reportPointDnbMapper.selectPointDnbGroupList(pointDnb);
|
|
|
|
|
for (ReportPointDnb reportPointDnb : pointDnbList) {
|
|
|
|
|
BigDecimal expend = reportPointDnb.getExpend();
|
|
|
|
|
HashMap<String, String> tableMap = new HashMap<>();
|
|
|
|
|
tableMap.put("monitorId", reportPointDnb.getMonitorId());
|
|
|
|
|
tableMap.put("monitorName", reportPointDnb.getMonitorName());
|
|
|
|
|
tableMap.put("businessName", businessName);
|
|
|
|
|
tableMap.put("expend", expend.toPlainString());
|
|
|
|
|
tableList.add(tableMap);
|
|
|
|
|
pieMap.put(businessName,pieMap.containsKey(businessName) ? expend.add(pieMap.get(businessName)) : expend);
|
|
|
|
|
// 累加到总和中
|
|
|
|
|
totalExpend = totalExpend.add(expend);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReportPointDnb lineDnb = new ReportPointDnb();
|
|
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
|
|
if (type.equals("day")) {
|
|
|
|
|
params.put("timeSub", 10);
|
|
|
|
|
} else if (type.equals("month")) {
|
|
|
|
|
params.put("timeSub", 7);
|
|
|
|
|
} else if (type.equals("year")) {
|
|
|
|
|
params.put("timeSub", 4);
|
|
|
|
|
}
|
|
|
|
|
params.put("startTime", paramMap.get("startTime"));
|
|
|
|
|
params.put("endTime", paramMap.get("endTime"));
|
|
|
|
|
params.put("monitorIdList", electricityList);
|
|
|
|
|
lineDnb.setParams(params);
|
|
|
|
|
if (electricityList.size() > 0) {
|
|
|
|
|
List<Map<String, String>> lineDnbList = reportPointDnbMapper.datePointDnbGroupList(lineDnb);
|
|
|
|
|
result.put("lineDnbList", lineDnbList);
|
|
|
|
|
} else {
|
|
|
|
|
result.put("lineDnbList", new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
result.put("pieMap", pieMap);
|
|
|
|
|
HashMap<String, String> tableMap = new HashMap<>();
|
|
|
|
|
tableMap.put("businessName", "总用电量");
|
|
|
|
|
tableMap.put("expend", totalExpend.toPlainString());
|
|
|
|
|
tableList.add(tableMap);
|
|
|
|
|
result.put("tableList", tableList);
|
|
|
|
|
result.put("totalExpend", totalExpend.toPlainString());
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|