1. Data returned from the front end
functionGetdatainitbarview () {varUrl= "${contextpath}/customer/findresultbyindicatorcodesandcycletype"; varindicatorcodes=[{"code": "003002003003001", "Type": "4", "Cyclevalue": 4}, {"Code": "003002003003002", "Type": "5"}, {"Code": "003002003003003", "Type": "5"}]; varparam={ "Fullyear": Fullyear,"Indicatorcodes": Indicatorcodes,"Deptcode": "0306"} getData (Param,url,4); }
2. Background receiving data processing
@RequestMapping ("/findresultbyindicatorcodesandcycletype") @ResponseBody Public voidfindresultbyindicatorcodesandcycletype (@RequestBody Map param) {baseresultobject baseresultobject=NewBaseresultobject (); Try{List<Object> params= (list<object>) param.get ("Indicatorcodes")//Convert the returned business data to list Jsonarray indicatorcodes=NewJsonarray (params);//Convert list collection to JSON array map map=NewHashMap (); Map Maps=NewHashMap (); intI=0; for(intj = 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); }
JSON data returned by the front end of the Java spooler