1/device/detail/gongdianChart。供电图表数据需修复

2/地图实时数据接口优化
This commit is contained in:
wyw 2024-09-13 19:37:41 +08:00
parent a29e547c4e
commit 9213e44988
4 changed files with 279 additions and 208 deletions

View File

@ -113,7 +113,8 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
if (taiyangnengIds == null) { if (taiyangnengIds == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
ArrayList<Object> deviceLogAllCurves = iDeviceService.getDeviceLogAllCurves(Long.parseLong(taiyangnengIds), queryLogVo.getStartTime(), queryLogVo.getEndTime()); ArrayList<Object> deviceLogAllCurves =
iDeviceService.getDeviceLogAllCurves(Long.parseLong(taiyangnengIds), queryLogVo.getStartTime(), queryLogVo.getEndTime());
return deviceLogAllCurves; return deviceLogAllCurves;
} }

View File

@ -131,93 +131,118 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1); List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder)); taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
if (StringUtils.isNotEmpty(taiyangnengIds)) { if (StringUtils.isNotEmpty(taiyangnengIds)) {
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds)); // Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{ CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(taiyangnengIds));
setSerialNumber(taiyangnengDevice.getSerialNumber()); if(cache != null){
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString()); HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
setEndTime(DateUtil.endOfDay(dateTime).toString()); if(checkedData != null){
}}); List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
.comparing(DeviceLog::getCreateTime, Comparator // if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity())); // continue;
for (ThingsModel thingsModel : taiyangnengModels) { // }
if (thingsModel.getModelName().equals("市电状态")) { HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier()); put("upType", 0);
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{ put("identifier", haiWeiPropertyVo.getNameEn());
put("upType", 0); put("unit", haiWeiPropertyVo.getUnit());
put("identifier", thingsModel.getIdentifier()); put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
put("unit", ""); "--":haiWeiPropertyVo.getValue().toString());
put("value", "市电"); put("name", haiWeiPropertyVo.getNameCn());
put("name", thingsModel.getModelName()); }};
}}; if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_MpptDown")){
if (deviceLogs1.size() > 0) { hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) { Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常");
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f) { }else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_市电状态")){
hashMap.put("value", "市电"); hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
} else { Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"市电":"太阳能"):"市电");
hashMap.put("value", "太阳能");
}
} }
rMap.put(haiWeiPropertyVo.getNameEn(), hashMap);
} }
rMap.put(thingsModel.getIdentifier(), hashMap);
} else {
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 (deviceLogs1.size() > 0) {
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
if (deviceLogs1.size() > 1) {
try{
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);
}
}catch (Exception e){
hashMap.put("upType", 0);
}
} else {
hashMap.put("upType", 0);
}
hashMap.put("value", deviceLogs1.get(0).getLogValue());
} else {
hashMap.put("value", "--");
hashMap.put("upType", 0);
}
} 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());
}
}
rMap.put(thingsModel.getIdentifier(), hashMap);
} }
} }
// 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) {
// if (thingsModel.getModelName().equals("市电状态")) {
// List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
// HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
// put("upType", 0);
// put("identifier", thingsModel.getIdentifier());
// put("unit", "");
// put("value", "市电");
// put("name", thingsModel.getModelName());
// }};
// if (deviceLogs1.size() > 0) {
// if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
// if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f) {
// hashMap.put("value", "市电");
// } else {
// hashMap.put("value", "太阳能");
// }
// }
// }
// rMap.put(thingsModel.getIdentifier(), hashMap);
// } else {
// 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 (deviceLogs1.size() > 0) {
// if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
// if (deviceLogs1.size() > 1) {
// try{
// 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);
// }
// }catch (Exception e){
// hashMap.put("upType", 0);
// }
// } else {
// hashMap.put("upType", 0);
// }
// hashMap.put("value", deviceLogs1.get(0).getLogValue());
// } else {
// hashMap.put("value", "--");
// hashMap.put("upType", 0);
// }
//
// } 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());
// }
// }
// rMap.put(thingsModel.getIdentifier(), hashMap);
// }
// }
} else { } else {
for (ThingsModel thingsModel : taiyangnengModels) { for (ThingsModel thingsModel : taiyangnengModels) {
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{ HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
@ -242,7 +267,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
put("upType", 0); put("upType", 0);
put("identifier", "xiangmen"); put("identifier", "xiangmen");
put("unit", ""); put("unit", "");
put("value", haiWeiPropertyVo.getValue()); put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
"--":haiWeiPropertyVo.getValue().toString());
put("name", haiWeiPropertyVo.getNameCn()); put("name", haiWeiPropertyVo.getNameCn());
}}; }};
rMap.put("xiangmen", hashMap1); rMap.put("xiangmen", hashMap1);
@ -285,131 +311,169 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
thingsModel2.setProductId(139L); thingsModel2.setProductId(139L);
List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel2); List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel2);
if (StringUtils.isNotEmpty(liuliangModels)) { if (StringUtils.isNotEmpty(liuliangModels)) {
Device liuliangDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(liuliangIds)); CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(liuliangIds));
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{ if(cache != null){
setSerialNumber(liuliangDevice.getSerialNumber()); HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString()); if(checkedData != null){
setEndTime(DateUtil.endOfDay(dateTime).toString()); List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
}}); for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
Map<String, List<DeviceLog>> liuliangCollect = deviceLogs.stream().sorted(Comparator // if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
.comparing(DeviceLog::getCreateTime, Comparator // continue;
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity())); // }
for (ThingsModel thingsModel : liuliangModels) { HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
if(thingsModel.getIdentifier().equals("三菱FX2N_1_mCon")){ put("upType", 0);
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{ put("identifier", haiWeiPropertyVo.getNameEn());
put("upType", 0); put("unit", haiWeiPropertyVo.getUnit());
put("identifier", "三菱FX2N_1_mCon"); put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
put("unit", ""); "--":haiWeiPropertyVo.getValue().toString());
put("value", "停止"); put("name", haiWeiPropertyVo.getNameCn());
put("name", thingsModel.getModelName()); }};
}}; if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_guanxian")){
List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier()); hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
if(deviceLogs1.size() > 0){ Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"关闭":"开启"):"关闭");
if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){ rMap.put("阀门状态", hashMap);
if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){ }else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_FlowDown")){
hashMap1.put("value", "启动"); hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
}else{ Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常");
hashMap1.put("value", "停止"); rMap.put("水表状态", hashMap);
} }else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_mCon")){
hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常");
rMap.put("水泵状态", hashMap);
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_sumFlow")){
hashMap.put("value", haiWeiPropertyVo.getValue().toString());
rMap.put("sumFlow", hashMap);
}else {
rMap.put(haiWeiPropertyVo.getNameEn(), hashMap);
} }
} }
rMap.put("水泵状态", hashMap1);
}else if(thingsModel.getIdentifier().equals("三菱FX2N_1_guanxian")){
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
put("upType", 0);
put("identifier", "三菱FX2N_1_guanxian");
put("unit", "");
put("value", "关闭");
put("name", thingsModel.getModelName());
}};
List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
if(deviceLogs1.size() > 0){
if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){
if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
hashMap1.put("value", "关闭");
}else{
hashMap1.put("value", "开启");
}
}else{
hashMap1.put("value", "关闭");
}
}
rMap.put("阀门状态", hashMap1);
}else if(thingsModel.getIdentifier().equals("三菱FX2N_1_FlowDown")){
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
put("upType", 0);
put("identifier", "三菱FX2N_1_FlowDown");
put("unit", "");
put("value", "正常");
put("name", thingsModel.getModelName());
}};
List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
if(deviceLogs1.size() > 0){
if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){
if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
hashMap1.put("value", "断线");
}else{
hashMap1.put("value", "正常");
}
}else{
hashMap1.put("value", "正常");
}
}
rMap.put("水表状态", hashMap1);
}else{
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
put("upType", 0);
put("identifier", thingsModel.getIdentifier().equals("三菱FX2N_1_sumFlow") ? "sumFlow" : 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")) {
hashMap1.put("unit", parse.get("unit"));
}
}
if (hashMap1.size() > 1) {
List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
if (deviceLogs1 != null) {
if (deviceLogs1.size() > 0) {
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
if (deviceLogs1.size() > 1) {
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
hashMap1.put("upType", 1);
} else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
hashMap1.put("upType", -1);
}
} else {
hashMap1.put("upType", 0);
}
hashMap1.put("value", deviceLogs1.get(0).getLogValue());
} else {
hashMap1.put("value", "--");
hashMap1.put("upType", 0);
}
} else {
hashMap1.put("value", "--");
hashMap1.put("upType", 0);
}
}
} else if (hashMap1.size() > 0) {
List<DeviceLog> deviceLogs2 = liuliangCollect.get(thingsModel.getIdentifier());
if (deviceLogs2 != null) {
hashMap1.put("value", deviceLogs2.get(0).getLogValue());
}
}
rMap.put(thingsModel.getIdentifier().equals("三菱FX2N_1_sumFlow") ? "sumFlow" : thingsModel.getIdentifier(), hashMap1);
} }
} }
// Device liuliangDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(liuliangIds));
// List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
// setSerialNumber(liuliangDevice.getSerialNumber());
// setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
// setEndTime(DateUtil.endOfDay(dateTime).toString());
// }});
// Map<String, List<DeviceLog>> liuliangCollect = deviceLogs.stream().sorted(Comparator
// .comparing(DeviceLog::getCreateTime, Comparator
// .nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
// for (ThingsModel thingsModel : liuliangModels) {
// if(thingsModel.getIdentifier().equals("三菱FX2N_1_mCon")){
// HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
// put("upType", 0);
// put("identifier", "三菱FX2N_1_mCon");
// put("unit", "");
// put("value", "停止");
// put("name", thingsModel.getModelName());
// }};
// List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
// if(deviceLogs1.size() > 0){
// if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){
// if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
// hashMap1.put("value", "启动");
// }else{
// hashMap1.put("value", "停止");
// }
// }
// }
// rMap.put("水泵状态", hashMap1);
// }else if(thingsModel.getIdentifier().equals("三菱FX2N_1_guanxian")){
// HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
// put("upType", 0);
// put("identifier", "三菱FX2N_1_guanxian");
// put("unit", "");
// put("value", "关闭");
// put("name", thingsModel.getModelName());
// }};
// List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
// if(deviceLogs1.size() > 0){
// if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){
// if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
// hashMap1.put("value", "关闭");
// }else{
// hashMap1.put("value", "开启");
// }
// }else{
// hashMap1.put("value", "关闭");
// }
//
// }
// rMap.put("阀门状态", hashMap1);
// }else if(thingsModel.getIdentifier().equals("三菱FX2N_1_FlowDown")){
// HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
// put("upType", 0);
// put("identifier", "三菱FX2N_1_FlowDown");
// put("unit", "");
// put("value", "正常");
// put("name", thingsModel.getModelName());
// }};
// List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
// if(deviceLogs1.size() > 0){
// if(NumberUtils.isNumeric(deviceLogs1.get(0).getLogValue())){
// if(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
// hashMap1.put("value", "断线");
// }else{
// hashMap1.put("value", "正常");
// }
// }else{
// hashMap1.put("value", "正常");
// }
//
// }
// rMap.put("水表状态", hashMap1);
// }else{
// HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
// put("upType", 0);
// put("identifier", thingsModel.getIdentifier().equals("三菱FX2N_1_sumFlow") ? "sumFlow" : 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")) {
// hashMap1.put("unit", parse.get("unit"));
// }
// }
//
// if (hashMap1.size() > 1) {
// List<DeviceLog> deviceLogs1 = liuliangCollect.get(thingsModel.getIdentifier());
// if (deviceLogs1 != null) {
// if (deviceLogs1.size() > 0) {
// if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
// if (deviceLogs1.size() > 1) {
// if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
// hashMap1.put("upType", 1);
// } else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
// hashMap1.put("upType", -1);
// }
// } else {
// hashMap1.put("upType", 0);
// }
// hashMap1.put("value", deviceLogs1.get(0).getLogValue());
// } else {
// hashMap1.put("value", "--");
// hashMap1.put("upType", 0);
// }
//
// } else {
// hashMap1.put("value", "--");
// hashMap1.put("upType", 0);
// }
//
//
// }
// } else if (hashMap1.size() > 0) {
// List<DeviceLog> deviceLogs2 = liuliangCollect.get(thingsModel.getIdentifier());
// if (deviceLogs2 != null) {
// hashMap1.put("value", deviceLogs2.get(0).getLogValue());
// }
// }
// rMap.put(thingsModel.getIdentifier().equals("三菱FX2N_1_sumFlow") ? "sumFlow" : thingsModel.getIdentifier(), hashMap1);
// }
// }
} else { } else {
for (ThingsModel thingsModel : taiyangnengModels) { for (ThingsModel thingsModel : taiyangnengModels) {
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{ HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
@ -478,7 +542,7 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
if (liuliangDevice != null) { if (liuliangDevice != null) {
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{ List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
setSerialNumber(liuliangDevice.getSerialNumber()); setSerialNumber(liuliangDevice.getSerialNumber());
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString()); setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, 0)).toString());
setEndTime(DateUtil.endOfDay(dateTime).toString()); setEndTime(DateUtil.endOfDay(dateTime).toString());
}}); }});
Map<String, List<DeviceLog>> liuliangCollect = deviceLogs.stream().sorted(Comparator Map<String, List<DeviceLog>> liuliangCollect = deviceLogs.stream().sorted(Comparator

View File

@ -1664,6 +1664,9 @@ public class DeviceServiceImpl implements IDeviceService {
HashMap<String, Object> dataListMap = new HashMap<>(); HashMap<String, Object> dataListMap = new HashMap<>();
List<DeviceLog> deviceLogs1 = collect.get(modelDevice.getIdentifier()); List<DeviceLog> deviceLogs1 = collect.get(modelDevice.getIdentifier());
if(null == deviceLogs1){
continue;
}
deviceLogs1.sort(Comparator.comparing(DeviceLog::getCreateTime)); deviceLogs1.sort(Comparator.comparing(DeviceLog::getCreateTime));
dataListMap.put("name", modelDevice.getModelName()); dataListMap.put("name", modelDevice.getModelName());
if (StringUtils.isNotEmpty(modelDevice.getSpecs())) { if (StringUtils.isNotEmpty(modelDevice.getSpecs())) {

View File

@ -59,6 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="serialNumber != null and serialNumber !=''"> and serial_number = #{serialNumber}</if> <if test="serialNumber != null and serialNumber !=''"> and serial_number = #{serialNumber}</if>
<if test="logType != null "> and log_type = #{logType}</if> <if test="logType != null "> and log_type = #{logType}</if>
<if test="identity != null and identity != ''"> and identity like concat('%', #{identity}, '%')</if> <if test="identity != null and identity != ''"> and identity like concat('%', #{identity}, '%')</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and create_time between #{beginTime} and #{endTime}
</if>
</where> </where>
order by create_time desc order by create_time desc
</select> </select>