Commit 99c4e14c authored by sunyuhua's avatar sunyuhua

自动打卡的代码

parent f7a072de
...@@ -370,14 +370,18 @@ public class RemoteService { ...@@ -370,14 +370,18 @@ public class RemoteService {
String resultString = forEntity.getBody(); String resultString = forEntity.getBody();
log.info("计时打卡点:" + resultString); log.info("计时打卡点:" + resultString);
JSONObject object = JSONObject.parseObject(resultString); JSONObject object = JSONObject.parseObject(resultString);
JSONArray result = object.getJSONArray("segCps"); JSONArray segsResult = object.getJSONObject("road").getJSONArray("segs");
if(segsResult == null || segsResult.isEmpty()) return null;
//暂不支持多日赛
JSONObject resultObject = (JSONObject)segsResult.get(0);
JSONArray result = resultObject.getJSONArray("segCps");
if (result == null || result.isEmpty()) return null; if (result == null || result.isEmpty()) return null;
//获取每个打卡点的信息 //获取每个打卡点的信息
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
RoadsGpsCheckpointMap roadsGpsCheckpointMap = new RoadsGpsCheckpointMap(); RoadsGpsCheckpointMap roadsGpsCheckpointMap = new RoadsGpsCheckpointMap();
JSONObject o = (JSONObject) result.get(i); JSONObject o = (JSONObject) result.get(i);
String checkpointId = o.getString("id"); String checkpointId = o.getString("checkPointId");
String checkpointName = o.getString("name"); String checkpointName = o.getString("cpName");
roadsGpsCheckpointMap.setCmptId(cmptId).setRoadId(roadId).setCheckpointId(Integer.parseInt(checkpointId)).setCheckpointName(checkpointName); roadsGpsCheckpointMap.setCmptId(cmptId).setRoadId(roadId).setCheckpointId(Integer.parseInt(checkpointId)).setCheckpointName(checkpointName);
roadsGpsCheckpointMapList.add(roadsGpsCheckpointMap); roadsGpsCheckpointMapList.add(roadsGpsCheckpointMap);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment