Subversion Repositories SmartDukaan

Rev

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

Rev 24123 Rev 24203
Line 44... Line 44...
44
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
44
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
45
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
45
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
46
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
46
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
47
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
47
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
48
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
48
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
-
 
49
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
49
import com.spice.profitmandi.service.inventory.InventoryService;
50
import com.spice.profitmandi.service.inventory.InventoryService;
50
import com.spice.profitmandi.web.model.LoginDetails;
51
import com.spice.profitmandi.web.model.LoginDetails;
51
import com.spice.profitmandi.web.util.CookiesProcessor;
52
import com.spice.profitmandi.web.util.CookiesProcessor;
52
import com.spice.profitmandi.web.util.MVCResponseSender;
53
import com.spice.profitmandi.web.util.MVCResponseSender;
53
 
54
 
Line 61... Line 62...
61
	private CookiesProcessor cookiesProcessor;
62
	private CookiesProcessor cookiesProcessor;
62
 
63
 
63
	@Autowired
64
	@Autowired
64
	@Qualifier("fofoInventoryService")
65
	@Qualifier("fofoInventoryService")
65
	private InventoryService inventoryService;
66
	private InventoryService inventoryService;
-
 
67
	
-
 
68
	@Autowired
-
 
69
	private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
66
 
70
 
67
	@Autowired
71
	@Autowired
68
	private TagRankingRepository tagRankingRepository;
72
	private TagRankingRepository tagRankingRepository;
69
 
73
 
70
	@Autowired
74
	@Autowired
Line 134... Line 138...
134
			throws ProfitMandiBusinessException {
138
			throws ProfitMandiBusinessException {
135
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
139
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
136
		if (searchTerm == null) {
140
		if (searchTerm == null) {
137
			searchTerm = "";
141
			searchTerm = "";
138
		}
142
		}
-
 
143
		
139
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
144
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
140
		model.addAllAttributes(map);
145
		model.addAllAttributes(map);
-
 
146
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
141
		return "catalog";
147
		return "catalog";
142
	}
148
	}
-
 
149
	
-
 
150
 
-
 
151
	//This method is currently hardcoded to faciliate watches sold as gift.
-
 
152
	private boolean hasGift(int fofoId) {
-
 
153
		try {
-
 
154
			return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId).getAvailability() > 0;
-
 
155
		} catch (ProfitMandiBusinessException e) {
-
 
156
			return false;
-
 
157
		}
-
 
158
	}
143
 
159
 
144
	@RequestMapping(value = "/getPaginatedCatalog")
160
	@RequestMapping(value = "/getPaginatedCatalog")
145
	public String getCatalogPaginated(HttpServletRequest request,
161
	public String getCatalogPaginated(HttpServletRequest request,
146
			@RequestParam(name = "offset", defaultValue = "0") int offset,
162
			@RequestParam(name = "offset", defaultValue = "0") int offset,
147
			@RequestParam(name = "limit", defaultValue = "10") int limit,
163
			@RequestParam(name = "limit", defaultValue = "10") int limit,