Subversion Repositories SmartDukaan

Rev

Rev 22906 | Rev 22952 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21339 kshitij.so 1
package com.spice.profitmandi.web.controller;
2
 
3
import java.time.LocalDateTime;
4
import java.util.ArrayList;
22336 amit.gupta 5
import java.util.Arrays;
21339 kshitij.so 6
import java.util.HashMap;
7
import java.util.List;
8
import java.util.Map;
9
 
10
import javax.servlet.http.HttpServletRequest;
11
 
22319 amit.gupta 12
import org.apache.commons.lang3.StringUtils;
13
import org.json.JSONArray;
14
import org.json.JSONObject;
21339 kshitij.so 15
import org.slf4j.Logger;
16
import org.slf4j.LoggerFactory;
22273 amit.gupta 17
import org.springframework.beans.factory.annotation.Autowired;
21339 kshitij.so 18
import org.springframework.beans.factory.annotation.Value;
19
import org.springframework.http.HttpStatus;
20
import org.springframework.http.MediaType;
21
import org.springframework.http.ResponseEntity;
22
import org.springframework.stereotype.Controller;
22286 amit.gupta 23
import org.springframework.transaction.annotation.Transactional;
21339 kshitij.so 24
import org.springframework.web.bind.annotation.PathVariable;
25
import org.springframework.web.bind.annotation.RequestMapping;
26
import org.springframework.web.bind.annotation.RequestMethod;
27
import org.springframework.web.bind.annotation.RequestParam;
28
 
29
import com.eclipsesource.json.Json;
30
import com.eclipsesource.json.JsonArray;
31
import com.eclipsesource.json.JsonObject;
32
import com.eclipsesource.json.JsonValue;
33
import com.google.gson.Gson;
21356 kshitij.so 34
import com.google.gson.reflect.TypeToken;
21643 ashik.ali 35
import com.spice.profitmandi.common.enumuration.SchemeType;
21339 kshitij.so 36
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
37
import com.spice.profitmandi.common.model.ProfitMandiConstants;
21740 ashik.ali 38
import com.spice.profitmandi.common.model.ProfitMandiResponse;
39
import com.spice.profitmandi.common.model.ResponseStatus;
22289 amit.gupta 40
import com.spice.profitmandi.common.model.UserInfo;
21643 ashik.ali 41
import com.spice.profitmandi.common.web.client.RestClient;
22319 amit.gupta 42
import com.spice.profitmandi.common.web.util.ResponseSender;
22289 amit.gupta 43
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
22361 amit.gupta 44
import com.spice.profitmandi.dao.model.UserCart;
22333 amit.gupta 45
import com.spice.profitmandi.dao.repository.dtr.Mongo;
22361 amit.gupta 46
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
22931 ashik.ali 47
import com.spice.profitmandi.service.inventory.InventoryService;
22287 amit.gupta 48
import com.spice.profitmandi.service.pricing.PricingService;
21356 kshitij.so 49
import com.spice.profitmandi.web.res.DealBrands;
21339 kshitij.so 50
import com.spice.profitmandi.web.res.DealObjectResponse;
51
import com.spice.profitmandi.web.res.DealsResponse;
22328 amit.gupta 52
import com.spice.profitmandi.web.res.FofoAvailabilityInfo;
53
import com.spice.profitmandi.web.res.FofoCatalogResponse;
21339 kshitij.so 54
 
55
import io.swagger.annotations.ApiImplicitParam;
56
import io.swagger.annotations.ApiImplicitParams;
57
import io.swagger.annotations.ApiOperation;
58
 
59
@Controller
22319 amit.gupta 60
@Transactional(rollbackFor = Throwable.class)
21339 kshitij.so 61
public class DealsController {
62
 
22319 amit.gupta 63
	private static final Logger logger = LoggerFactory.getLogger(DealsController.class);
21339 kshitij.so 64
 
65
	@Value("${python.api.host}")
66
	private String host;
22931 ashik.ali 67
 
21339 kshitij.so 68
	@Value("${python.api.port}")
69
	private int port;
22708 amit.gupta 70
 
22710 amit.gupta 71
	@Value("${fofo.warehouseIds}")
22708 amit.gupta 72
	private int[] warehouseIds; 
22319 amit.gupta 73
 
74
	@Autowired
75
	private PricingService pricingService;
22273 amit.gupta 76
 
77
	@Autowired
22333 amit.gupta 78
	private Mongo mongoClient;
79
 
80
	@Autowired
22361 amit.gupta 81
	private UserAccountRepository userAccountRepository;
82
 
83
	@Autowired
22931 ashik.ali 84
	private ResponseSender<?> responseSender;
22336 amit.gupta 85
 
22554 amit.gupta 86
	@Autowired
22931 ashik.ali 87
	private InventoryService inventoryService;
22401 amit.gupta 88
 
22554 amit.gupta 89
 
22336 amit.gupta 90
	List<String> filterableParams = Arrays.asList("brand");
21339 kshitij.so 91
 
22319 amit.gupta 92
	@RequestMapping(value = ProfitMandiConstants.URL_DEALS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
21339 kshitij.so 93
	@ApiImplicitParams({
22319 amit.gupta 94
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
21339 kshitij.so 95
	@ApiOperation(value = "Get deals")
22319 amit.gupta 96
	public ResponseEntity<?> getDeals(HttpServletRequest request, @RequestParam(value = "categoryId") String categoryId,
97
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
98
			@RequestParam(value = "sort", required = false) String sort,
99
			@RequestParam(value = "direction", required = false) String direction,
22931 ashik.ali 100
			@RequestParam(value = "filterData", required = false) String filterData) throws ProfitMandiBusinessException {
22319 amit.gupta 101
		logger.info("Request " + request.getParameterMap());
21339 kshitij.so 102
		String response = null;
22319 amit.gupta 103
		int userId = (int) request.getAttribute("userId");
104
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
105
		// TODO: move to properties
106
		String uri = "/deals/" + userId;
107
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
21339 kshitij.so 108
		Map<String, String> params = new HashMap<>();
109
		params.put("offset", offset);
110
		params.put("limit", limit);
111
		params.put("categoryId", categoryId);
112
		params.put("direction", direction);
113
		params.put("sort", sort);
114
		params.put("filterData", filterData);
22272 amit.gupta 115
		params.put("source", "deals");
22319 amit.gupta 116
		if (userInfo.getRoleNames().contains(RoleType.FOFO.toString())) {
22289 amit.gupta 117
			params.put("tag_ids", getCommaSeparateTags(userId));
118
		}
21356 kshitij.so 119
		List<Object> responseObject = new ArrayList<>();
22931 ashik.ali 120
		response = rc.get(uri, params);
121
 
21339 kshitij.so 122
		JsonArray result_json = Json.parse(response).asArray();
22319 amit.gupta 123
		for (JsonValue j : result_json) {
22842 amit.gupta 124
			//logger.info("res " + j.asArray());
21339 kshitij.so 125
			List<Object> innerObject = new ArrayList<>();
22319 amit.gupta 126
			for (JsonValue jsonObject : j.asArray()) {
21356 kshitij.so 127
				innerObject.add(toDealObject(jsonObject.asObject()));
21339 kshitij.so 128
			}
22319 amit.gupta 129
			if (innerObject.size() > 0) {
21339 kshitij.so 130
				responseObject.add(innerObject);
131
			}
132
		}
22319 amit.gupta 133
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
134
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
135
				responseObject);
136
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
21339 kshitij.so 137
	}
138
 
22931 ashik.ali 139
	private String getCommaSeparateTags(int userId){
22361 amit.gupta 140
		UserCart uc = userAccountRepository.getUserCart(userId);
141
		List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
22287 amit.gupta 142
		List<String> strTagIds = new ArrayList<>();
143
		for (Integer tagId : tagIds) {
144
			strTagIds.add(String.valueOf(tagId));
22273 amit.gupta 145
		}
22287 amit.gupta 146
		return String.join(",", strTagIds);
22273 amit.gupta 147
	}
148
 
22319 amit.gupta 149
	@ApiImplicitParams({
150
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
151
	@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
152
	public ResponseEntity<?> getFofo(HttpServletRequest request, @RequestParam(value = "categoryId") String categoryId,
153
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
22336 amit.gupta 154
			@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "brand", required = false) String brand) throws Throwable {
22328 amit.gupta 155
		List<FofoCatalogResponse> dealResponse = new ArrayList<>();
22319 amit.gupta 156
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
157
		if (userInfo.getRoleNames().contains(RoleType.FOFO.toString())) {
22361 amit.gupta 158
			UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
159
			List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
22319 amit.gupta 160
			RestClient rc  = new RestClient(SchemeType.HTTP, "dtr", 8984);
161
			Map<String, String> params = new HashMap<>();
22336 amit.gupta 162
			List<String> mandatoryQ = new ArrayList<>();
163
			if(brand != null) {
22347 amit.gupta 164
 
22348 amit.gupta 165
				mandatoryQ.add(String.format("+{!parent which=\"brand_s=%s\"} tagId_i:(%s)", brand, StringUtils.join(tagIds, " ")));
22347 amit.gupta 166
			} else {
167
				mandatoryQ.add(String.format("+{!parent which=\"id:catalog*\"} tagId_i:(%s)", StringUtils.join(tagIds, " ")));
22336 amit.gupta 168
			}
22340 amit.gupta 169
			params.put("q", StringUtils.join(mandatoryQ," "));
22319 amit.gupta 170
			params.put("fl", "*, [child parentFilter=id:catalog*]");
171
			params.put("sort", "rank_i asc");
172
			params.put("start", String.valueOf(offset));
173
			params.put("rows", String.valueOf(limit));
174
			params.put("wt", "json");
22330 amit.gupta 175
			logger.info(rc.getUrl());
22319 amit.gupta 176
			String response  =rc.get("solr/demo/select", params);
177
			JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
178
			JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
179
			for(int i=0; i < docs.length(); i++) {
22328 amit.gupta 180
				Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
22319 amit.gupta 181
				JSONObject doc = docs.getJSONObject(i);
22328 amit.gupta 182
				FofoCatalogResponse ffdr = new FofoCatalogResponse();
22319 amit.gupta 183
				ffdr.setCatalogId(doc.getInt("catalogId_i"));
184
				ffdr.setImageUrl(doc.getString("imageUrl_s"));
185
				ffdr.setTitle(doc.getString("title_s"));
22333 amit.gupta 186
				ffdr.setBrand(doc.getString("brand_s"));
22323 amit.gupta 187
				for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
188
					JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
22319 amit.gupta 189
					int itemId = childItem.getInt("itemId_i");
190
					float sellingPrice = (float)childItem.getDouble("sellingPrice_f");
22328 amit.gupta 191
					if(fofoAvailabilityInfoMap.containsKey(itemId)) {
192
						if(fofoAvailabilityInfoMap.get(itemId).getSellingPrice() > sellingPrice) {
193
							fofoAvailabilityInfoMap.get(itemId).setSellingPrice(sellingPrice);
194
							fofoAvailabilityInfoMap.get(itemId).setMop((float)childItem.getDouble("mop_f"));
22319 amit.gupta 195
						} 
196
					} else {
22328 amit.gupta 197
							FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
22319 amit.gupta 198
							fdi.setSellingPrice((float)childItem.getDouble("sellingPrice_f"));
199
							fdi.setMop((float)childItem.getDouble("mop_f"));
22324 amit.gupta 200
							fdi.setColor(childItem.has("color_s")?childItem.getString("color_s"): "");
22319 amit.gupta 201
							fdi.setTagId(childItem.getInt("tagId_i"));
22328 amit.gupta 202
							fdi.setItem_id(itemId);
22708 amit.gupta 203
							fdi.setAvailability(inventoryService.getCachedAvailabilityByItemIdWarehouseIds(itemId, warehouseIds));
22328 amit.gupta 204
							fdi.setQuantityStep(1);
205
							fdi.setMinBuyQuantity(1);
22561 amit.gupta 206
							fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
22328 amit.gupta 207
							fofoAvailabilityInfoMap.put(itemId, fdi);
22319 amit.gupta 208
					}
209
				}
22328 amit.gupta 210
				ffdr.setItems(new ArrayList<FofoAvailabilityInfo>(fofoAvailabilityInfoMap.values()));
22319 amit.gupta 211
				dealResponse.add(ffdr);
212
			}
213
 
214
		} else {
215
			return responseSender.badRequest(new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
216
		}
217
		return responseSender.ok(dealResponse);
218
	}
22273 amit.gupta 219
 
22319 amit.gupta 220
	@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
22272 amit.gupta 221
	@ApiImplicitParams({
22319 amit.gupta 222
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
22272 amit.gupta 223
	@ApiOperation(value = "Get online deals")
22319 amit.gupta 224
	public ResponseEntity<?> getOnlineDeals(HttpServletRequest request,
225
			@RequestParam(value = "categoryId") String categoryId, @RequestParam(value = "offset") String offset,
226
			@RequestParam(value = "limit") String limit, @RequestParam(value = "sort", required = false) String sort,
227
			@RequestParam(value = "direction", required = false) String direction,
228
			@RequestParam(value = "filterData", required = false) String filterData) throws Throwable {
229
		logger.info("Request " + request.getParameterMap());
22272 amit.gupta 230
		String response = null;
22319 amit.gupta 231
		int userId = (int) request.getAttribute("userId");
22289 amit.gupta 232
 
22319 amit.gupta 233
		String uri = "/deals/" + userId;
234
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
22272 amit.gupta 235
		Map<String, String> params = new HashMap<>();
236
		params.put("offset", offset);
237
		params.put("limit", limit);
238
		params.put("categoryId", categoryId);
239
		params.put("direction", direction);
240
		params.put("sort", sort);
241
		params.put("source", "online");
242
		params.put("filterData", filterData);
22357 amit.gupta 243
		/*if (userInfo.getRoleNames().contains(RoleType.FOFO.toString())) {
22289 amit.gupta 244
			params.put("tag_ids", getCommaSeparateTags(userId));
22357 amit.gupta 245
		}*/
22272 amit.gupta 246
		List<Object> responseObject = new ArrayList<>();
22931 ashik.ali 247
		response = rc.get(uri, params);
248
 
22272 amit.gupta 249
		JsonArray result_json = Json.parse(response).asArray();
22319 amit.gupta 250
		for (JsonValue j : result_json) {
22843 amit.gupta 251
			//logger.info("res " + j.asArray());
22272 amit.gupta 252
			List<Object> innerObject = new ArrayList<>();
22319 amit.gupta 253
			for (JsonValue jsonObject : j.asArray()) {
22272 amit.gupta 254
				innerObject.add(toDealObject(jsonObject.asObject()));
255
			}
22319 amit.gupta 256
			if (innerObject.size() > 0) {
22272 amit.gupta 257
				responseObject.add(innerObject);
258
			}
259
		}
22319 amit.gupta 260
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
261
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
262
				responseObject);
263
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
22272 amit.gupta 264
	}
265
 
22319 amit.gupta 266
	/*
267
	 * @RequestMapping(value = "/direct-deals",
268
	 * method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
269
	 * 
270
	 * @ApiImplicitParams({
271
	 * 
272
	 * @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required =
273
	 * true, dataType = "string", paramType = "header") }) public
274
	 * ResponseEntity<?> getDirectDeals(HttpServletRequest
275
	 * request, @RequestParam(value="categoryId") String
276
	 * categoryId,@RequestParam(value="offset") String offset,
277
	 * 
278
	 * @RequestParam(value="limit") String limit, @RequestParam(value="sort",
279
	 * required=false) String sort, @RequestParam(value="direction",
280
	 * required=false) String direction,
281
	 * 
282
	 * @RequestParam(value="filterData", required=false) String filterData ){
283
	 * 
284
	 * return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK); }
285
	 */
286
 
287
	private Object toDealObject(JsonObject jsonObject) {
288
		if (jsonObject.get("dealObject") != null && jsonObject.get("dealObject").asInt() == 1) {
21339 kshitij.so 289
			return new Gson().fromJson(jsonObject.toString(), DealObjectResponse.class);
290
		}
291
		return new Gson().fromJson(jsonObject.toString(), DealsResponse.class);
292
	}
22319 amit.gupta 293
 
294
	@RequestMapping(value = ProfitMandiConstants.URL_BRANDS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
21356 kshitij.so 295
	@ApiImplicitParams({
22319 amit.gupta 296
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
21356 kshitij.so 297
	@ApiOperation(value = "Get brand list and count for category")
22319 amit.gupta 298
	public ResponseEntity<?> getBrands(HttpServletRequest request,
22931 ashik.ali 299
			@RequestParam(value = "category_id") String category_id) throws ProfitMandiBusinessException{
22319 amit.gupta 300
		logger.info("Request " + request.getParameterMap());
21356 kshitij.so 301
		String response = null;
22319 amit.gupta 302
		// TODO: move to properties
21356 kshitij.so 303
		String uri = ProfitMandiConstants.URL_BRANDS;
22319 amit.gupta 304
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
21356 kshitij.so 305
		Map<String, String> params = new HashMap<>();
306
		params.put("category_id", category_id);
21358 kshitij.so 307
		List<DealBrands> dealBrandsResponse = null;
22931 ashik.ali 308
		response = rc.get(uri, params);
309
 
22319 amit.gupta 310
		dealBrandsResponse = new Gson().fromJson(response, new TypeToken<List<DealBrands>>() {
311
		}.getType());
312
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
313
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
314
				dealBrandsResponse);
315
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
21356 kshitij.so 316
	}
22319 amit.gupta 317
 
318
	@RequestMapping(value = ProfitMandiConstants.URL_UNIT_DEAL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
21445 kshitij.so 319
	@ApiImplicitParams({
22319 amit.gupta 320
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
21445 kshitij.so 321
	@ApiOperation(value = "Get unit deal object")
22931 ashik.ali 322
	public ResponseEntity<?> getUnitDeal(HttpServletRequest request, @PathVariable(value = "id") long id) 
323
			throws ProfitMandiBusinessException{
21445 kshitij.so 324
		String response = null;
22319 amit.gupta 325
		// TODO: move to properties
326
		String uri = "getDealById/" + id;
327
		System.out.println("Unit deal " + uri);
328
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
21445 kshitij.so 329
		Map<String, String> params = new HashMap<>();
330
		DealsResponse dealsResponse = null;
22931 ashik.ali 331
		response = rc.get(uri, params);
332
 
21445 kshitij.so 333
		JsonObject result_json = Json.parse(response).asObject();
22319 amit.gupta 334
		if (!result_json.isEmpty()) {
21445 kshitij.so 335
			dealsResponse = new Gson().fromJson(response, DealsResponse.class);
336
		}
22319 amit.gupta 337
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
338
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
339
				dealsResponse);
340
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
21445 kshitij.so 341
	}
22333 amit.gupta 342
 
343
	@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
344
	public ResponseEntity<?> getBrandsToDisplay() {
345
		return new ResponseEntity<>(mongoClient.getBrandsToDisplay(), HttpStatus.OK);
346
	}
22401 amit.gupta 347
 
22446 amit.gupta 348
	@RequestMapping(value = "/banners/{bannerType}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
22448 amit.gupta 349
	public ResponseEntity<?> getBanners(@PathVariable String bannerType) {
22447 amit.gupta 350
		return new ResponseEntity<>(mongoClient.getBannersByType(bannerType), HttpStatus.OK);
22446 amit.gupta 351
	}
352
 
22406 amit.gupta 353
	@ApiImplicitParams({
354
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })	
22401 amit.gupta 355
	@RequestMapping(value = "/deals/skus/{skus}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
22931 ashik.ali 356
	public ResponseEntity<?> getDealsBySkus(@PathVariable String skus) throws ProfitMandiBusinessException {
22401 amit.gupta 357
		StringBuffer sb = new StringBuffer("/getDealsForNotification/");
358
		String uri = sb.append(skus).toString();
359
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
360
		String response = rc.get(uri, new HashMap<>());
22406 amit.gupta 361
		JsonArray result_json = Json.parse(response).asArray();
22407 amit.gupta 362
		List<Object> responseObject = new ArrayList<>();
363
		for (JsonValue j : result_json) {
22843 amit.gupta 364
			//logger.info("res " + j.asArray());
22407 amit.gupta 365
			List<Object> innerObject = new ArrayList<>();
366
			for (JsonValue jsonObject : j.asArray()) {
367
				innerObject.add(toDealObject(jsonObject.asObject()));
368
			}
369
			if (innerObject.size() > 0) {
370
				responseObject.add(innerObject);
371
			}
372
		}
22408 amit.gupta 373
		return responseSender.ok(responseObject);
22401 amit.gupta 374
	}
21339 kshitij.so 375
 
376
}