Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/getData/{from}/{to}/{groupType}/{status}/", method = RequestMethod.POST)
- public @ResponseBody ResponseEntity<?> getData(
- @PathVariable("status") String status,
- @PathVariable("from") String dateFrom,
- @PathVariable("to") String dateTo,
- @PathVariable("groupType") String groupType,
- @RequestBody String json)
- throws Exception {
- json = StringUtil.removeBackslash(URLDecoder.decode(json, "UTF-8")).replaceAll("json=", "");
- Map<String, Object> result = manager.createEmptyResult();
- Map<String, Object> resultTotal = manager.createEmptyResult();
- try {
- Map<String, Object> data = manager.getTableData(null, "null", "null", "null", "null", "null", null, dateFrom, dateTo, groupType,
- status, json, (groupType.equals(BIGroupBy.NO_GROUPING) ? "revenue" : groupType), false, true, false);
- if(data == null) {
- return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
- }
- result.putAll(data);
- Map<String, Object> dataTotal = manager.getTotalData(null,
- "null", "null", "null", "null", "null", status, dateFrom, dateTo, groupType, json, false, true);
- if(dataTotal == null) {
- return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
- }
- resultTotal.putAll(dataTotal);
- } catch (Exception e) {
- log.error("Getting data failed!!!", e);
- }
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
- public Map<String, Object> createEmptyResult() throws Exception {
- Map<String, Object> result = new HashMap<String, Object>();
- result.put("total", "0");
- result.put("data", new ArrayList<String>());
- return result;
- }
- Map<String, Object> resultNew = manager.createEmptyResult();
- resultNew.putAll(result);
- resultNew.putAll(resultTotal);
Add Comment
Please, Sign In to add comment