| Line 34... |
Line 34... |
| 34 |
import com.mongodb.DBObject;
|
34 |
import com.mongodb.DBObject;
|
| 35 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
35 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 36 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
36 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 37 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
37 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 38 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
38 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
| - |
|
39 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 39 |
import com.spice.profitmandi.common.model.Notification;
|
40 |
import com.spice.profitmandi.common.model.Notification;
|
| 40 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
41 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 41 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
42 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 42 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
43 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
| 43 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
- |
|
| 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.NotificationCampaign;
|
45 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 46 |
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
|
46 |
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
|
| 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.PartnerDailyInvestment;
|
48 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 49 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
49 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 50 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
50 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 51 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
51 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 52 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
52 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 53 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
53 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 54 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
- |
|
| 55 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
54 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 56 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
55 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 57 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
56 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 58 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
57 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
| 59 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
58 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| Line 62... |
Line 61... |
| 62 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
61 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 63 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
62 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| 64 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
63 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 65 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
64 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| 66 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
65 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 67 |
import com.spice.profitmandi.service.AuthService;
|
- |
|
| 68 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
66 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 69 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
67 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 70 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
68 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| - |
|
69 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 71 |
import com.spice.profitmandi.web.model.LoginDetails;
|
70 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 72 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
71 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 73 |
|
72 |
|
| 74 |
@Controller
|
73 |
@Controller
|
| 75 |
@Transactional(rollbackOn = Throwable.class)
|
74 |
@Transactional(rollbackOn = Throwable.class)
|
| Line 93... |
Line 92... |
| 93 |
@Autowired
|
92 |
@Autowired
|
| 94 |
private PartnerTargetRepository partnerTargetRepository;
|
93 |
private PartnerTargetRepository partnerTargetRepository;
|
| 95 |
|
94 |
|
| 96 |
@Autowired
|
95 |
@Autowired
|
| 97 |
private ResponseSender<?> responseSender;
|
96 |
private ResponseSender<?> responseSender;
|
| - |
|
97 |
|
| - |
|
98 |
@Autowired
|
| - |
|
99 |
RetailerService retailerService;
|
| 98 |
|
100 |
|
| 99 |
@Autowired
|
101 |
@Autowired
|
| 100 |
private RoleManager roleManager;
|
102 |
private RoleManager roleManager;
|
| 101 |
|
103 |
|
| 102 |
@Autowired
|
104 |
@Autowired
|
| Line 158... |
Line 160... |
| 158 |
if (isAdmin) {
|
160 |
if (isAdmin) {
|
| 159 |
return "dashboard1";
|
161 |
return "dashboard1";
|
| 160 |
} else {
|
162 |
} else {
|
| 161 |
FofoStore fofoStore = null;
|
163 |
FofoStore fofoStore = null;
|
| 162 |
try {
|
164 |
try {
|
| - |
|
165 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 163 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
166 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 164 |
if (!fofoStore.isActive()) {
|
167 |
if (!fofoStore.isActive()) {
|
| 165 |
return "redirect:/login";
|
168 |
return "redirect:/login";
|
| 166 |
}
|
169 |
}
|
| 167 |
|
170 |
|
| 168 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
171 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
| 169 |
model.addAttribute("partnerType", partnerType);
|
172 |
model.addAttribute("partnerType", partnerType);
|
| 170 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
173 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
| 171 |
model.addAttribute("fofoStore", fofoStore);
|
174 |
model.addAttribute("fofoStore", customRetailer);
|
| 172 |
model.addAttribute("partnerType", partnerType);
|
175 |
model.addAttribute("partnerType", partnerType);
|
| 173 |
model.addAttribute("hasGift", hasGift(fofoId));
|
176 |
model.addAttribute("hasGift", hasGift(fofoId));
|
| 174 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
177 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| 175 |
|
178 |
|
| 176 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(fofoId));
|
179 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(fofoId));
|
| Line 306... |
Line 309... |
| 306 |
model.addAttribute("webApiHost", webApiHost);
|
309 |
model.addAttribute("webApiHost", webApiHost);
|
| 307 |
model.addAttribute("webApiPort", webApiPort);
|
310 |
model.addAttribute("webApiPort", webApiPort);
|
| 308 |
model.addAttribute("webApiScheme", webApiScheme);
|
311 |
model.addAttribute("webApiScheme", webApiScheme);
|
| 309 |
model.addAttribute("webApiRoot", webApiRoot);
|
312 |
model.addAttribute("webApiRoot", webApiRoot);
|
| 310 |
if (isAdmin) {
|
313 |
if (isAdmin) {
|
| 311 |
return "dashboard1";
|
314 |
return adminPanel();
|
| 312 |
} else {
|
315 |
} else {
|
| 313 |
FofoStore fofoStore = null;
|
316 |
FofoStore fofoStore = null;
|
| 314 |
try {
|
317 |
try {
|
| 315 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
318 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 316 |
if (!fofoStore.isActive()) {
|
319 |
if (!fofoStore.isActive()) {
|
| Line 364... |
Line 367... |
| 364 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
367 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
| 365 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
368 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
| 366 |
return "dashboard1";
|
369 |
return "dashboard1";
|
| 367 |
}
|
370 |
}
|
| 368 |
|
371 |
|
| - |
|
372 |
private String adminPanel() {
|
| - |
|
373 |
return "admin";
|
| - |
|
374 |
}
|
| - |
|
375 |
|
| 369 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
376 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
| 370 |
private boolean hasGift(int fofoId) {
|
377 |
private boolean hasGift(int fofoId) {
|
| 371 |
try {
|
378 |
try {
|
| 372 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
|
379 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
|
| 373 |
.getAvailability() > 0;
|
380 |
.getAvailability() > 0;
|