日期:2014-05-16 浏览次数:20395 次
{'key':[ {'key1':'value1'}, {'key2':'value2'}, ...... ] }
StringBuffer sbf = new StringBuffer(); sbf.append("{'data' : "); try{ if (null == tVisitResult) { sbf.append("'no_result'"); } else { int storeId = null == tVisitResult.getStoreId() ? 0 : tVisitResult.getStoreId(); TStore store = this.visitResultService.getById(TStore.class, storeId); sbf.append("["); // store sbf.append("{'name' : '"); sbf.append(store.getName()); sbf.append("', 'lon' : '"); sbf.append(store.getGisX()); sbf.append("', 'lat' : '"); sbf.append(store.getGisY()); sbf.append("'}, "); // check in gis sbf.append("{'name' : 'CheckIn', 'lon' : '116.45733', 'lat' : '39.91993'}, "); // check out gis sbf.append("{'name' : 'CheckOut', 'lon' : '116.46233', 'lat' : '39.95293'} "); // sbf.append("]"); } sbf.append("}"); } catch (Exception e) { e.printStackTrace(); }
{'data' : [ {'name' : '鲁春利测试店面A', 'lon' : '116.45724121462', 'lat' : '39.919978035546'}, {'name' : 'CheckIn', 'lon' : '116.45733', 'lat' : '39.91993'}, {'name' : 'CheckOut', 'lon' : '116.46233', 'lat' : '39.95293'} ] }
var data = "<s:property value='jsonData'/>"; var content = eval("("+data+")"); if ('no_store' == $.trim(result)) { return false; } for (var i in result) { if (typeof(result[i]) == "object") { if ("" == $.trim(result[i].lon)) { continue; } alert("name : " + result[i].name + "\tlon : " + result[i].lon + "\tlat : " + result[i].lat); } }
{'name' : 'CheckOut', 'lon' : '116.46233', 'lat' : '39.95293'}
{\"name\" : \"CheckOut\", \"lon\" : \"116.46233\", \"lat\" : \"39.95293\"}
var data = '<s:property value="jsonData" escape="false"/>'
JSONObject jsonObject = new JSONObject(); StringBuffer json = new StringBuffer(); for (VisitPlanInfo planInfo : this.visitPlanInfoList) { //查找已经放过的店面 FilterWrapper cancelFilter = new FilterWrapper(); cancelFilter.addFilter("companyId", userInfo.getCompanyId(), Filter.EQ); cancelFilter.addFilter("planId", planInfo.gettVisitPlan().getPlanId()); cancelFilter.addFilter("visitNo", planInfo.getVisitNo()); cancelFilter.addFilter("visitStatus", VISIT_PLAN_CANCEL, Filter.EQ); cancelFilter.addFilter("isDelete", IS_DELETE_NO, Filter.EQ); List<TVisitResult> results = this.visitResultService.getEntitiesByFilter(TVisitResult.class, cancelFilter); // json.append("'pno_"); json.append(planInfo.gettVisitPlan().getPlanId()); json.append("_"); json.append(planInfo.getVisitNo()); json.append("' : "); if (null == results || results.size() <= 0) { //全部访问完成 json.append("'no'"); } else { //有取消的拜访任务 json.append("'"); for (TVisitResult tr : results) { json.append(tr.getStoreName()); json.append("; "); } json.append("'"); } json.append(", "); } log.info("json : " + json); if (json.length() > 0) { if (json.lastIndexOf(",") > 0) { json = json.deleteCharAt(json.lastIndexOf(",")); } jsonObject.put("data", "{" + json.toString() + "}"); } else { jsonObject.put("data", "non