| Line 43... |
Line 43... |
| 43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 44 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
44 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
| 45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 46 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
46 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 47 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
47 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
| - |
|
48 |
import com.spice.profitmandi.common.model.SelectStorePartnerInfo;
|
| - |
|
49 |
import com.spice.profitmandi.common.model.SendMessageModel;
|
| 48 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
50 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
| 49 |
import com.spice.profitmandi.common.util.Utils;
|
51 |
import com.spice.profitmandi.common.util.Utils;
|
| 50 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
52 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 51 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
53 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 52 |
import com.spice.profitmandi.dao.entity.dtr.BrandLimit;
|
54 |
import com.spice.profitmandi.dao.entity.dtr.BrandLimit;
|
| Line 57... |
Line 59... |
| 57 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
59 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
| - |
|
64 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 63 |
import com.spice.profitmandi.dao.entity.user.Location;
|
66 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 64 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
67 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 65 |
import com.spice.profitmandi.dao.entity.user.User;
|
68 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 66 |
|
69 |
|
| Line 348... |
Line 351... |
| 348 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
351 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 349 |
|
352 |
|
| 350 |
// return
|
353 |
// return
|
| 351 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
354 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 352 |
}
|
355 |
}
|
| - |
|
356 |
|
| - |
|
357 |
@GetMapping(value = "/getstore")
|
| - |
|
358 |
public String getstore(HttpServletRequest request, Model model) {
|
| - |
|
359 |
|
| - |
|
360 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
| - |
|
361 |
.collect(Collectors.toList());
|
| - |
|
362 |
;
|
| - |
|
363 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = retailerService.getFofoRetailers(fofoIds);
|
| - |
|
364 |
LOGGER.info("fofoIds" + fofoIds);
|
| - |
|
365 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
| - |
|
366 |
LOGGER.info("fofoIdsAndCustomRetailer" + fofoIdsAndCustomRetailer);
|
| - |
|
367 |
model.addAttribute("fofoIds", fofoIds);
|
| - |
|
368 |
|
| 353 |
|
369 |
|
| - |
|
370 |
return "store";
|
| - |
|
371 |
|
| - |
|
372 |
}
|
| - |
|
373 |
@RequestMapping(value = "/getPartnerinfo")
|
| - |
|
374 |
public String getPartnerinfo(HttpServletRequest request,
|
| - |
|
375 |
@RequestBody SelectStorePartnerInfo selectStorePartnerInfo,Model model) throws ProfitMandiBusinessException {
|
| - |
|
376 |
|
| - |
|
377 |
LOGGER.info("selectStorePartnerInfo" + selectStorePartnerInfo.getUserIds());
|
| - |
|
378 |
List<FofoStore> fofoStores = fofoStoreRepository.selectByRetailerIds(selectStorePartnerInfo.getUserIds());
|
| - |
|
379 |
LOGGER.info("fofoStoresInfo" + fofoStores);
|
| - |
|
380 |
Map<Integer, Boolean> investments = new HashMap<>();
|
| - |
|
381 |
|
| - |
|
382 |
for (FofoStore fofoStore : fofoStores) {
|
| - |
|
383 |
boolean isOk = false;
|
| - |
|
384 |
if (fofoStore.getGraceDate() != null && fofoStore.getGraceDate().isAfter(LocalDate.now())) {
|
| - |
|
385 |
isOk = true;
|
| - |
|
386 |
} else {
|
| - |
|
387 |
try {
|
| - |
|
388 |
isOk = partnerInvestmentService.isInvestmentOk(fofoStore.getId(), 10,
|
| - |
|
389 |
ProfitMandiConstants.CUTOFF_INVESTMENT);
|
| - |
|
390 |
if (fofoStore.getGraceCount() > 0) {
|
| - |
|
391 |
fofoStore.setGraceDate(null);
|
| - |
|
392 |
fofoStore.setGraceCount(0);
|
| - |
|
393 |
fofoStoreRepository.persist(fofoStore);
|
| - |
|
394 |
}
|
| - |
|
395 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
396 |
}
|
| - |
|
397 |
}
|
| - |
|
398 |
investments.put(fofoStore.getId(), isOk);
|
| - |
|
399 |
}
|
| - |
|
400 |
|
| - |
|
401 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
| - |
|
402 |
model.addAttribute("fofoStores", fofoStores);
|
| - |
|
403 |
model.addAttribute("investments", investments);
|
| - |
|
404 |
model.addAttribute("customRetailers", customRetailers);
|
| - |
|
405 |
|
| - |
|
406 |
return "store-investment";
|
| - |
|
407 |
|
| - |
|
408 |
}
|
| - |
|
409 |
|
| - |
|
410 |
|
| 354 |
@GetMapping(value = "/getAllStores")
|
411 |
@GetMapping(value = "/getAllStores")
|
| 355 |
public String getAllStores(HttpServletRequest request, Model model) {
|
412 |
public String getAllStores(HttpServletRequest request, Model model) {
|
| 356 |
|
413 |
|
| 357 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
|
414 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
|
| 358 |
.collect(Collectors.toList());
|
415 |
.collect(Collectors.toList());
|
| Line 380... |
Line 437... |
| 380 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
437 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
| 381 |
model.addAttribute("fofoStores", fofoStores);
|
438 |
model.addAttribute("fofoStores", fofoStores);
|
| 382 |
model.addAttribute("investments", investments);
|
439 |
model.addAttribute("investments", investments);
|
| 383 |
model.addAttribute("customRetailers", customRetailers);
|
440 |
model.addAttribute("customRetailers", customRetailers);
|
| 384 |
|
441 |
|
| 385 |
return "store";
|
442 |
return "store-investment";
|
| 386 |
|
443 |
|
| 387 |
}
|
444 |
}
|
| 388 |
|
445 |
|
| 389 |
@GetMapping(value = "/getPartnerCategory")
|
446 |
@GetMapping(value = "/getPartnerCategory")
|
| 390 |
public String getPartnerCategory(HttpServletRequest request, @RequestParam int fofoId, Model model) {
|
447 |
public String getPartnerCategory(HttpServletRequest request, @RequestParam int fofoId, Model model) {
|