增加机井信息:流量计状态、阀门状态、水泵状态和安防信息:箱门状态、内门上锁、内门下锁
This commit is contained in:
parent
78f467c2ed
commit
54958fe14c
@ -144,55 +144,78 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
.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) {
|
||||
if (thingsModel.getModelName().equals("市电状态")) {
|
||||
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) {
|
||||
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<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) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
hashMap.put("upType", 0);
|
||||
}
|
||||
hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
||||
} else {
|
||||
hashMap.put("value", "--");
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
rMap.put(thingsModel.getIdentifier(), hashMap);
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
for (ThingsModel thingsModel : taiyangnengModels) {
|
||||
@ -216,12 +239,30 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
if (haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_open")) {
|
||||
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
|
||||
put("upType", 0);
|
||||
put("identifier", "xiangmen");
|
||||
put("identifier", "xiangmen");
|
||||
put("unit", "");
|
||||
put("value", haiWeiPropertyVo.getValue());
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
rMap.put("xiangmen", hashMap1);
|
||||
} else if (haiWeiPropertyVo.getNameEn().equals("内门上锁")) {
|
||||
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
|
||||
put("upType", 0);
|
||||
put("identifier", "三菱FX2N_1_lock1Con");
|
||||
put("unit", "");
|
||||
put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常");
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
rMap.put("三菱FX2N_1_lock1Con", hashMap1);
|
||||
} else if (haiWeiPropertyVo.getNameEn().equals("内门下锁")) {
|
||||
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
|
||||
put("upType", 0);
|
||||
put("identifier", "三菱FX2N_1_lock2Con");
|
||||
put("unit", "");
|
||||
put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常");
|
||||
put("name", haiWeiPropertyVo.getNameCn());
|
||||
}};
|
||||
rMap.put("三菱FX2N_1_lock2Con", hashMap1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -240,7 +281,7 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
ThingsModel thingsModel2 = new ThingsModel();
|
||||
thingsModel2.setProductId(139L);
|
||||
List<ThingsModel> liuliangModels = thingsModelService.selectThingsModelList(thingsModel2);
|
||||
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
||||
if (StringUtils.isNotEmpty(liuliangModels)) {
|
||||
Device liuliangDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(liuliangIds));
|
||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||
setSerialNumber(liuliangDevice.getSerialNumber());
|
||||
@ -251,56 +292,109 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
.comparing(DeviceLog::getCreateTime, Comparator
|
||||
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
||||
for (ThingsModel thingsModel : liuliangModels) {
|
||||
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) {
|
||||
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 != 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);
|
||||
if(deviceLogs1.size() > 0){
|
||||
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(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
|
||||
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(Float.parseFloat(deviceLogs1.get(0).getLogValue()) == 1f){
|
||||
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);
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
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>() {{
|
||||
@ -313,14 +407,6 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
||||
rMap.put(thingsModel.getIdentifier().equals("三菱FX2N_1_sumFlow") ? "sumFlow" : thingsModel.getIdentifier(), hashMap1);
|
||||
}
|
||||
}
|
||||
// HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>() {{
|
||||
// put("upType", 0);
|
||||
// put("identifier", "sumFlow");
|
||||
// put("unit", "m³");
|
||||
// put("value", 0);
|
||||
// put("name", "累计用水量");
|
||||
// }};
|
||||
// rMap.put("sumFlow", hashMap1);
|
||||
MaWatereleRecord maWatereleRecord = new MaWatereleRecord();
|
||||
maWatereleRecord.setDevSn(device.getSerialNumber());
|
||||
TableDataInfo tableDataInfo = watereleRecordService.selectMaWatereleRecordList(maWatereleRecord);
|
||||
|
Loading…
x
Reference in New Issue
Block a user