供电和供水实时数据
This commit is contained in:
parent
5ffeb9891c
commit
25f745c2d3
@ -248,68 +248,96 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||||
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||||
List<HashMap<Object, Object>> list = new ArrayList<>();
|
List<HashMap<Object, Object>> list = new ArrayList<>();
|
||||||
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(taiyangnengIds));
|
||||||
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
if(cache != null){
|
||||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
|
||||||
setSerialNumber(taiyangnengDevice.getSerialNumber());
|
if(checkedData != null){
|
||||||
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
|
||||||
setEndTime(DateUtil.endOfDay(dateTime).toString());
|
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
|
||||||
}});
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
|
||||||
Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator
|
continue;
|
||||||
.comparing(DeviceLog::getCreateTime, Comparator
|
}
|
||||||
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
|
||||||
for (ThingsModel thingsModel : taiyangnengModels) {
|
|
||||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
put("upType", 0);
|
put("upType", 0);
|
||||||
put("identifier", thingsModel.getIdentifier());
|
put("identifier", haiWeiPropertyVo.getNameEn());
|
||||||
put("unit", "");
|
put("unit", haiWeiPropertyVo.getUnit());
|
||||||
put("value", 0);
|
put("value", haiWeiPropertyVo.getValue());
|
||||||
put("name", thingsModel.getModelName());
|
put("name", haiWeiPropertyVo.getNameCn());
|
||||||
}};
|
}};
|
||||||
if (StringUtils.isNotEmpty(thingsModel.getSpecs())) {
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_MpptDown")){
|
||||||
String specs = thingsModel.getSpecs();
|
hashMap.put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?
|
||||||
JSONObject parse = (JSONObject) JSON.parse(specs);
|
"异常":"正常");
|
||||||
if (parse.containsKey("unit")) {
|
|
||||||
hashMap.put("unit", parse.get("unit"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hashMap.size() > 1) {
|
|
||||||
List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
|
||||||
if (deviceLogs1 != null) {
|
|
||||||
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
|
|
||||||
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
|
||||||
hashMap.put("upType", 1);
|
|
||||||
} else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
|
||||||
hashMap.put("upType", -1);
|
|
||||||
}
|
|
||||||
hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
|
||||||
} else {
|
|
||||||
hashMap.put("value", "--");
|
|
||||||
hashMap.put("upType", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (hashMap.size() > 0) {
|
|
||||||
List<DeviceLog> deviceLogs2 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
|
||||||
if (deviceLogs2 != null) {
|
|
||||||
hashMap.put("value", deviceLogs2.get(0).getLogValue());
|
|
||||||
}
|
}
|
||||||
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_市电状态")){
|
||||||
|
hashMap.put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?
|
||||||
|
"市电":"太阳能");
|
||||||
}
|
}
|
||||||
list.add(hashMap);
|
list.add(hashMap);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (ThingsModel thingsModel : taiyangnengModels) {
|
|
||||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
|
||||||
put("upType", 0);
|
|
||||||
put("identifier", thingsModel.getIdentifier());
|
|
||||||
put("unit", "");
|
|
||||||
put("value", 0);
|
|
||||||
put("name", thingsModel.getModelName());
|
|
||||||
}};
|
|
||||||
list.add(hashMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
||||||
|
// Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
||||||
|
// List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||||
|
// setSerialNumber(taiyangnengDevice.getSerialNumber());
|
||||||
|
// setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
||||||
|
// setEndTime(DateUtil.endOfDay(dateTime).toString());
|
||||||
|
// }});
|
||||||
|
// Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator
|
||||||
|
// .comparing(DeviceLog::getCreateTime, Comparator
|
||||||
|
// .nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
||||||
|
// for (ThingsModel thingsModel : taiyangnengModels) {
|
||||||
|
// HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
// put("upType", 0);
|
||||||
|
// put("identifier", thingsModel.getIdentifier());
|
||||||
|
// put("unit", "");
|
||||||
|
// put("value", 0);
|
||||||
|
// put("name", thingsModel.getModelName());
|
||||||
|
// }};
|
||||||
|
// if (StringUtils.isNotEmpty(thingsModel.getSpecs())) {
|
||||||
|
// String specs = thingsModel.getSpecs();
|
||||||
|
// JSONObject parse = (JSONObject) JSON.parse(specs);
|
||||||
|
// if (parse.containsKey("unit")) {
|
||||||
|
// hashMap.put("unit", parse.get("unit"));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (hashMap.size() > 1) {
|
||||||
|
// List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
// if (deviceLogs1 != null) {
|
||||||
|
// if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
|
||||||
|
// if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
// hashMap.put("upType", 1);
|
||||||
|
// } else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
// hashMap.put("upType", -1);
|
||||||
|
// }
|
||||||
|
// hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
||||||
|
// } else {
|
||||||
|
// hashMap.put("value", "--");
|
||||||
|
// hashMap.put("upType", 0);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } else if (hashMap.size() > 0) {
|
||||||
|
// List<DeviceLog> deviceLogs2 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
// if (deviceLogs2 != null) {
|
||||||
|
// hashMap.put("value", deviceLogs2.get(0).getLogValue());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// list.add(hashMap);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// for (ThingsModel thingsModel : taiyangnengModels) {
|
||||||
|
// HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
// put("upType", 0);
|
||||||
|
// put("identifier", thingsModel.getIdentifier());
|
||||||
|
// put("unit", "");
|
||||||
|
// put("value", 0);
|
||||||
|
// put("name", thingsModel.getModelName());
|
||||||
|
// }};
|
||||||
|
// list.add(hashMap);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,68 +360,100 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel1);
|
List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||||
liuliangModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
liuliangModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||||
List<HashMap<Object, Object>> list = new ArrayList<>();
|
List<HashMap<Object, Object>> list = new ArrayList<>();
|
||||||
if (StringUtils.isNotEmpty(liuliangIds)) {
|
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(liuliangIds));
|
||||||
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(liuliangIds));
|
if(cache != null){
|
||||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
|
||||||
setSerialNumber(taiyangnengDevice.getSerialNumber());
|
if(checkedData != null){
|
||||||
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
|
||||||
setEndTime(DateUtil.endOfDay(dateTime).toString());
|
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
|
||||||
}});
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
|
||||||
Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator
|
continue;
|
||||||
.comparing(DeviceLog::getCreateTime, Comparator
|
}
|
||||||
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
|
||||||
for (ThingsModel thingsModel : liuliangModels) {
|
|
||||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
put("upType", 0);
|
put("upType", 0);
|
||||||
put("identifier", thingsModel.getIdentifier());
|
put("identifier", haiWeiPropertyVo.getNameEn());
|
||||||
put("unit", "");
|
put("unit", haiWeiPropertyVo.getUnit());
|
||||||
put("value", 0);
|
put("value", haiWeiPropertyVo.getValue());
|
||||||
put("name", thingsModel.getModelName());
|
put("name", haiWeiPropertyVo.getNameCn());
|
||||||
}};
|
}};
|
||||||
if (StringUtils.isNotEmpty(thingsModel.getSpecs())) {
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_guanxian")){
|
||||||
String specs = thingsModel.getSpecs();
|
hashMap.put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?
|
||||||
JSONObject parse = (JSONObject) JSON.parse(specs);
|
"关闭":"开启");
|
||||||
if (parse.containsKey("unit")) {
|
|
||||||
hashMap.put("unit", parse.get("unit"));
|
|
||||||
}
|
}
|
||||||
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_FlowDown")){
|
||||||
|
hashMap.put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?
|
||||||
|
"异常":"正常");
|
||||||
}
|
}
|
||||||
|
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_mCon")){
|
||||||
if (hashMap.size() > 1) {
|
hashMap.put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?
|
||||||
List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
"异常":"正常");
|
||||||
if (deviceLogs1 != null) {
|
|
||||||
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
|
|
||||||
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
|
||||||
hashMap.put("upType", 1);
|
|
||||||
} else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
|
||||||
hashMap.put("upType", -1);
|
|
||||||
}
|
|
||||||
hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
|
||||||
} else {
|
|
||||||
hashMap.put("value", "--");
|
|
||||||
hashMap.put("upType", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (hashMap.size() > 0) {
|
|
||||||
List<DeviceLog> deviceLogs2 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
|
||||||
if (deviceLogs2 != null) {
|
|
||||||
hashMap.put("value", deviceLogs2.get(0).getLogValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
list.add(hashMap);
|
list.add(hashMap);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (ThingsModel thingsModel : liuliangModels) {
|
|
||||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
|
||||||
put("upType", 0);
|
|
||||||
put("identifier", thingsModel.getIdentifier());
|
|
||||||
put("unit", "");
|
|
||||||
put("value", 0);
|
|
||||||
put("name", thingsModel.getModelName());
|
|
||||||
}};
|
|
||||||
list.add(hashMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if (StringUtils.isNotEmpty(liuliangIds)) {
|
||||||
|
// Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(liuliangIds));
|
||||||
|
// List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||||
|
// setSerialNumber(taiyangnengDevice.getSerialNumber());
|
||||||
|
// setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
||||||
|
// setEndTime(DateUtil.endOfDay(dateTime).toString());
|
||||||
|
// }});
|
||||||
|
// Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator
|
||||||
|
// .comparing(DeviceLog::getCreateTime, Comparator
|
||||||
|
// .nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
||||||
|
// for (ThingsModel thingsModel : liuliangModels) {
|
||||||
|
// HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
// put("upType", 0);
|
||||||
|
// put("identifier", thingsModel.getIdentifier());
|
||||||
|
// put("unit", "");
|
||||||
|
// put("value", 0);
|
||||||
|
// put("name", thingsModel.getModelName());
|
||||||
|
// }};
|
||||||
|
// if (StringUtils.isNotEmpty(thingsModel.getSpecs())) {
|
||||||
|
// String specs = thingsModel.getSpecs();
|
||||||
|
// JSONObject parse = (JSONObject) JSON.parse(specs);
|
||||||
|
// if (parse.containsKey("unit")) {
|
||||||
|
// hashMap.put("unit", parse.get("unit"));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (hashMap.size() > 1) {
|
||||||
|
// List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
// if (deviceLogs1 != null) {
|
||||||
|
// if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
|
||||||
|
// if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
// hashMap.put("upType", 1);
|
||||||
|
// } else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
// hashMap.put("upType", -1);
|
||||||
|
// }
|
||||||
|
// hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
||||||
|
// } else {
|
||||||
|
// hashMap.put("value", "--");
|
||||||
|
// hashMap.put("upType", 0);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } else if (hashMap.size() > 0) {
|
||||||
|
// List<DeviceLog> deviceLogs2 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
// if (deviceLogs2 != null) {
|
||||||
|
// hashMap.put("value", deviceLogs2.get(0).getLogValue());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// list.add(hashMap);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// for (ThingsModel thingsModel : liuliangModels) {
|
||||||
|
// HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
// put("upType", 0);
|
||||||
|
// put("identifier", thingsModel.getIdentifier());
|
||||||
|
// put("unit", "");
|
||||||
|
// put("value", 0);
|
||||||
|
// put("name", thingsModel.getModelName());
|
||||||
|
// }};
|
||||||
|
// list.add(hashMap);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user