Subversion Repositories SmartDukaan

Rev

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

Rev 30414 Rev 30494
Line 65... Line 65...
65
import java.util.stream.Collectors;
65
import java.util.stream.Collectors;
66
 
66
 
67
@Controller
67
@Controller
68
@Transactional(rollbackOn = Throwable.class)
68
@Transactional(rollbackOn = Throwable.class)
69
public class SchemeController {
69
public class SchemeController {
-
 
70
	//LED TV
-
 
71
	private static final List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.MOBILE_CATEGORY_ID, ProfitMandiConstants.TABLET_CATEGORY_ID, 14202);
70
 
72
 
71
	private static final Logger LOGGER = LogManager.getLogger(SchemeController.class);
73
	private static final Logger LOGGER = LogManager.getLogger(SchemeController.class);
72
 
74
 
73
	@Autowired
75
	@Autowired
74
	private SchemeService schemeService;
76
	private SchemeService schemeService;
Line 150... Line 152...
150
	private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
152
	private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
151
 
153
 
152
	@Autowired
154
	@Autowired
153
	private CsService csService;
155
	private CsService csService;
154
 
156
 
-
 
157
	@Autowired
-
 
158
	private CategoryRepository categoryRepository;
-
 
159
 
155
	List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
160
	List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
156
			"amit.gupta@shop2020.in", "manish.tiwari@smartdukaan.com", "tejbeer.kaur@shop2020.in");
161
			"amit.gupta@shop2020.in", "manish.tiwari@smartdukaan.com", "tejbeer.kaur@shop2020.in");
157
 
162
 
158
	@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
163
	@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
159
	public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
164
	public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
Line 164... Line 169...
164
		model.addAttribute("month", month);
169
		model.addAttribute("month", month);
165
 
170
 
166
		// Map<Integer, String> itemIdItemDescriptionMap =
171
		// Map<Integer, String> itemIdItemDescriptionMap =
167
		// inventoryService.getAllItemIdItemDescriptionMap();
172
		// inventoryService.getAllItemIdItemDescriptionMap();
168
		// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
173
		// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
169
 
-
 
-
 
174
		//List<Category> categories = inventoryService.getAllCategories();
-
 
175
		List<Category> categories = categoryRepository.selectByIds(categoryIds);
-
 
176
		categories = categories.stream().sorted(Comparator.comparing(Category::getId)).collect(Collectors.toList());
170
		Set<String> brands = inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
177
		//Set<String> brands = inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
171
 
-
 
172
		brands.addAll(inventoryService.getAllTagListingBrands(14206));
178
		//brands.addAll(inventoryService.getAllTagListingBrands(14206));
173
 
179
 
174
		boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
180
		boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
175
 
181
 
176
		model.addAttribute("fullAccesss", fullAccesss);
182
		model.addAttribute("fullAccesss", fullAccesss);
177
 
183
 
178
		model.addAttribute("brands", brands);
184
		model.addAttribute("categories", categories);
179
		model.addAttribute("retailerTypes", PartnerType.values());
185
		model.addAttribute("retailerTypes", PartnerType.values());
180
		return "create-scheme";
186
		return "create-scheme";
181
	}
187
	}
182
 
188
 
183
	private boolean getAccess(String emailId) {
189
	private boolean getAccess(String emailId) {
Line 211... Line 217...
211
		// model.addAttribute("brands", inventoryService.getAllBrands());
217
		// model.addAttribute("brands", inventoryService.getAllBrands());
212
 
218
 
213
		return "tag-listing-items-description";
219
		return "tag-listing-items-description";
214
	}
220
	}
215
 
221
 
-
 
222
	@RequestMapping(value = "/getBrandsByCategory", method = RequestMethod.GET)
-
 
223
	public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, Model model) throws Exception {
-
 
224
		Set<String> brands = inventoryService
-
 
225
				.getAllTagListingBrands(categoryId);
-
 
226
		model.addAttribute("brands", brands);
-
 
227
 
-
 
228
		return "tag-listing-brands";
-
 
229
	}
-
 
230
 
216
	@RequestMapping(value = "/schemes/update-schemes-page", method = RequestMethod.GET)
231
	@RequestMapping(value = "/schemes/update-schemes-page", method = RequestMethod.GET)
217
	public String updateShcemes(HttpServletRequest request) throws ProfitMandiBusinessException {
232
	public String updateShcemes(HttpServletRequest request) throws ProfitMandiBusinessException {
218
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
233
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
219
		if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
234
		if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
220
			throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");
235
			throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");