|
|
@ -52,10 +52,10 @@ public enum MonitorSourceEnum { |
|
|
|
MS_DSM_ST("应变监测表", MsDsmSt.class), |
|
|
|
MS_HDM_WAS("堰闸水情监测表", MsHdmWas.class), |
|
|
|
ATT_RES_SW("水库溢洪道表", MonitorTypeEnum.DATA, AttResSw.class), |
|
|
|
ATT_RES_RSPP("水库溢洪道表", MonitorTypeEnum.DATA, AttResRspp.class), |
|
|
|
ATT_RES_RSPP("水库溢洪道表", AttResRspp.class), |
|
|
|
ATT_DAM_BASE("水库大坝基础信息表", MonitorTypeEnum.DATA, SkAttDamBase.class), |
|
|
|
DWS_ATT_DAM_RSPP("大坝特征值表", MonitorTypeEnum.DATA, DwsAttDamRspp.class), |
|
|
|
DWS_REL_ST_RES("代表站", SkRelStRes.class), |
|
|
|
DWS_REL_ST_RES("代表站",MonitorTypeEnum.DATA, SkRelStRes.class), |
|
|
|
; |
|
|
|
|
|
|
|
private final String zhName; |
|
|
@ -102,30 +102,42 @@ public enum MonitorSourceEnum { |
|
|
|
if (this.type == null || Strings.isNullOrEmpty(json)) { |
|
|
|
return new Page<>(); |
|
|
|
} |
|
|
|
if (this.type == MonitorTypeEnum.MONITOR) { |
|
|
|
if (this.type.equals(MonitorTypeEnum.MONITOR)) { |
|
|
|
MonitorResponse response = JSON.parseObject(json, MonitorResponse.class); |
|
|
|
if (!response.isSuccess()) { |
|
|
|
log.error("record获取数据失败:{} [{}]", this.clazz, json); |
|
|
|
return new Page<>(); |
|
|
|
} |
|
|
|
try { |
|
|
|
DataInfo dataInfo = JSON.parseObject(response.getData(), DataInfo.class); |
|
|
|
Page<Object> page = new Page<>(dataInfo.getCurrent(), dataInfo.getSize(), dataInfo.getTotal()); |
|
|
|
List<?> data = JSON.parseArray(response.getRecords(), this.clazz); |
|
|
|
page.setRecords(Arrays.asList(data.toArray())); |
|
|
|
return page; |
|
|
|
List<?> data = JSON.parseArray(response.getRecords(), this.clazz); |
|
|
|
page.setRecords(Arrays.asList(data.toArray())); |
|
|
|
return page; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("data获取数据失败:{} [{}],type[{}]", this.clazz, response, this.type); |
|
|
|
} |
|
|
|
return new Page<>(); |
|
|
|
} else { |
|
|
|
DataResponse response = JSON.parseObject(json, DataResponse.class); |
|
|
|
if (!response.isSuccess()) { |
|
|
|
log.error("data获取数据失败:{} [{}]", this.clazz, json); |
|
|
|
return new Page<>(); |
|
|
|
} |
|
|
|
try { |
|
|
|
MonitorQueDto queDto = resultWrapper.getQueDto(); |
|
|
|
Page<Object> page = new Page<>(queDto.getPageNum(), queDto.getPageSize()); |
|
|
|
List<?> data = JSON.parseArray(response.getData(), this.clazz); |
|
|
|
page.setRecords(Arrays.asList(data.toArray())); |
|
|
|
return page; |
|
|
|
List<?> data = JSON.parseArray(response.getData(), this.clazz); |
|
|
|
page.setRecords(Arrays.asList(data.toArray())); |
|
|
|
return page; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("data获取数据失败:{} [{}],type:[{}]", this.clazz, response, this.type); |
|
|
|
} |
|
|
|
return new Page<>(); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
@Data |
|
|
@ -146,7 +158,7 @@ public enum MonitorSourceEnum { |
|
|
|
private String data; |
|
|
|
|
|
|
|
public Boolean isSuccess() { |
|
|
|
return "0".equals(getCode()); |
|
|
|
return "200".equals(getCode()) || "0".equals(getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|