| Line 42... |
Line 42... |
| 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.auth.AuthUser;
|
| - |
|
47 |
import com.spice.profitmandi.dao.entity.cs.PartnerPosition;
|
| - |
|
48 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 47 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
49 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 48 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
50 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 49 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
51 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 50 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
52 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
53 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| - |
|
54 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
| 51 |
import com.spice.profitmandi.dao.entity.user.Location;
|
55 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 52 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
56 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 53 |
import com.spice.profitmandi.dao.entity.user.User;
|
57 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 54 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
58 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 55 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
59 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 56 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
60 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 57 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
61 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 58 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
62 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 59 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
63 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 60 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
64 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
| - |
|
65 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
| - |
|
66 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 61 |
import com.spice.profitmandi.dao.repository.user.LocationRepository;
|
67 |
import com.spice.profitmandi.dao.repository.user.LocationRepository;
|
| 62 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
68 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
| 63 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
69 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 64 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
70 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 65 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
71 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| Line 121... |
Line 127... |
| 121 |
private PartnerInvestmentService partnerInvestmentService;
|
127 |
private PartnerInvestmentService partnerInvestmentService;
|
| 122 |
|
128 |
|
| 123 |
@Autowired
|
129 |
@Autowired
|
| 124 |
private Mongo mongoClient;
|
130 |
private Mongo mongoClient;
|
| 125 |
|
131 |
|
| - |
|
132 |
@Autowired
|
| - |
|
133 |
private PartnerTypeChangeService partnerTypeChangeService;
|
| - |
|
134 |
|
| - |
|
135 |
@Autowired
|
| - |
|
136 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
| - |
|
137 |
|
| 126 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
138 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
| 127 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
139 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
| 128 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
140 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
| 129 |
Model model) throws ProfitMandiBusinessException {
|
141 |
Model model) throws ProfitMandiBusinessException {
|
| 130 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
142 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
| Line 328... |
Line 340... |
| 328 |
|
340 |
|
| 329 |
return "store";
|
341 |
return "store";
|
| 330 |
|
342 |
|
| 331 |
}
|
343 |
}
|
| 332 |
|
344 |
|
| - |
|
345 |
@GetMapping(value = "/getPartnerCategory")
|
| - |
|
346 |
public String getPartnerCategory(HttpServletRequest request, @RequestParam int fofoId, Model model) {
|
| - |
|
347 |
|
| - |
|
348 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, LocalDate.now());
|
| - |
|
349 |
List<PartnerType> partnerTypes = partnerType.nextPartnerTypes();
|
| - |
|
350 |
LOGGER.info("partnerType" + partnerTypes);
|
| - |
|
351 |
model.addAttribute("partnerTypes", partnerTypes);
|
| - |
|
352 |
model.addAttribute("fofoId", fofoId);
|
| - |
|
353 |
return "partner-category";
|
| - |
|
354 |
}
|
| - |
|
355 |
|
| - |
|
356 |
@PostMapping(value = "/updatePartnerCategory")
|
| - |
|
357 |
public String updatePartnerCategory(HttpServletRequest request, @RequestParam(name = "fofoId") int fofoId,
|
| - |
|
358 |
@RequestParam(name = "partnerType") PartnerType partnerType, Model model) throws Exception {
|
| - |
|
359 |
|
| - |
|
360 |
PartnerTypeChange ptc = new PartnerTypeChange();
|
| - |
|
361 |
ptc.setFofoId(fofoId);
|
| - |
|
362 |
ptc.setPartnerType(partnerType);
|
| - |
|
363 |
ptc.setCreateTimestamp(LocalDate.now().atStartOfDay().plusDays(1));
|
| - |
|
364 |
partnerTypeChangeRepository.persist(ptc);
|
| - |
|
365 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
366 |
|
| - |
|
367 |
return "response";
|
| - |
|
368 |
}
|
| - |
|
369 |
|
| 333 |
@GetMapping(value = "/partners")
|
370 |
@GetMapping(value = "/partners")
|
| 334 |
public String getStoreName(HttpServletRequest request, Model model, @RequestParam String query) throws Exception {
|
371 |
public String getStoreName(HttpServletRequest request, Model model, @RequestParam String query) throws Exception {
|
| 335 |
model.addAttribute("response", mvcResponseSender
|
372 |
model.addAttribute("response", mvcResponseSender
|
| 336 |
.createResponseString(retailerService.getFofoRetailers(false).values().stream().filter(x -> {
|
373 |
.createResponseString(retailerService.getFofoRetailers(false).values().stream().filter(x -> {
|
| 337 |
return x.getDisplayName().toLowerCase().matches(".*?" + query.toLowerCase() + ".*?");
|
374 |
return x.getDisplayName().toLowerCase().matches(".*?" + query.toLowerCase() + ".*?");
|