| Line 43... |
Line 43... |
| 43 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
43 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 44 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
44 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 45 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
45 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 46 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
46 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 47 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
47 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 48 |
import com.spice.profitmandi.dao.entity.fofo.InActiveFofoStore;
|
- |
|
| 49 |
import com.spice.profitmandi.dao.entity.user.Location;
|
48 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 50 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
49 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 51 |
import com.spice.profitmandi.dao.entity.user.User;
|
50 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 52 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
51 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 53 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| Line 275... |
Line 274... |
| 275 |
}
|
274 |
}
|
| 276 |
|
275 |
|
| 277 |
@GetMapping(value = "/getAllStores")
|
276 |
@GetMapping(value = "/getAllStores")
|
| 278 |
public String getAllStores(HttpServletRequest request, Model model) {
|
277 |
public String getAllStores(HttpServletRequest request, Model model) {
|
| 279 |
|
278 |
|
| 280 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
|
279 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x->x.isActive()).collect(Collectors.toList());
|
| 281 |
Map<Integer, Boolean> investments = new HashMap<>();
|
280 |
Map<Integer, Boolean> investments = new HashMap<>();
|
| 282 |
|
281 |
|
| 283 |
for (FofoStore fofoStore : fofoStores) {
|
282 |
for (FofoStore fofoStore : fofoStores) {
|
| 284 |
boolean isOk = false;
|
283 |
boolean isOk = false;
|
| 285 |
if (fofoStore.getGraceDate() != null && fofoStore.getGraceDate().isAfter(LocalDate.now())) {
|
284 |
if (fofoStore.getGraceDate() != null && fofoStore.getGraceDate().isAfter(LocalDate.now())) {
|
| Line 319... |
Line 318... |
| 319 |
@PostMapping(value = "/deactivateStore")
|
318 |
@PostMapping(value = "/deactivateStore")
|
| 320 |
public String deActivateStore(HttpServletRequest request,
|
319 |
public String deActivateStore(HttpServletRequest request,
|
| 321 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
320 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 322 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
321 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 323 |
|
322 |
|
| 324 |
InActiveFofoStore inActiveFofoStore = new InActiveFofoStore();
|
- |
|
| 325 |
inActiveFofoStore.setId(fofoStore.getId());
|
323 |
fofoStore.setActive(false);
|
| 326 |
inActiveFofoStore.setCode(fofoStore.getCode());
|
- |
|
| 327 |
inActiveFofoStore.setCounterSize(fofoStore.getCounterSize());
|
- |
|
| 328 |
inActiveFofoStore.setLatitude(fofoStore.getLatitude());
|
- |
|
| 329 |
inActiveFofoStore.setLongitude(fofoStore.getLongitude());
|
- |
|
| 330 |
|
- |
|
| 331 |
inActiveFofoStore.setMinimumInvestment(fofoStore.getMinimumInvestment());
|
- |
|
| 332 |
|
- |
|
| 333 |
inActiveFofoStore.setUserAddress(fofoStore.getUserAddress());
|
- |
|
| 334 |
|
- |
|
| 335 |
fofoStoreRepository.saveInActiveStore(inActiveFofoStore);
|
324 |
fofoStoreRepository.persist(fofoStore);
|
| 336 |
|
- |
|
| 337 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
325 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
| 338 |
|
- |
|
| 339 |
fofoStoreRepository.delete(fofoStore);
|
- |
|
| 340 |
|
- |
|
| 341 |
LOGGER.info("Deleted from fofoStore successfully");
|
- |
|
| 342 |
|
- |
|
| 343 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
326 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 344 |
|
327 |
|
| 345 |
return "response";
|
328 |
return "response";
|
| 346 |
|
329 |
|
| 347 |
}
|
330 |
}
|
| 348 |
@GetMapping(value="/getAllInactiveStores")
|
331 |
@GetMapping(value="/getAllInactiveStores")
|
| 349 |
public String getInactiveStores(HttpServletRequest request,Model model)
|
332 |
public String getInactiveStores(HttpServletRequest request,Model model)
|
| 350 |
{
|
333 |
{
|
| 351 |
List<InActiveFofoStore> inActiveFofoStores=fofoStoreRepository.getInactiveStore();
|
334 |
List<FofoStore> inActiveFofoStores=fofoStoreRepository.selectInActiveStore();
|
| 352 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(inActiveFofoStores.stream().map(x->x.getId()).collect(Collectors.toList()));
|
335 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(inActiveFofoStores.stream().map(x->x.getId()).collect(Collectors.toList()));
|
| 353 |
model.addAttribute("inActiveFofoStores", inActiveFofoStores);
|
336 |
model.addAttribute("inActiveFofoStores", inActiveFofoStores);
|
| 354 |
model.addAttribute("customRetailers", customRetailers);
|
337 |
model.addAttribute("customRetailers", customRetailers);
|
| 355 |
return "inactive-stores";
|
338 |
return "inactive-stores";
|
| 356 |
}
|
339 |
}
|