1/device/detail/gongdianChart。供电图表数据需修复
2/地图实时数据接口优化
This commit is contained in:
parent
a29e547c4e
commit
9213e44988
@ -113,7 +113,8 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
||||
if (taiyangnengIds == null) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -131,93 +131,118 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||
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) {
|
||||
if (thingsModel.getModelName().equals("市电状态")) {
|
||||
List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||
// Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
||||
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(taiyangnengIds));
|
||||
if(cache != null){
|
||||
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
|
||||
if(checkedData != null){
|
||||
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
|
||||
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
|
||||
// if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
|
||||
// continue;
|
||||
// }
|
||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||
put("upType", 0);
|
||||
put("identifier", thingsModel.getIdentifier());
|
||||
put("unit", "");
|
||||
put("value", "市电");
|
||||
put("name", thingsModel.getModelName());
|
||||
put("identifier", haiWeiPropertyVo.getNameEn());
|
||||
put("unit", haiWeiPropertyVo.getUnit());
|
||||
put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
|
||||
"--":haiWeiPropertyVo.getValue().toString());
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
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", "太阳能");
|
||||
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_MpptDown")){
|
||||
hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
|
||||
Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常");
|
||||
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_市电状态")){
|
||||
hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
|
||||
Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"市电":"太阳能"):"市电");
|
||||
}
|
||||
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 {
|
||||
for (ThingsModel thingsModel : taiyangnengModels) {
|
||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||
@ -242,7 +267,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
put("upType", 0);
|
||||
put("identifier", "xiangmen");
|
||||
put("unit", "");
|
||||
put("value", haiWeiPropertyVo.getValue());
|
||||
put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
|
||||
"--":haiWeiPropertyVo.getValue().toString());
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
rMap.put("xiangmen", hashMap1);
|
||||
@ -285,131 +311,169 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
thingsModel2.setProductId(139L);
|
||||
List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel2);
|
||||
if (StringUtils.isNotEmpty(liuliangModels)) {
|
||||
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>() {{
|
||||
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.parseLong(liuliangIds));
|
||||
if(cache != null){
|
||||
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
|
||||
if(checkedData != null){
|
||||
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
|
||||
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
|
||||
// if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_kaixian")){
|
||||
// continue;
|
||||
// }
|
||||
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||
put("upType", 0);
|
||||
put("identifier", "三菱FX2N_1_mCon");
|
||||
put("unit", "");
|
||||
put("value", "停止");
|
||||
put("name", thingsModel.getModelName());
|
||||
put("identifier", haiWeiPropertyVo.getNameEn());
|
||||
put("unit", haiWeiPropertyVo.getUnit());
|
||||
put("value", StringUtils.isEmpty(haiWeiPropertyVo.getValue().toString())?
|
||||
"--":haiWeiPropertyVo.getValue().toString());
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
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", "启动");
|
||||
if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_guanxian")){
|
||||
hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
|
||||
Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"关闭":"开启"):"关闭");
|
||||
rMap.put("阀门状态", hashMap);
|
||||
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_FlowDown")){
|
||||
hashMap.put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?(
|
||||
Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常");
|
||||
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 {
|
||||
hashMap1.put("value", "停止");
|
||||
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 {
|
||||
for (ThingsModel thingsModel : taiyangnengModels) {
|
||||
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
|
||||
@ -478,7 +542,7 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
if (liuliangDevice != null) {
|
||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||
setSerialNumber(liuliangDevice.getSerialNumber());
|
||||
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
||||
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, 0)).toString());
|
||||
setEndTime(DateUtil.endOfDay(dateTime).toString());
|
||||
}});
|
||||
Map<String, List<DeviceLog>> liuliangCollect = deviceLogs.stream().sorted(Comparator
|
||||
|
@ -1664,6 +1664,9 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
HashMap<String, Object> dataListMap = new HashMap<>();
|
||||
|
||||
List<DeviceLog> deviceLogs1 = collect.get(modelDevice.getIdentifier());
|
||||
if(null == deviceLogs1){
|
||||
continue;
|
||||
}
|
||||
deviceLogs1.sort(Comparator.comparing(DeviceLog::getCreateTime));
|
||||
dataListMap.put("name", modelDevice.getModelName());
|
||||
if (StringUtils.isNotEmpty(modelDevice.getSpecs())) {
|
||||
|
@ -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="logType != null "> and log_type = #{logType}</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>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user