Subversion Repositories SmartDukaan

Rev

Rev 22990 | Rev 23300 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22990 Rev 23022
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.time.LocalDateTime;
-
 
4
import java.util.ArrayList;
3
import java.util.ArrayList;
5
import java.util.Arrays;
4
import java.util.Arrays;
6
import java.util.HashMap;
5
import java.util.HashMap;
7
import java.util.Iterator;
6
import java.util.Iterator;
8
import java.util.List;
7
import java.util.List;
Line 34... Line 33...
34
import com.google.gson.Gson;
33
import com.google.gson.Gson;
35
import com.google.gson.reflect.TypeToken;
34
import com.google.gson.reflect.TypeToken;
36
import com.spice.profitmandi.common.enumuration.SchemeType;
35
import com.spice.profitmandi.common.enumuration.SchemeType;
37
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
36
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
38
import com.spice.profitmandi.common.model.ProfitMandiConstants;
37
import com.spice.profitmandi.common.model.ProfitMandiConstants;
39
import com.spice.profitmandi.common.model.ProfitMandiResponse;
-
 
40
import com.spice.profitmandi.common.model.ResponseStatus;
-
 
41
import com.spice.profitmandi.common.model.UserInfo;
38
import com.spice.profitmandi.common.model.UserInfo;
42
import com.spice.profitmandi.common.web.client.RestClient;
39
import com.spice.profitmandi.common.web.client.RestClient;
43
import com.spice.profitmandi.common.web.util.ResponseSender;
40
import com.spice.profitmandi.common.web.util.ResponseSender;
44
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
41
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
45
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
42
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
Line 141... Line 138...
141
			}
138
			}
142
			if (innerObject.size() > 0) {
139
			if (innerObject.size() > 0) {
143
				responseObject.add(innerObject);
140
				responseObject.add(innerObject);
144
			}
141
			}
145
		}
142
		}
146
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
-
 
147
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
-
 
148
				responseObject);
-
 
149
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
143
		return responseSender.ok(responseObject);
150
	}
144
	}
151
 
145
 
152
	private String getCommaSeparateTags(int userId){
146
	private String getCommaSeparateTags(int userId){
153
		UserCart uc = userAccountRepository.getUserCart(userId);
147
		UserCart uc = userAccountRepository.getUserCart(userId);
154
		List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
148
		List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
Line 279... Line 273...
279
			}
273
			}
280
			if (innerObject.size() > 0) {
274
			if (innerObject.size() > 0) {
281
				responseObject.add(innerObject);
275
				responseObject.add(innerObject);
282
			}
276
			}
283
		}
277
		}
284
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
-
 
285
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
-
 
286
				responseObject);
-
 
287
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
278
		return responseSender.ok(responseObject);
288
	}
279
	}
289
 
280
 
290
	/*
281
	/*
291
	 * @RequestMapping(value = "/direct-deals",
282
	 * @RequestMapping(value = "/direct-deals",
292
	 * method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
283
	 * method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
Line 331... Line 322...
331
		List<DealBrands> dealBrandsResponse = null;
322
		List<DealBrands> dealBrandsResponse = null;
332
		response = rc.get(uri, params);
323
		response = rc.get(uri, params);
333
		
324
		
334
		dealBrandsResponse = new Gson().fromJson(response, new TypeToken<List<DealBrands>>() {
325
		dealBrandsResponse = new Gson().fromJson(response, new TypeToken<List<DealBrands>>() {
335
		}.getType());
326
		}.getType());
336
		final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
-
 
337
				request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
-
 
338
				dealBrandsResponse);
-
 
-
 
327
 
339
		return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
328
		return responseSender.ok(dealBrandsResponse);
340
	}
329
	}
341
 
330
 
342
	@RequestMapping(value = ProfitMandiConstants.URL_UNIT_DEAL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
331
	@RequestMapping(value = ProfitMandiConstants.URL_UNIT_DEAL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
343
	@ApiImplicitParams({
332
	@ApiImplicitParams({
344
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
333
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
Line 400... Line 389...
400
				responseObject.add(innerObject);
389
				responseObject.add(innerObject);
401
			}
390
			}
402
		}
391
		}
403
		return responseSender.ok(responseObject);
392
		return responseSender.ok(responseObject);
404
	}
393
	}
405
	
-
 
406
	/*@RequestMapping(value = "/deals/pincode/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
407
	public ResponseEntity<?> getDealsByPinCode (@PathVariable String pincode, 
-
 
408
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit) throws ProfitMandiBusinessException{
-
 
409
			
-
 
410
			return responseSender.ok("");
-
 
411
	}*/
-
 
412
 
394
 
413
}
395
}