| Line 37... |
Line 37... |
| 37 |
import org.springframework.web.bind.annotation.RequestMethod;
|
37 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 38 |
import org.springframework.web.bind.annotation.RequestParam;
|
38 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 39 |
|
39 |
|
| 40 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
40 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 41 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
41 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| - |
|
42 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
| 42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 43 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
44 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
| 44 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 45 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
46 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 46 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
47 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
| Line 59... |
Line 60... |
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 61 |
import com.spice.profitmandi.dao.entity.user.Location;
|
62 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 62 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
63 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 63 |
import com.spice.profitmandi.dao.entity.user.User;
|
64 |
import com.spice.profitmandi.dao.entity.user.User;
|
| - |
|
65 |
|
| 64 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
66 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 65 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
67 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 66 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
68 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
| 67 |
import com.spice.profitmandi.dao.repository.dtr.BrandLimitRepository;
|
69 |
import com.spice.profitmandi.dao.repository.dtr.BrandLimitRepository;
|
| 68 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
70 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| Line 173... |
Line 175... |
| 173 |
|
175 |
|
| 174 |
model.addAllAttributes(map);
|
176 |
model.addAllAttributes(map);
|
| 175 |
|
177 |
|
| 176 |
model.addAttribute("counterSizes", CounterSize.values());
|
178 |
model.addAttribute("counterSizes", CounterSize.values());
|
| 177 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
179 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
180 |
|
| 178 |
LOGGER.info("warehouseMap", warehouseMap);
|
181 |
LOGGER.info("warehouseMap", warehouseMap);
|
| 179 |
model.addAttribute("warehouses", warehouseMap);
|
182 |
model.addAttribute("warehouses", warehouseMap);
|
| - |
|
183 |
model.addAttribute("fofoTypes", FofoType.values());
|
| 180 |
if (map.containsKey("retailer")) {
|
184 |
if (map.containsKey("retailer")) {
|
| 181 |
Retailer retailer = (Retailer) map.get("retailer");
|
185 |
Retailer retailer = (Retailer) map.get("retailer");
|
| 182 |
User user = userRepository.selectById(retailer.getId());
|
186 |
User user = userRepository.selectById(retailer.getId());
|
| 183 |
if (user.getLocation() != null) {
|
187 |
if (user.getLocation() != null) {
|
| 184 |
Location location = locationRepository.selectById(user.getLocation());
|
188 |
Location location = locationRepository.selectById(user.getLocation());
|
| Line 421... |
Line 425... |
| 421 |
fofoStoreRepository.persist(fofoStore);
|
425 |
fofoStoreRepository.persist(fofoStore);
|
| 422 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
426 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
| 423 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
427 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 424 |
return "response";
|
428 |
return "response";
|
| 425 |
}
|
429 |
}
|
| 426 |
|
- |
|
| 427 |
|
430 |
|
| 428 |
@PostMapping(value = "/activateStoreForever")
|
431 |
@PostMapping(value = "/activateStoreForever")
|
| 429 |
public String activateStoreForever(HttpServletRequest request,
|
432 |
public String activateStoreForever(HttpServletRequest request,
|
| 430 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
433 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 431 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
434 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 432 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
435 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 433 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com","manish.tiwari@smartdukaan.com")
|
436 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
| 434 |
.contains(loginDetails.getEmailId())) {
|
437 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 435 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
438 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
| 436 |
"You are not authorise to activate retailer");
|
439 |
"You are not authorise to activate retailer");
|
| 437 |
}
|
440 |
}
|
| 438 |
fofoStore.setActive(true);
|
441 |
fofoStore.setActive(true);
|
| 439 |
fofoStoreRepository.persist(fofoStore);
|
442 |
fofoStoreRepository.persist(fofoStore);
|
| 440 |
LOGGER.info("inserted into ActiveFofoStore successfully");
|
443 |
LOGGER.info("inserted into ActiveFofoStore successfully");
|
| 441 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
444 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 442 |
return "response";
|
445 |
return "response";
|
| 443 |
}
|
446 |
}
|
| 444 |
|
447 |
|
| 445 |
@PostMapping(value = "/activateStoreTemporary")
|
448 |
@PostMapping(value = "/activateStoreTemporary")
|
| 446 |
public String activateStoreTemporary(HttpServletRequest request,
|
449 |
public String activateStoreTemporary(HttpServletRequest request,
|
| 447 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
|
450 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
|
| 448 |
@RequestParam(name = "days", required = true ) int days,Model model) throws Exception {
|
451 |
@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
|
| 449 |
|
452 |
|
| 450 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
453 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 451 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
454 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 452 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com","manish.tiwari@smartdukaan.com")
|
455 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
| 453 |
.contains(loginDetails.getEmailId())) {
|
456 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 454 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
457 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
| 455 |
"You are not authorise to deactivate retailer");
|
458 |
"You are not authorise to deactivate retailer");
|
| 456 |
}
|
459 |
}
|
| 457 |
|
460 |
|
| 458 |
LocalDateTime currentDate =LocalDate.now().atStartOfDay();
|
461 |
LocalDateTime currentDate = LocalDate.now().atStartOfDay();
|
| 459 |
|
462 |
|
| 460 |
LocalDateTime EndDate = currentDate.plusDays(days);
|
463 |
LocalDateTime EndDate = currentDate.plusDays(days);
|
| 461 |
fofoStore.setActiveTimeStamp(EndDate);
|
464 |
fofoStore.setActiveTimeStamp(EndDate);
|
| 462 |
|
465 |
|
| 463 |
LOGGER.info("EndDate"+EndDate);
|
466 |
LOGGER.info("EndDate" + EndDate);
|
| 464 |
LOGGER.info("getActiveTimeStamp"+fofoStore.getActiveTimeStamp());
|
467 |
LOGGER.info("getActiveTimeStamp" + fofoStore.getActiveTimeStamp());
|
| 465 |
|
468 |
|
| 466 |
if( currentDate.isBefore(fofoStore.getActiveTimeStamp()))
|
469 |
if (currentDate.isBefore(fofoStore.getActiveTimeStamp())) {
|
| 467 |
{
|
- |
|
| 468 |
|
470 |
|
| 469 |
fofoStore.setActive(true);
|
471 |
fofoStore.setActive(true);
|
| 470 |
fofoStoreRepository.persist(fofoStore);
|
472 |
fofoStoreRepository.persist(fofoStore);
|
| 471 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
473 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
| 472 |
|
474 |
|
| 473 |
}
|
475 |
}
|
| 474 |
|
- |
|
| 475 |
|
476 |
|
| 476 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
477 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 477 |
return "response";
|
478 |
return "response";
|
| 478 |
}
|
479 |
}
|
| 479 |
|
- |
|
| 480 |
|
- |
|
| 481 |
|
480 |
|
| 482 |
@GetMapping(value = "/getAllInactiveStores")
|
481 |
@GetMapping(value = "/getAllInactiveStores")
|
| 483 |
public String getInactiveStores(HttpServletRequest request, Model model) {
|
482 |
public String getInactiveStores(HttpServletRequest request, Model model) {
|
| 484 |
List<FofoStore> inActiveFofoStores = fofoStoreRepository.selectInActiveStore();
|
483 |
List<FofoStore> inActiveFofoStores = fofoStoreRepository.selectInActiveStore();
|
| 485 |
Map<Integer, CustomRetailer> customRetailers = retailerService
|
484 |
Map<Integer, CustomRetailer> customRetailers = retailerService
|
| Line 906... |
Line 905... |
| 906 |
model.addAttribute("customRetailers", customRetailers);
|
905 |
model.addAttribute("customRetailers", customRetailers);
|
| 907 |
model.addAttribute("retailerBrandsLimitMap", retailerBrandsLimitMap);
|
906 |
model.addAttribute("retailerBrandsLimitMap", retailerBrandsLimitMap);
|
| 908 |
return "brands-limit-mapping";
|
907 |
return "brands-limit-mapping";
|
| 909 |
|
908 |
|
| 910 |
}
|
909 |
}
|
| 911 |
|
- |
|
| 912 |
|
- |
|
| 913 |
|
- |
|
| 914 |
|
910 |
|
| 915 |
@RequestMapping(value = "/setPartnerPincode", method = RequestMethod.POST)
|
911 |
@RequestMapping(value = "/setPartnerPincode", method = RequestMethod.POST)
|
| 916 |
public String setPartnerPincode(HttpServletRequest request,
|
912 |
public String setPartnerPincode(HttpServletRequest request,
|
| 917 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,
|
913 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,
|
| 918 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId,Model model) throws Exception {
|
914 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| - |
|
915 |
throws Exception {
|
| 919 |
|
916 |
|
| 920 |
if(!pincode.equals("")) {
|
917 |
if (!pincode.equals("")) {
|
| 921 |
PincodePartner pinPartner = new PincodePartner();
|
918 |
PincodePartner pinPartner = new PincodePartner();
|
| 922 |
pinPartner.setFofoId(fofoId);
|
919 |
pinPartner.setFofoId(fofoId);
|
| 923 |
pinPartner.setPincode(pincode);
|
920 |
pinPartner.setPincode(pincode);
|
| 924 |
PincodePartnerRepository.perist(pinPartner);
|
921 |
PincodePartnerRepository.perist(pinPartner);
|
| 925 |
}
|
922 |
}
|
| 926 |
|
- |
|
| 927 |
List<PincodePartner> partnerPincodeList= PincodePartnerRepository.selectByPartnerId(fofoId);
|
- |
|
| 928 |
|
- |
|
| 929 |
LOGGER.info("partnerPincodeList" +partnerPincodeList);
|
- |
|
| 930 |
|
923 |
|
| - |
|
924 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
| - |
|
925 |
|
| - |
|
926 |
LOGGER.info("partnerPincodeList" + partnerPincodeList);
|
| - |
|
927 |
|
| 931 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
928 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 932 |
return "pincode-partner-index";
|
929 |
return "pincode-partner-index";
|
| 933 |
|
930 |
|
| 934 |
}
|
931 |
}
|
| 935 |
|
- |
|
| 936 |
|
932 |
|
| 937 |
@RequestMapping(value = "/removePartnerPincode", method = RequestMethod.POST)
|
933 |
@RequestMapping(value = "/removePartnerPincode", method = RequestMethod.POST)
|
| 938 |
public String removePartnerPincode(HttpServletRequest request,
|
934 |
public String removePartnerPincode(HttpServletRequest request, @RequestParam int id,
|
| 939 |
@RequestParam int id,
|
- |
|
| 940 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId,Model model) throws Exception {
|
935 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| - |
|
936 |
throws Exception {
|
| 941 |
|
937 |
|
| 942 |
|
- |
|
| 943 |
PincodePartnerRepository.delete(id);
|
938 |
PincodePartnerRepository.delete(id);
|
| 944 |
|
939 |
|
| 945 |
List<PincodePartner> partnerPincodeList= PincodePartnerRepository.selectByPartnerId(fofoId);
|
940 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
| 946 |
|
941 |
|
| 947 |
LOGGER.info("partnerPincodeList" +partnerPincodeList);
|
942 |
LOGGER.info("partnerPincodeList" + partnerPincodeList);
|
| - |
|
943 |
|
| - |
|
944 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 948 |
|
945 |
|
| 949 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
- |
|
| 950 |
|
- |
|
| 951 |
return "pincode-partner-index";
|
946 |
return "pincode-partner-index";
|
| 952 |
|
947 |
|
| 953 |
}
|
948 |
}
|
| 954 |
|
949 |
|
| 955 |
@RequestMapping(value = "/removeSearchPincode", method = RequestMethod.POST)
|
950 |
@RequestMapping(value = "/removeSearchPincode", method = RequestMethod.POST)
|
| 956 |
public String removeSearchPincode(HttpServletRequest request,@RequestParam int id,
|
951 |
public String removeSearchPincode(HttpServletRequest request, @RequestParam int id,
|
| 957 |
@RequestParam(name = "pin", required = true, defaultValue = "") String pin,
|
952 |
@RequestParam(name = "pin", required = true, defaultValue = "") String pin,
|
| 958 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId,Model model) throws Exception {
|
953 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
| - |
|
954 |
throws Exception {
|
| 959 |
|
955 |
|
| 960 |
|
- |
|
| 961 |
PincodePartnerRepository.delete(id);
|
956 |
PincodePartnerRepository.delete(id);
|
| 962 |
|
- |
|
| 963 |
List<PincodePartner> partnerPincodeList= PincodePartnerRepository.selectPartnersByPincode(pin);
|
- |
|
| 964 |
|
- |
|
| 965 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
- |
|
| 966 |
|
957 |
|
| - |
|
958 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pin);
|
| - |
|
959 |
|
| - |
|
960 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 967 |
|
961 |
|
| 968 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
962 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 969 |
|
963 |
|
| 970 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
964 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 971 |
|
965 |
|
| 972 |
|
- |
|
| 973 |
return "search-pincode-partner";
|
966 |
return "search-pincode-partner";
|
| 974 |
|
967 |
|
| 975 |
}
|
968 |
}
|
| 976 |
|
969 |
|
| 977 |
@RequestMapping(value = "/searchPincodePartner", method = RequestMethod.GET)
|
970 |
@RequestMapping(value = "/searchPincodePartner", method = RequestMethod.GET)
|
| 978 |
public String searchPincodePartner(HttpServletRequest request,
|
971 |
public String searchPincodePartner(HttpServletRequest request,
|
| 979 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,Model model) throws Exception {
|
972 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode, Model model)
|
| - |
|
973 |
throws Exception {
|
| - |
|
974 |
|
| - |
|
975 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pincode);
|
| 980 |
|
976 |
|
| 981 |
List<PincodePartner> partnerPincodeList= PincodePartnerRepository.selectPartnersByPincode(pincode);
|
- |
|
| 982 |
|
- |
|
| 983 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
977 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 984 |
|
978 |
|
| 985 |
|
- |
|
| 986 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
979 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 987 |
|
980 |
|
| 988 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
981 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 989 |
|
982 |
|
| 990 |
return "search-pincode-partner";
|
983 |
return "search-pincode-partner";
|
| 991 |
|
- |
|
| 992 |
|
984 |
|
| 993 |
}
|
985 |
}
|
| 994 |
|
986 |
|
| 995 |
@RequestMapping(value = "/showPartnerPincode", method = RequestMethod.GET)
|
987 |
@RequestMapping(value = "/showPartnerPincode", method = RequestMethod.GET)
|
| 996 |
public String showPartnerPincode(HttpServletRequest request,
|
988 |
public String showPartnerPincode(HttpServletRequest request,
|
| 997 |
@RequestParam(name = "partnerId", required = true, defaultValue = "") int partnerId,Model model) throws Exception {
|
989 |
@RequestParam(name = "partnerId", required = true, defaultValue = "") int partnerId, Model model)
|
| - |
|
990 |
throws Exception {
|
| - |
|
991 |
|
| - |
|
992 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(partnerId);
|
| 998 |
|
993 |
|
| 999 |
List<PincodePartner> partnerPincodeList= PincodePartnerRepository.selectByPartnerId(partnerId);
|
- |
|
| 1000 |
|
- |
|
| 1001 |
|
- |
|
| 1002 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
994 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 1003 |
|
995 |
|
| 1004 |
return "pincode-partner-index";
|
996 |
return "pincode-partner-index";
|
| 1005 |
|
- |
|
| 1006 |
|
997 |
|
| 1007 |
}
|
998 |
}
|
| 1008 |
|
- |
|
| 1009 |
|
999 |
|
| 1010 |
@RequestMapping(value = "/getAllPartnerPincode", method = RequestMethod.GET)
|
1000 |
@RequestMapping(value = "/getAllPartnerPincode", method = RequestMethod.GET)
|
| 1011 |
public String getAllPartnerPincode(HttpServletRequest request,
|
1001 |
public String getAllPartnerPincode(HttpServletRequest request, Model model) throws Exception {
|
| 1012 |
Model model) throws Exception {
|
- |
|
| 1013 |
|
1002 |
|
| 1014 |
|
- |
|
| 1015 |
|
- |
|
| 1016 |
return "add-partner-pincode";
|
1003 |
return "add-partner-pincode";
|
| 1017 |
|
- |
|
| 1018 |
|
1004 |
|
| 1019 |
}
|
1005 |
}
|
| 1020 |
}
|
1006 |
}
|
| 1021 |
|
1007 |
|