| Line 41... |
Line 41... |
| 41 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
41 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 42 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
42 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 43 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
43 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
| 44 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
44 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
| 45 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
45 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
46 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 46 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
47 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 47 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
48 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 48 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
49 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 49 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
50 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 50 |
import com.spice.profitmandi.dao.entity.user.Location;
|
51 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 51 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
52 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 52 |
import com.spice.profitmandi.dao.entity.user.User;
|
53 |
import com.spice.profitmandi.dao.entity.user.User;
|
| - |
|
54 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| - |
|
55 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 53 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
56 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 54 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
57 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 55 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
58 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 56 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
59 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 57 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
60 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
| Line 92... |
Line 95... |
| 92 |
@Autowired
|
95 |
@Autowired
|
| 93 |
@Qualifier("userUserRepository")
|
96 |
@Qualifier("userUserRepository")
|
| 94 |
private UserRepository userRepository;
|
97 |
private UserRepository userRepository;
|
| 95 |
|
98 |
|
| 96 |
@Autowired
|
99 |
@Autowired
|
| - |
|
100 |
private AuthRepository authRepository;
|
| - |
|
101 |
|
| - |
|
102 |
@Autowired
|
| - |
|
103 |
private CsService csService;
|
| - |
|
104 |
|
| - |
|
105 |
@Autowired
|
| 97 |
private LocationRepository locationRepository;
|
106 |
private LocationRepository locationRepository;
|
| 98 |
|
107 |
|
| 99 |
@Autowired
|
108 |
@Autowired
|
| 100 |
private ResponseSender<?> responseSender;
|
109 |
private ResponseSender<?> responseSender;
|
| 101 |
|
110 |
|
| Line 333... |
Line 342... |
| 333 |
@PostMapping(value = "/deactivateStore")
|
342 |
@PostMapping(value = "/deactivateStore")
|
| 334 |
public String deActivateStore(HttpServletRequest request,
|
343 |
public String deActivateStore(HttpServletRequest request,
|
| 335 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
344 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 336 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
345 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 337 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
346 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 338 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com","amit.gupta@smartdukaan.com")
|
347 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com")
|
| 339 |
.contains(loginDetails.getEmailId())) {
|
348 |
.contains(loginDetails.getEmailId())) {
|
| 340 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
349 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
| 341 |
"You are not authorise to deactivate retailer");
|
350 |
"You are not authorise to deactivate retailer");
|
| 342 |
}
|
351 |
}
|
| 343 |
fofoStore.setActive(false);
|
352 |
fofoStore.setActive(false);
|
| Line 363... |
Line 372... |
| 363 |
@PostMapping(value = "/extendBilling")
|
372 |
@PostMapping(value = "/extendBilling")
|
| 364 |
public String extendBilling(HttpServletRequest request,
|
373 |
public String extendBilling(HttpServletRequest request,
|
| 365 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
374 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 366 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
375 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 367 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
376 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 368 |
if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com", "amit.gupta@smartdukaan.com")
|
377 |
if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com",
|
| 369 |
.contains(loginDetails.getEmailId())) {
|
378 |
"amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 370 |
fofoStore.setGraceDate(LocalDate.now().plusDays(2));
|
379 |
fofoStore.setGraceDate(LocalDate.now().plusDays(2));
|
| 371 |
fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
|
380 |
fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
|
| 372 |
fofoStoreRepository.persist(fofoStore);
|
381 |
fofoStoreRepository.persist(fofoStore);
|
| 373 |
model.addAttribute("response", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
|
382 |
model.addAttribute("response", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
|
| 374 |
} else {
|
383 |
} else {
|
| Line 558... |
Line 567... |
| 558 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
567 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 559 |
return "response";
|
568 |
return "response";
|
| 560 |
|
569 |
|
| 561 |
}
|
570 |
}
|
| 562 |
|
571 |
|
| - |
|
572 |
@RequestMapping(value = "/getPartnerReadonlyInfo")
|
| - |
|
573 |
public String getPartnerReadonlyInfo(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
574 |
|
| - |
|
575 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
576 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
577 |
|
| - |
|
578 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| - |
|
579 |
|
| - |
|
580 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| - |
|
581 |
|
| - |
|
582 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
| - |
|
583 |
Map<Integer, FofoStore> fofoStoreMap = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
| - |
|
584 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| - |
|
585 |
|
| - |
|
586 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| - |
|
587 |
model.addAttribute("fofoStoreMap", fofoStoreMap);
|
| - |
|
588 |
return "partner-readonly-info";
|
| - |
|
589 |
|
| - |
|
590 |
}
|
| - |
|
591 |
|
| 563 |
}
|
592 |
}
|