| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.File;
|
- |
|
| 4 |
import java.io.FileInputStream;
|
- |
|
| 5 |
import java.io.FileNotFoundException;
|
- |
|
| 6 |
import java.time.Instant;
|
- |
|
| 7 |
import java.time.LocalDate;
|
- |
|
| 8 |
import java.time.LocalDateTime;
|
- |
|
| 9 |
import java.util.AbstractMap;
|
- |
|
| 10 |
import java.util.ArrayList;
|
- |
|
| 11 |
import java.util.Arrays;
|
- |
|
| 12 |
import java.util.Date;
|
- |
|
| 13 |
import java.util.HashMap;
|
- |
|
| 14 |
import java.util.HashSet;
|
- |
|
| 15 |
import java.util.List;
|
- |
|
| 16 |
import java.util.Map;
|
- |
|
| 17 |
import java.util.Set;
|
- |
|
| 18 |
import java.util.stream.Collectors;
|
- |
|
| 19 |
|
- |
|
| 20 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 21 |
import javax.transaction.Transactional;
|
- |
|
| 22 |
|
- |
|
| 23 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 24 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 25 |
import org.json.JSONObject;
|
- |
|
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 27 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 28 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 29 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 30 |
import org.springframework.http.HttpStatus;
|
- |
|
| 31 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 32 |
import org.springframework.stereotype.Controller;
|
- |
|
| 33 |
import org.springframework.ui.Model;
|
- |
|
| 34 |
import org.springframework.web.bind.annotation.GetMapping;
|
- |
|
| 35 |
import org.springframework.web.bind.annotation.PostMapping;
|
- |
|
| 36 |
import org.springframework.web.bind.annotation.RequestBody;
|
- |
|
| 37 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 38 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 39 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 40 |
|
- |
|
| 41 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
3 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 42 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
4 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 43 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
5 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
| 44 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 45 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
- |
|
| 46 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| 47 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 48 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
- |
|
| 49 |
import com.spice.profitmandi.common.model.SelectStorePartnerInfo;
|
- |
|
| 50 |
import com.spice.profitmandi.common.model.SendMessageModel;
|
- |
|
| 51 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
- |
|
| 52 |
import com.spice.profitmandi.common.util.Utils;
|
8 |
import com.spice.profitmandi.common.util.Utils;
|
| 53 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 54 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
10 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 55 |
import com.spice.profitmandi.dao.entity.dtr.BrandLimit;
|
- |
|
| 56 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
- |
|
| 57 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
- |
|
| 58 |
import com.spice.profitmandi.dao.entity.dtr.RetailerBlockBrands;
|
- |
|
| 59 |
import com.spice.profitmandi.dao.entity.dtr.RetailerBrandsLimit;
|
- |
|
| 60 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
11 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
12 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
- |
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
- |
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
- |
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
- |
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
- |
|
| 67 |
import com.spice.profitmandi.dao.entity.user.Location;
|
13 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 68 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
14 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 69 |
import com.spice.profitmandi.dao.entity.user.User;
|
15 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 70 |
|
- |
|
| 71 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
16 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 72 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
17 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 73 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
18 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
| 74 |
import com.spice.profitmandi.dao.repository.dtr.BrandLimitRepository;
|
- |
|
| 75 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
- |
|
| 76 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
- |
|
| 77 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
19 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 78 |
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
|
- |
|
| 79 |
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
|
- |
|
| 80 |
import com.spice.profitmandi.dao.repository.dtr.RetailerBrandsLimitRepository;
|
- |
|
| 81 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
- |
|
| 82 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
20 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
21 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
22 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.user.LocationRepository;
|
23 |
import com.spice.profitmandi.dao.repository.user.LocationRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
24 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
| Line 91... |
Line 28... |
| 91 |
import com.spice.profitmandi.service.user.RetailerService;
|
28 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 92 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
29 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
| 93 |
import com.spice.profitmandi.web.model.LoginDetails;
|
30 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 94 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
31 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 95 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
32 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| - |
|
33 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
34 |
import org.apache.logging.log4j.Logger;
|
| - |
|
35 |
import org.json.JSONObject;
|
| - |
|
36 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
37 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
38 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
39 |
import org.springframework.http.HttpHeaders;
|
| - |
|
40 |
import org.springframework.http.HttpStatus;
|
| - |
|
41 |
import org.springframework.http.ResponseEntity;
|
| - |
|
42 |
import org.springframework.stereotype.Controller;
|
| - |
|
43 |
import org.springframework.ui.Model;
|
| - |
|
44 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
45 |
|
| - |
|
46 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
47 |
import javax.transaction.Transactional;
|
| - |
|
48 |
import java.io.File;
|
| - |
|
49 |
import java.io.FileInputStream;
|
| - |
|
50 |
import java.io.FileNotFoundException;
|
| - |
|
51 |
import java.time.LocalDate;
|
| - |
|
52 |
import java.time.LocalDateTime;
|
| - |
|
53 |
import java.util.*;
|
| - |
|
54 |
import java.util.stream.Collectors;
|
| 96 |
|
55 |
|
| 97 |
@Controller
|
56 |
@Controller
|
| 98 |
@Transactional(rollbackOn = Throwable.class)
|
57 |
@Transactional(rollbackOn = Throwable.class)
|
| 99 |
public class RetailerController {
|
58 |
public class RetailerController {
|
| 100 |
|
59 |
|
| Line 176... |
Line 135... |
| 176 |
@Autowired
|
135 |
@Autowired
|
| 177 |
private StoreTimelineTatService storeTimelineTatService;
|
136 |
private StoreTimelineTatService storeTimelineTatService;
|
| 178 |
|
137 |
|
| 179 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
138 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
| 180 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
139 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
| 181 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
140 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
| 182 |
Model model) throws ProfitMandiBusinessException {
|
141 |
Model model) throws ProfitMandiBusinessException {
|
| 183 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
142 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
| 184 |
emailIdOrMobileNumber);
|
143 |
emailIdOrMobileNumber);
|
| 185 |
|
144 |
|
| 186 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
145 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
| 187 |
|
146 |
|
| Line 205... |
Line 164... |
| 205 |
return "retailer-details";
|
164 |
return "retailer-details";
|
| 206 |
}
|
165 |
}
|
| 207 |
|
166 |
|
| 208 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
167 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
| 209 |
public String updateRetailerDetails(HttpServletRequest request,
|
168 |
public String updateRetailerDetails(HttpServletRequest request,
|
| 210 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
169 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
| 211 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
170 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
| 212 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
171 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
| 213 |
|
172 |
|
| 214 |
model.addAllAttributes(map);
|
173 |
model.addAllAttributes(map);
|
| 215 |
model.addAttribute("counterSizes", CounterSize.values());
|
174 |
model.addAttribute("counterSizes", CounterSize.values());
|
| Line 230... |
Line 189... |
| 230 |
return responseSender.ok(retailerService.getAllDistrictMaster(stateName));
|
189 |
return responseSender.ok(retailerService.getAllDistrictMaster(stateName));
|
| 231 |
}
|
190 |
}
|
| 232 |
|
191 |
|
| 233 |
@RequestMapping(value = "/retailerDocument/documentId", method = RequestMethod.GET)
|
192 |
@RequestMapping(value = "/retailerDocument/documentId", method = RequestMethod.GET)
|
| 234 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
193 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
| 235 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId,
|
194 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId,
|
| 236 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
195 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
| 237 |
Document document = documentRepository.selectById(documentId);
|
196 |
Document document = documentRepository.selectById(documentId);
|
| 238 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
197 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 239 |
|
198 |
|
| 240 |
if (retailer.getDocumentId() == null) {
|
199 |
if (retailer.getDocumentId() == null) {
|
| 241 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
200 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
| Line 246... |
Line 205... |
| 246 |
return responseSender.ok(document);
|
205 |
return responseSender.ok(document);
|
| 247 |
}
|
206 |
}
|
| 248 |
|
207 |
|
| 249 |
@RequestMapping(value = "/retailerDocument/download", method = RequestMethod.GET)
|
208 |
@RequestMapping(value = "/retailerDocument/download", method = RequestMethod.GET)
|
| 250 |
public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request,
|
209 |
public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request,
|
| 251 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
210 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
| 252 |
throws ProfitMandiBusinessException {
|
211 |
throws ProfitMandiBusinessException {
|
| 253 |
|
212 |
|
| 254 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
213 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 255 |
|
214 |
|
| 256 |
if (retailer.getDocumentId() == null) {
|
215 |
if (retailer.getDocumentId() == null) {
|
| Line 289... |
Line 248... |
| 289 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
248 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 290 |
}
|
249 |
}
|
| 291 |
|
250 |
|
| 292 |
@RequestMapping(value = "/retailerShopDocument/shopId", method = RequestMethod.GET)
|
251 |
@RequestMapping(value = "/retailerShopDocument/shopId", method = RequestMethod.GET)
|
| 293 |
public ResponseEntity<?> retailerShopDocumentById(HttpServletRequest request,
|
252 |
public ResponseEntity<?> retailerShopDocumentById(HttpServletRequest request,
|
| 294 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
253 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
| 295 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
254 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
| 296 |
Shop shop = shopRepository.selectById(shopId);
|
255 |
Shop shop = shopRepository.selectById(shopId);
|
| 297 |
|
256 |
|
| 298 |
if (shop.getRetailerId() != retailerId) {
|
257 |
if (shop.getRetailerId() != retailerId) {
|
| 299 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
258 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
| 300 |
}
|
259 |
}
|
| Line 307... |
Line 266... |
| 307 |
return responseSender.ok(document);
|
266 |
return responseSender.ok(document);
|
| 308 |
}
|
267 |
}
|
| 309 |
|
268 |
|
| 310 |
@RequestMapping(value = "/retailerShopDocument/download", method = RequestMethod.GET)
|
269 |
@RequestMapping(value = "/retailerShopDocument/download", method = RequestMethod.GET)
|
| 311 |
public ResponseEntity<?> downloadRetailerShopDocument(HttpServletRequest request,
|
270 |
public ResponseEntity<?> downloadRetailerShopDocument(HttpServletRequest request,
|
| 312 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
271 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
| 313 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
272 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
| 314 |
throws ProfitMandiBusinessException {
|
273 |
throws ProfitMandiBusinessException {
|
| 315 |
|
274 |
|
| 316 |
Shop shop = shopRepository.selectById(shopId);
|
275 |
Shop shop = shopRepository.selectById(shopId);
|
| 317 |
|
276 |
|
| 318 |
if (shop.getRetailerId() != retailerId) {
|
277 |
if (shop.getRetailerId() != retailerId) {
|
| Line 352... |
Line 311... |
| 352 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
311 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 353 |
|
312 |
|
| 354 |
// return
|
313 |
// return
|
| 355 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
314 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 356 |
}
|
315 |
}
|
| 357 |
|
316 |
|
| 358 |
@GetMapping(value = "/getstore")
|
317 |
@GetMapping(value = "/getstore")
|
| 359 |
public String getstore(HttpServletRequest request, Model model) {
|
318 |
public String getstore(HttpServletRequest request, Model model) {
|
| 360 |
|
319 |
|
| 361 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
320 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
| 362 |
.collect(Collectors.toList());
|
321 |
.collect(Collectors.toList());
|
| 363 |
;
|
322 |
;
|
| 364 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = retailerService.getFofoRetailers(fofoIds);
|
323 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = retailerService.getFofoRetailers(fofoIds);
|
| 365 |
LOGGER.info("fofoIds" + fofoIds);
|
324 |
LOGGER.info("fofoIds" + fofoIds);
|
| Line 369... |
Line 328... |
| 369 |
|
328 |
|
| 370 |
|
329 |
|
| 371 |
return "store";
|
330 |
return "store";
|
| 372 |
|
331 |
|
| 373 |
}
|
332 |
}
|
| - |
|
333 |
|
| 374 |
@RequestMapping(value = "/getPartnerinfo")
|
334 |
@RequestMapping(value = "/getPartnerinfo")
|
| 375 |
public String getPartnerinfo(HttpServletRequest request,
|
335 |
public String getPartnerinfo(HttpServletRequest request,
|
| 376 |
@RequestBody SelectStorePartnerInfo selectStorePartnerInfo,Model model) throws ProfitMandiBusinessException {
|
336 |
@RequestBody SelectStorePartnerInfo selectStorePartnerInfo, Model model) throws ProfitMandiBusinessException {
|
| 377 |
|
337 |
|
| 378 |
LOGGER.info("selectStorePartnerInfo" + selectStorePartnerInfo.getUserIds());
|
338 |
LOGGER.info("selectStorePartnerInfo" + selectStorePartnerInfo.getUserIds());
|
| 379 |
List<FofoStore> fofoStores = fofoStoreRepository.selectByRetailerIds(selectStorePartnerInfo.getUserIds());
|
339 |
List<FofoStore> fofoStores = fofoStoreRepository.selectByRetailerIds(selectStorePartnerInfo.getUserIds());
|
| 380 |
LOGGER.info("fofoStoresInfo" + fofoStores);
|
340 |
LOGGER.info("fofoStoresInfo" + fofoStores);
|
| 381 |
Map<Integer, Boolean> investments = new HashMap<>();
|
341 |
Map<Integer, Boolean> investments = new HashMap<>();
|
| 382 |
|
342 |
|
| Line 392... |
Line 352... |
| 392 |
fofoStore.setGraceDate(null);
|
352 |
fofoStore.setGraceDate(null);
|
| 393 |
fofoStore.setGraceCount(0);
|
353 |
fofoStore.setGraceCount(0);
|
| 394 |
fofoStoreRepository.persist(fofoStore);
|
354 |
fofoStoreRepository.persist(fofoStore);
|
| 395 |
}
|
355 |
}
|
| 396 |
} catch (ProfitMandiBusinessException e) {
|
356 |
} catch (ProfitMandiBusinessException e) {
|
| 397 |
}
|
357 |
}
|
| 398 |
}
|
358 |
}
|
| 399 |
investments.put(fofoStore.getId(), isOk);
|
359 |
investments.put(fofoStore.getId(), isOk);
|
| 400 |
}
|
360 |
}
|
| 401 |
|
361 |
|
| 402 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
362 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
| Line 405... |
Line 365... |
| 405 |
model.addAttribute("customRetailers", customRetailers);
|
365 |
model.addAttribute("customRetailers", customRetailers);
|
| 406 |
|
366 |
|
| 407 |
return "store-investment";
|
367 |
return "store-investment";
|
| 408 |
|
368 |
|
| 409 |
}
|
369 |
}
|
| 410 |
|
370 |
|
| 411 |
|
371 |
|
| 412 |
@GetMapping(value = "/getAllStores")
|
372 |
@GetMapping(value = "/getAllStores")
|
| 413 |
public String getAllStores(HttpServletRequest request, Model model) {
|
373 |
public String getAllStores(HttpServletRequest request, Model model) {
|
| 414 |
|
374 |
|
| 415 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
|
375 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
|
| 416 |
.collect(Collectors.toList());
|
376 |
.collect(Collectors.toList());
|
| Line 455... |
Line 415... |
| 455 |
return "partner-category";
|
415 |
return "partner-category";
|
| 456 |
}
|
416 |
}
|
| 457 |
|
417 |
|
| 458 |
@PostMapping(value = "/updatePartnerCategory")
|
418 |
@PostMapping(value = "/updatePartnerCategory")
|
| 459 |
public String updatePartnerCategory(HttpServletRequest request, @RequestParam(name = "fofoId") int fofoId,
|
419 |
public String updatePartnerCategory(HttpServletRequest request, @RequestParam(name = "fofoId") int fofoId,
|
| 460 |
@RequestParam(name = "partnerType") PartnerType partnerType, Model model) throws Exception {
|
420 |
@RequestParam(name = "partnerType") PartnerType partnerType, Model model) throws Exception {
|
| 461 |
|
421 |
|
| 462 |
PartnerTypeChange ptc = new PartnerTypeChange();
|
422 |
PartnerTypeChange ptc = new PartnerTypeChange();
|
| 463 |
ptc.setFofoId(fofoId);
|
423 |
ptc.setFofoId(fofoId);
|
| 464 |
ptc.setPartnerType(partnerType);
|
424 |
ptc.setPartnerType(partnerType);
|
| 465 |
ptc.setCreateTimestamp(LocalDate.now().atStartOfDay().plusDays(1));
|
425 |
ptc.setCreateTimestamp(LocalDate.now().atStartOfDay().plusDays(1));
|
| Line 478... |
Line 438... |
| 478 |
return "response";
|
438 |
return "response";
|
| 479 |
}
|
439 |
}
|
| 480 |
|
440 |
|
| 481 |
@PostMapping(value = "/deactivateStore")
|
441 |
@PostMapping(value = "/deactivateStore")
|
| 482 |
public String deActivateStore(HttpServletRequest request,
|
442 |
public String deActivateStore(HttpServletRequest request,
|
| 483 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
443 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 484 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
444 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 485 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
445 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 486 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com")
|
446 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com")
|
| 487 |
.contains(loginDetails.getEmailId())) {
|
447 |
.contains(loginDetails.getEmailId())) {
|
| 488 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
448 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
| Line 495... |
Line 455... |
| 495 |
return "response";
|
455 |
return "response";
|
| 496 |
}
|
456 |
}
|
| 497 |
|
457 |
|
| 498 |
@PostMapping(value = "/activateStoreForever")
|
458 |
@PostMapping(value = "/activateStoreForever")
|
| 499 |
public String activateStoreForever(HttpServletRequest request,
|
459 |
public String activateStoreForever(HttpServletRequest request,
|
| 500 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
460 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 501 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
461 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 502 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
462 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 503 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
463 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
| 504 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
464 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 505 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
465 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
| Line 512... |
Line 472... |
| 512 |
return "response";
|
472 |
return "response";
|
| 513 |
}
|
473 |
}
|
| 514 |
|
474 |
|
| 515 |
@PostMapping(value = "/activateStoreTemporary")
|
475 |
@PostMapping(value = "/activateStoreTemporary")
|
| 516 |
public String activateStoreTemporary(HttpServletRequest request,
|
476 |
public String activateStoreTemporary(HttpServletRequest request,
|
| 517 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
|
477 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
|
| 518 |
@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
|
478 |
@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
|
| 519 |
|
479 |
|
| 520 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
480 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 521 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
481 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 522 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
482 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
| 523 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
483 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| Line 556... |
Line 516... |
| 556 |
}
|
516 |
}
|
| 557 |
|
517 |
|
| 558 |
// Extend billing for 2 days
|
518 |
// Extend billing for 2 days
|
| 559 |
@PostMapping(value = "/extendBilling")
|
519 |
@PostMapping(value = "/extendBilling")
|
| 560 |
public String extendBilling(HttpServletRequest request,
|
520 |
public String extendBilling(HttpServletRequest request,
|
| 561 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
521 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 562 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
522 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 563 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
523 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 564 |
if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com",
|
524 |
if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com",
|
| 565 |
"amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
525 |
"amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 566 |
fofoStore.setGraceDate(LocalDate.now().plusDays(2));
|
526 |
fofoStore.setGraceDate(LocalDate.now().plusDays(2));
|
| Line 575... |
Line 535... |
| 575 |
|
535 |
|
| 576 |
}
|
536 |
}
|
| 577 |
|
537 |
|
| 578 |
@RequestMapping(value = "/getPromoterInfo", method = RequestMethod.GET)
|
538 |
@RequestMapping(value = "/getPromoterInfo", method = RequestMethod.GET)
|
| 579 |
public String getPromoterInfo(HttpServletRequest request,
|
539 |
public String getPromoterInfo(HttpServletRequest request,
|
| 580 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
540 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 581 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
541 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 582 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
542 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
| 583 |
throws Exception {
|
543 |
throws Exception {
|
| 584 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
544 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 585 |
List<Promoter> promoterInfo = null;
|
545 |
List<Promoter> promoterInfo = null;
|
| 586 |
|
546 |
|
| 587 |
long size = 0;
|
547 |
long size = 0;
|
| Line 641... |
Line 601... |
| 641 |
|
601 |
|
| 642 |
}
|
602 |
}
|
| 643 |
|
603 |
|
| 644 |
@RequestMapping(value = "/getPaginatedPromoterInfo", method = RequestMethod.GET)
|
604 |
@RequestMapping(value = "/getPaginatedPromoterInfo", method = RequestMethod.GET)
|
| 645 |
public String getPaginatedPromoterInfo(HttpServletRequest request,
|
605 |
public String getPaginatedPromoterInfo(HttpServletRequest request,
|
| 646 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
606 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 647 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
607 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 648 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
608 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
| 649 |
throws ProfitMandiBusinessException {
|
609 |
throws ProfitMandiBusinessException {
|
| 650 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
610 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 651 |
List<Promoter> promoterInfo = null;
|
611 |
List<Promoter> promoterInfo = null;
|
| 652 |
if (fofoId != 0) {
|
612 |
if (fofoId != 0) {
|
| 653 |
promoterInfo = promoterRepository.selectAllPromoterByFofoId(fofoId, offset, limit);
|
613 |
promoterInfo = promoterRepository.selectAllPromoterByFofoId(fofoId, offset, limit);
|
| Line 679... |
Line 639... |
| 679 |
return "promoter-info-paginated";
|
639 |
return "promoter-info-paginated";
|
| 680 |
}
|
640 |
}
|
| 681 |
|
641 |
|
| 682 |
@RequestMapping(value = "/createPromoter", method = RequestMethod.POST)
|
642 |
@RequestMapping(value = "/createPromoter", method = RequestMethod.POST)
|
| 683 |
public String createPromoter(HttpServletRequest request, @RequestBody PromoterDetailModel promoterdetailModel,
|
643 |
public String createPromoter(HttpServletRequest request, @RequestBody PromoterDetailModel promoterdetailModel,
|
| 684 |
Model model) throws Exception {
|
644 |
Model model) throws Exception {
|
| 685 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
645 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 686 |
LOGGER.info("requested url : " + promoterdetailModel);
|
646 |
LOGGER.info("requested url : " + promoterdetailModel);
|
| 687 |
Promoter promoter = promoterRepository.selectById(promoterdetailModel.getId());
|
647 |
Promoter promoter = promoterRepository.selectById(promoterdetailModel.getId());
|
| 688 |
if (promoter == null) {
|
648 |
if (promoter == null) {
|
| 689 |
promoter = new Promoter();
|
649 |
promoter = new Promoter();
|
| Line 721... |
Line 681... |
| 721 |
|
681 |
|
| 722 |
}
|
682 |
}
|
| 723 |
|
683 |
|
| 724 |
@RequestMapping(value = "/removePromoterfromPartnerStore", method = RequestMethod.POST)
|
684 |
@RequestMapping(value = "/removePromoterfromPartnerStore", method = RequestMethod.POST)
|
| 725 |
public String removePromoterfromPartnerStore(HttpServletRequest request,
|
685 |
public String removePromoterfromPartnerStore(HttpServletRequest request,
|
| 726 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
686 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 727 |
|
687 |
|
| 728 |
Promoter promoter = promoterRepository.selectById(id);
|
688 |
Promoter promoter = promoterRepository.selectById(id);
|
| 729 |
|
689 |
|
| 730 |
promoter.setStatus(false);
|
690 |
promoter.setStatus(false);
|
| 731 |
promoterRepository.persist(promoter);
|
691 |
promoterRepository.persist(promoter);
|
| Line 759... |
Line 719... |
| 759 |
|
719 |
|
| 760 |
}
|
720 |
}
|
| 761 |
|
721 |
|
| 762 |
@RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
|
722 |
@RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
|
| 763 |
public String updateLocation(HttpServletRequest request, @RequestBody AddLocationModel addLocationModel,
|
723 |
public String updateLocation(HttpServletRequest request, @RequestBody AddLocationModel addLocationModel,
|
| 764 |
Model model) throws Exception {
|
724 |
Model model) throws Exception {
|
| 765 |
|
725 |
|
| 766 |
Location userlocation = locationRepository.selectById(addLocationModel.getUserId());
|
726 |
Location userlocation = locationRepository.selectById(addLocationModel.getUserId());
|
| 767 |
|
727 |
|
| 768 |
userlocation.setName(addLocationModel.getName());
|
728 |
userlocation.setName(addLocationModel.getName());
|
| 769 |
userlocation.setCity(addLocationModel.getCity());
|
729 |
userlocation.setCity(addLocationModel.getCity());
|
| Line 787... |
Line 747... |
| 787 |
|
747 |
|
| 788 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
748 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 789 |
|
749 |
|
| 790 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
750 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 791 |
|
751 |
|
| 792 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x->{
|
752 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 793 |
try {
|
753 |
try {
|
| 794 |
return retailerService.getFofoRetailer(x);
|
754 |
return retailerService.getFofoRetailer(x);
|
| 795 |
} catch (ProfitMandiBusinessException e) {
|
755 |
} catch (ProfitMandiBusinessException e) {
|
| 796 |
// TODO Auto-generated catch block
|
756 |
// TODO Auto-generated catch block
|
| 797 |
return null;
|
757 |
return null;
|
| 798 |
}
|
758 |
}
|
| 799 |
}).filter(x->x!=null).collect(Collectors.toMap(x->x.getPartnerId(), x->x));
|
759 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 800 |
|
760 |
|
| 801 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
761 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 802 |
|
762 |
|
| 803 |
return "partner-readonly-info";
|
763 |
return "partner-readonly-info";
|
| 804 |
|
764 |
|
| Line 820... |
Line 780... |
| 820 |
|
780 |
|
| 821 |
}
|
781 |
}
|
| 822 |
|
782 |
|
| 823 |
@RequestMapping(value = "/getBlockBrand")
|
783 |
@RequestMapping(value = "/getBlockBrand")
|
| 824 |
public String getBlockBrand(HttpServletRequest request,
|
784 |
public String getBlockBrand(HttpServletRequest request,
|
| 825 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
785 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
| 826 |
throws Exception {
|
786 |
throws Exception {
|
| 827 |
|
787 |
|
| 828 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
788 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
| 829 |
|
789 |
|
| 830 |
List<Integer> blockBrandPartners = retailerBlockBrands.stream().map(x -> x.getFofoId())
|
790 |
List<Integer> blockBrandPartners = retailerBlockBrands.stream().map(x -> x.getFofoId())
|
| Line 840... |
Line 800... |
| 840 |
|
800 |
|
| 841 |
}
|
801 |
}
|
| 842 |
|
802 |
|
| 843 |
@RequestMapping(value = "/getRetailerBlockBrandMappping", method = RequestMethod.POST)
|
803 |
@RequestMapping(value = "/getRetailerBlockBrandMappping", method = RequestMethod.POST)
|
| 844 |
public String getBlockBrandMappping(HttpServletRequest request,
|
804 |
public String getBlockBrandMappping(HttpServletRequest request,
|
| 845 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
805 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
| 846 |
@RequestParam(name = "fofoIds", required = true, defaultValue = "0") List<Integer> fofoIds, Model model)
|
806 |
@RequestParam(name = "fofoIds", required = true, defaultValue = "0") List<Integer> fofoIds, Model model)
|
| 847 |
throws Exception {
|
807 |
throws Exception {
|
| 848 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
808 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
| 849 |
if (!retailerBlockBrands.isEmpty()) {
|
809 |
if (!retailerBlockBrands.isEmpty()) {
|
| 850 |
retailerBlockBrandsRepository.deleteAllbyBrands(brand);
|
810 |
retailerBlockBrandsRepository.deleteAllbyBrands(brand);
|
| 851 |
}
|
811 |
}
|
| Line 877... |
Line 837... |
| 877 |
|
837 |
|
| 878 |
}
|
838 |
}
|
| 879 |
|
839 |
|
| 880 |
@RequestMapping(value = "/setUpdateLimit", method = RequestMethod.POST)
|
840 |
@RequestMapping(value = "/setUpdateLimit", method = RequestMethod.POST)
|
| 881 |
public String getUpdateLimit(HttpServletRequest request,
|
841 |
public String getUpdateLimit(HttpServletRequest request,
|
| 882 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
842 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
| 883 |
@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
|
843 |
@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
|
| 884 |
@RequestParam(name = "limit", required = true, defaultValue = "0") float limit, Model model)
|
844 |
@RequestParam(name = "limit", required = true, defaultValue = "0") float limit, Model model)
|
| 885 |
throws Exception {
|
845 |
throws Exception {
|
| 886 |
|
846 |
|
| 887 |
CustomRetailer cr = retailerService.getFofoRetailer(fofoId);
|
847 |
CustomRetailer cr = retailerService.getFofoRetailer(fofoId);
|
| 888 |
|
848 |
|
| 889 |
Map.Entry<Integer, CustomRetailer> customRetailers = new AbstractMap.SimpleEntry(cr.getPartnerId(), cr);
|
849 |
Map.Entry<Integer, CustomRetailer> customRetailers = new AbstractMap.SimpleEntry(cr.getPartnerId(), cr);
|
| Line 901... |
Line 861... |
| 901 |
retailerBrands.setPartnerId(fofoId);
|
861 |
retailerBrands.setPartnerId(fofoId);
|
| 902 |
retailerBrands.setBrandName(brand);
|
862 |
retailerBrands.setBrandName(brand);
|
| 903 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
863 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
| 904 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
864 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
| 905 |
|
865 |
|
| 906 |
}
|
- |
|
| 907 |
|
- |
|
| 908 |
else {
|
866 |
} else {
|
| 909 |
retailerBrands.setBrandLimit(limit);
|
867 |
retailerBrands.setBrandLimit(limit);
|
| 910 |
retailerBrands.setIsUpdate(1);
|
868 |
retailerBrands.setIsUpdate(1);
|
| 911 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
869 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
| 912 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
870 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
| 913 |
|
871 |
|
| Line 929... |
Line 887... |
| 929 |
|
887 |
|
| 930 |
}
|
888 |
}
|
| 931 |
|
889 |
|
| 932 |
@RequestMapping(value = "/getRetailerBrandslimitMapping", method = RequestMethod.GET)
|
890 |
@RequestMapping(value = "/getRetailerBrandslimitMapping", method = RequestMethod.GET)
|
| 933 |
public String getRetailerBrandslimit(HttpServletRequest request,
|
891 |
public String getRetailerBrandslimit(HttpServletRequest request,
|
| 934 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
892 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
| 935 |
throws Exception {
|
893 |
throws Exception {
|
| 936 |
|
894 |
|
| 937 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
895 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
| 938 |
List<RetailerBrandsLimit> retailerBrandsLimit = retailerBrandsLimitRepository.setAllLimitByBrands(brand);
|
896 |
List<RetailerBrandsLimit> retailerBrandsLimit = retailerBrandsLimitRepository.setAllLimitByBrands(brand);
|
| 939 |
Map<Integer, RetailerBrandsLimit> retailerBrandsLimitMap = retailerBrandsLimit.stream()
|
897 |
Map<Integer, RetailerBrandsLimit> retailerBrandsLimitMap = retailerBrandsLimit.stream()
|
| Line 951... |
Line 909... |
| 951 |
|
909 |
|
| 952 |
}
|
910 |
}
|
| 953 |
|
911 |
|
| 954 |
@RequestMapping(value = "/setBrandWiseLimit", method = RequestMethod.POST)
|
912 |
@RequestMapping(value = "/setBrandWiseLimit", method = RequestMethod.POST)
|
| 955 |
public String brandwiseLimit(HttpServletRequest request,
|
913 |
public String brandwiseLimit(HttpServletRequest request,
|
| 956 |
@RequestParam(name = "brands", required = true, defaultValue = "") String brands,
|
914 |
@RequestParam(name = "brands", required = true, defaultValue = "") String brands,
|
| 957 |
@RequestParam(name = "limit", required = true, defaultValue = "") float limit, Model model)
|
915 |
@RequestParam(name = "limit", required = true, defaultValue = "") float limit, Model model)
|
| 958 |
throws Exception {
|
916 |
throws Exception {
|
| 959 |
|
917 |
|
| 960 |
LOGGER.info("limit" + limit);
|
918 |
LOGGER.info("limit" + limit);
|
| 961 |
|
919 |
|
| 962 |
BrandLimit brandLimit = brandLimitRepository.setLimitByBrands(brands);
|
920 |
BrandLimit brandLimit = brandLimitRepository.setLimitByBrands(brands);
|
| Line 975... |
Line 933... |
| 975 |
brandLimit.setBrandName(brands);
|
933 |
brandLimit.setBrandName(brands);
|
| 976 |
brandLimit.setCreatedTimestamp(LocalDateTime.now());
|
934 |
brandLimit.setCreatedTimestamp(LocalDateTime.now());
|
| 977 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
935 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
| 978 |
brandLimitRepository.persist(brandLimit);
|
936 |
brandLimitRepository.persist(brandLimit);
|
| 979 |
|
937 |
|
| 980 |
}
|
- |
|
| 981 |
|
- |
|
| 982 |
else {
|
938 |
} else {
|
| 983 |
brandLimit.setBrandLimit(limit);
|
939 |
brandLimit.setBrandLimit(limit);
|
| 984 |
|
940 |
|
| 985 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
941 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
| 986 |
brandLimitRepository.persist(brandLimit);
|
942 |
brandLimitRepository.persist(brandLimit);
|
| 987 |
|
943 |
|
| Line 997... |
Line 953... |
| 997 |
|
953 |
|
| 998 |
}
|
954 |
}
|
| 999 |
|
955 |
|
| 1000 |
@RequestMapping(value = "/setPartnerPincode", method = RequestMethod.POST)
|
956 |
@RequestMapping(value = "/setPartnerPincode", method = RequestMethod.POST)
|
| 1001 |
public String setPartnerPincode(HttpServletRequest request,
|
957 |
public String setPartnerPincode(HttpServletRequest request,
|
| 1002 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,
|
958 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,
|
| 1003 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
959 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| 1004 |
throws Exception {
|
960 |
throws Exception {
|
| 1005 |
|
961 |
|
| 1006 |
if (!pincode.equals("")) {
|
962 |
if (!pincode.equals("")) {
|
| 1007 |
PincodePartner pinPartner = new PincodePartner();
|
963 |
PincodePartner pinPartner = new PincodePartner();
|
| 1008 |
pinPartner.setFofoId(fofoId);
|
964 |
pinPartner.setFofoId(fofoId);
|
| Line 1019... |
Line 975... |
| 1019 |
|
975 |
|
| 1020 |
}
|
976 |
}
|
| 1021 |
|
977 |
|
| 1022 |
@RequestMapping(value = "/removePartnerPincode", method = RequestMethod.POST)
|
978 |
@RequestMapping(value = "/removePartnerPincode", method = RequestMethod.POST)
|
| 1023 |
public String removePartnerPincode(HttpServletRequest request, @RequestParam int id,
|
979 |
public String removePartnerPincode(HttpServletRequest request, @RequestParam int id,
|
| 1024 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
980 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| 1025 |
throws Exception {
|
981 |
throws Exception {
|
| 1026 |
|
982 |
|
| 1027 |
PincodePartnerRepository.delete(id);
|
983 |
PincodePartnerRepository.delete(id);
|
| 1028 |
|
984 |
|
| 1029 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
985 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
| Line 1036... |
Line 992... |
| 1036 |
|
992 |
|
| 1037 |
}
|
993 |
}
|
| 1038 |
|
994 |
|
| 1039 |
@RequestMapping(value = "/removeSearchPincode", method = RequestMethod.POST)
|
995 |
@RequestMapping(value = "/removeSearchPincode", method = RequestMethod.POST)
|
| 1040 |
public String removeSearchPincode(HttpServletRequest request, @RequestParam int id,
|
996 |
public String removeSearchPincode(HttpServletRequest request, @RequestParam int id,
|
| 1041 |
@RequestParam(name = "pin", required = true, defaultValue = "") String pin,
|
997 |
@RequestParam(name = "pin", required = true, defaultValue = "") String pin,
|
| 1042 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
998 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| 1043 |
throws Exception {
|
999 |
throws Exception {
|
| 1044 |
|
1000 |
|
| 1045 |
PincodePartnerRepository.delete(id);
|
1001 |
PincodePartnerRepository.delete(id);
|
| 1046 |
|
1002 |
|
| 1047 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pin);
|
1003 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pin);
|
| Line 1056... |
Line 1012... |
| 1056 |
|
1012 |
|
| 1057 |
}
|
1013 |
}
|
| 1058 |
|
1014 |
|
| 1059 |
@RequestMapping(value = "/searchPincodePartner", method = RequestMethod.GET)
|
1015 |
@RequestMapping(value = "/searchPincodePartner", method = RequestMethod.GET)
|
| 1060 |
public String searchPincodePartner(HttpServletRequest request,
|
1016 |
public String searchPincodePartner(HttpServletRequest request,
|
| 1061 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode, Model model)
|
1017 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode, Model model)
|
| 1062 |
throws Exception {
|
1018 |
throws Exception {
|
| 1063 |
|
1019 |
|
| 1064 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pincode);
|
1020 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pincode);
|
| 1065 |
|
1021 |
|
| 1066 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
1022 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| Line 1073... |
Line 1029... |
| 1073 |
|
1029 |
|
| 1074 |
}
|
1030 |
}
|
| 1075 |
|
1031 |
|
| 1076 |
@RequestMapping(value = "/showPartnerPincode", method = RequestMethod.GET)
|
1032 |
@RequestMapping(value = "/showPartnerPincode", method = RequestMethod.GET)
|
| 1077 |
public String showPartnerPincode(HttpServletRequest request,
|
1033 |
public String showPartnerPincode(HttpServletRequest request,
|
| 1078 |
@RequestParam(name = "partnerId", required = true, defaultValue = "") int partnerId, Model model)
|
1034 |
@RequestParam(name = "partnerId", required = true, defaultValue = "") int partnerId, Model model)
|
| 1079 |
throws Exception {
|
1035 |
throws Exception {
|
| 1080 |
|
1036 |
|
| 1081 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(partnerId);
|
1037 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(partnerId);
|
| 1082 |
|
1038 |
|
| 1083 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
1039 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|