|
@@ -133,55 +133,19 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
|
|
|
return deviceStatiscsModelMongodbList;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public JSONObject queryFpgDataByLeanModelCode(String leanModelCode) {
|
|
|
-
|
|
|
- JSONObject result = new JSONObject();
|
|
|
-
|
|
|
- List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = queryByTimeRanges(mongoTemplate, leanModelCode, null, null, null, null, null);
|
|
|
- if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)){
|
|
|
- log.info("{}{}", "mongo数据查询为空,峰平谷模型报表导出失败!", leanModelCode);
|
|
|
- result.put("data", new ArrayList<>());
|
|
|
- return result;
|
|
|
- }
|
|
|
- List<String> deviceInformationIds = fpgStatiscsModelDataList.stream().map(DeviceStatiscsModelMongodb::getDeviceInformationId).collect(Collectors.toList());
|
|
|
- LambdaQueryWrapper<DeviceInformation> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(DeviceInformation::getId, deviceInformationIds);
|
|
|
- List<DeviceInformation> deviceInformationList = deviceInformationMapper.selectList(queryWrapper);
|
|
|
- // 将listA转换为以(设备Id, 区域Id)为键的Map
|
|
|
- Map<String, DeviceInformation> mapA = deviceInformationList.stream()
|
|
|
- .collect(Collectors.toMap(a -> a.getId() + "_" + a.getDeviceRegionId(), a -> a));
|
|
|
-
|
|
|
- // 遍历listB,根据相同的(设备Id, 区域Id)与mapA中的对象合并成新的ModelResult并添加到新列表
|
|
|
- List<ModelReportFormResult> combinedList = fpgStatiscsModelDataList.stream()
|
|
|
- .map(b -> {
|
|
|
- String key = b.getDeviceInformationId() + "_" + b.getDeviceRegionId();
|
|
|
- DeviceInformation a = mapA.get(key);
|
|
|
- if (a != null) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String dateString = sdf.format(b.getCreateTime());
|
|
|
- return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
|
|
|
- b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
|
|
|
- b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
|
|
|
- b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
|
|
|
- b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString);
|
|
|
- }
|
|
|
- return null;
|
|
|
- }).filter(x -> x != null).collect(Collectors.toList());
|
|
|
-
|
|
|
- JSONArray jArray = JSON.parseArray(JSON.toJSONString(combinedList));
|
|
|
- result.put("data", jArray);
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 龙钢峰平谷积木报表导出逻辑处理
|
|
|
+ * @param leanModelCode
|
|
|
+ * @return JSONObject
|
|
|
+ */
|
|
|
@Override
|
|
|
public JSONObject queryFpgPowerDataByLeanModelCode(String leanModelCode) {
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = queryByTimeRanges(mongoTemplate, leanModelCode, null, null, null, null, null);
|
|
|
if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)){
|
|
|
- log.info("{}{}", "mongo数据查询为空,峰平谷功率报表导出失败!", leanModelCode);
|
|
|
- result.put("data", new ArrayList<>());
|
|
|
+ log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", leanModelCode);
|
|
|
+ result.put("data", new JSONArray());
|
|
|
return result;
|
|
|
}
|
|
|
List<String> deviceInformationIds = fpgStatiscsModelDataList.stream().map(DeviceStatiscsModelMongodb::getDeviceInformationId).collect(Collectors.toList());
|
|
@@ -208,13 +172,28 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
|
|
|
}
|
|
|
return null;
|
|
|
}).filter(x -> x != null).collect(Collectors.toList());
|
|
|
- List<ModelDataResult> modelDataResults = generateModelDataResults(combinedList);
|
|
|
- JSONArray jArray = JSON.parseArray(JSON.toJSONString(modelDataResults));
|
|
|
- result.put("data", jArray);
|
|
|
+ JSONArray jsonResult = new JSONArray();
|
|
|
+ if ("total_day_eu_report".equals(leanModelCode)){
|
|
|
+ // 总用电量报表
|
|
|
+ List<ModelDataResult> modelDataResults = generateModelDataResults(combinedList);
|
|
|
+ jsonResult = JSON.parseArray(JSON.toJSONString(modelDataResults));
|
|
|
+ } else if ("total_day_ec_report".equals(leanModelCode)) {
|
|
|
+ // 峰平谷用电控制日报报表
|
|
|
+ jsonResult = JSON.parseArray(JSON.toJSONString(combinedList));
|
|
|
+ }else if ("total_day_dn_report".equals(leanModelCode)) {
|
|
|
+ // 线路峰平谷日报
|
|
|
+ jsonResult = JSON.parseArray(JSON.toJSONString(combinedList));
|
|
|
+ }else if ("total_day_ds_report".equals(leanModelCode)) {
|
|
|
+ // 谷峰差统计报表
|
|
|
+ jsonResult = JSON.parseArray(JSON.toJSONString(combinedList));
|
|
|
+ }else if ("total_day_wp_report".equals(leanModelCode)) {
|
|
|
+ // 龙钢变各工序报表
|
|
|
+ jsonResult = JSON.parseArray(JSON.toJSONString(combinedList));
|
|
|
+ }
|
|
|
+ result.put("data", jsonResult);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 基于模型编码、采集点ID、设备ID、区域ID、峰平谷配置时间范围 动态查询mongoDB
|
|
|
* @param mongoTemplate
|