@RequestMapping(value = "/download", method = RequestMethod.GET, produces ="application/json" , consumes="application/json")
public String downloadProjectRequirementdetails(@RequestParam("StudID") int studID) throws JSONException, JsonProcessingException {
Map<String, Object> response = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<String, Object>();
List<Student> list = new ArrayList<Student>();
/* int stat = (int) result.get("o_status");
if( stat ==106)
{
*/
result = studDao.downloadtestScnario(studID);
json = mapper.writeValueAsString(result);
JSONObject jsonObj = new JSONObject(json);
if (jsonObj.has("#result-set-1")) {
JSONArray jsonArray = jsonObj.getJSONArray("#result-set-1");
if (jsonArray.length() > 0) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject MainObj = jsonArray.getJSONObject(i);
Student testdetails = new Student();
testdetails.setStudID(MainObj.getInt("StudID"));
testdetails.setFirstName(MainObj.getString("FirstName"));
testdetails.setLastName(MainObj.getString("LastName"));
testdetails.setAddress(MainObj.getString("Address"));
testdetails.setMobileNo(MainObj.getInt("MobileNo"));
list.add(testdetails);
}
response.put("response", list);
response.put("StatusCode", 200);
response.put("Message", "Download Completed");
}
} else {
response.put("StatusCode", 204);
response.put("Message", "No data found!!!");
}
//}
json = mapper.writeValueAsString(response);
return json;
}
FFIVE
Smart猫小萌
相关分类