标签:ppi col stack hashmap 转换 params except fun cep
1.前端返回的数据
function getDatainitBarView(){ var url="${contextPath}/customer/findResultByIndicatorCodesAndCycleType"; var indicatorCodes=[{"code": "003002003003001", "type": "4","cycleValue":4}, {"code": "003002003003002", "type": "5"}, {"code": "003002003003003", "type": "5"}]; var param={ "fullYear":fullYear, "indicatorCodes":indicatorCodes, "deptCode":"0306" } getData(param,url,4); }
2.后台接收数据处理
@RequestMapping("/findResultByIndicatorCodesAndCycleType") @ResponseBody public void findResultByIndicatorCodesAndCycleType(@RequestBody Map param){ BaseResultObject baseResultObject = new BaseResultObject(); try { List<Object> params=(List<Object>) param.get("indicatorCodes");//将返回的业务数据转换成list JSONArray indicatorCodes = new JSONArray(params);//将list集合转换成json数组 Map map=new HashMap(); Map maps=new HashMap(); int i=0; for (int j = 0; j < indicatorCodes.size(); j++) { maps=(Map) indicatorCodes.get(j); param.put("indicatorCode", maps.get("code")); param.put("cycleType", maps.get("type")); param.put("cycleValue", maps.get("cycleValue")); if( maps.get("cycleValue")!=null){ param.put("preResult","preResult"); }else{ param.put("preResult",null); } List result=indicatorResultDataService.findListResultByParam(param); map.put("data"+i,result); i++; } baseResultObject.setData(map); baseResultObject.setStatus(STATUS_SUCCESS); } catch (Exception e) { baseResultObject.setStatus(STATUS_FAILURE); e.printStackTrace(); } this.putInToJsonResponse(baseResultObject); }
标签:ppi col stack hashmap 转换 params except fun cep
原文地址:https://www.cnblogs.com/black-knight/p/9472673.html