标签:must stat foj class cep reac set pre entity
JSONObject paramJson = JSONObject.parseObject(param); if (!paramJson.containsKey("peerTime")) { throw new BaseException(ErrorCodeEnum.CODE_DB_CONNECT_ERROR, "set peer param must contains param peerTime"); }
数组
"statisticsInfo": [{ "idType": 0, "id": "1234567" },{ "idType": 1, "id": "1234567" }]
List<JSONObject> statisticsInfoJson = JSONArray
.parseArray((paramJson.get("statisticsInfo")).toString(), JSONObject.class);
List<StatisticsIdEntity> statisticsIds = new ArrayList<>(statisticsInfoJson.size());
for (JSONObject jsonObject : statisticsInfoJson) {
StatisticsIdEntity statisticsIdEntity = new StatisticsIdEntity();
statisticsIdEntity.setIdType(Short.valueOf(String.valueOf(jsonObject.get("idType"))));
statisticsIdEntity.setIdValue(String.valueOf(jsonObject.get("id")));
statisticsIds.add(statisticsIdEntity);
}
参数格式如下(areaCode是区域码,deviceId是点位id)
[{
"areaCode": "12345",
"deviceId": "12345"
},
{
"areaCode": "12346",
"deviceId": "12346"
}]
List<Map> areDeviceIds=JSONArray.parseArray(areaDeviceIds, Map.class)
标签:must stat foj class cep reac set pre entity
原文地址:https://www.cnblogs.com/xjatj/p/9272186.html