@RequestMapping("/getallareactrl")
@ResponseBody
public Result getAllAreaCtrl(@RequestBody ClientRestInfo startRollCallInfo) {
logger.info("獲取數據 ...");
List<AllControl> acList = areaCtrlRecordService.getAllAreaStats(Category.CRIMINAL.getValue());
Result result = new Result(ResultType.OK, "");
result.getResultMap().put(Constants.ResultKey.DATA_LIST, acList);
return result;
}
2、數據沒問題,那我們就需要來安卓端接收了!
public void getAreaCtrlInfo(){
new Thread(new Runnable() {
@Override
public void run() {
JSONObject param = new JSONObject();
param.put(Constants.Param.CLIENT_IP,getPadIP()); // 訪問后端接口需要的數據 一個個put進去
String url = CommonCode.getPortalUrl(Constants.Portal.GET_ROLL_CALL_DATA); //后端接口地址
JSONObject result = CommonCode.postGetJson(param,url); //返回的result
if (CommonCode.getResultFlag(result)) {
JSONArray callInfos = (JSONArray) CommonCode.getResultMapProperty(result, Constants.Param.DATA_LIST);
........處理這個result ,把json里的數據提取出了來用