| Line 36... |
Line 36... |
| 36 |
import org.springframework.web.bind.annotation.RequestMapping;
|
36 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 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.google.gson.Gson;
|
40 |
import com.google.gson.Gson;
|
| 41 |
import com.google.gson.JsonElement;
|
- |
|
| 42 |
import com.mongodb.DBObject;
|
41 |
import com.mongodb.DBObject;
|
| 43 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
42 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 44 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
43 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 45 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
44 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 46 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
45 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| Line 59... |
Line 58... |
| 59 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
58 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 60 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
59 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
| 61 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
60 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 62 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
61 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 63 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
62 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 64 |
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
|
- |
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 69 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
67 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| Line 83... |
Line 81... |
| 83 |
import com.spice.profitmandi.dao.repository.dtr.UserCampaignRepository;
|
81 |
import com.spice.profitmandi.dao.repository.dtr.UserCampaignRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
82 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
83 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
84 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
85 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| - |
|
86 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
87 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 89 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
88 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| 90 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
89 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 91 |
import com.spice.profitmandi.service.AuthService;
|
- |
|
| 92 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
90 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 93 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
91 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 94 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
92 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 95 |
import com.spice.profitmandi.service.user.RetailerService;
|
93 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 96 |
import com.spice.profitmandi.web.model.LoginDetails;
|
94 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| Line 145... |
Line 143... |
| 145 |
@Autowired
|
143 |
@Autowired
|
| 146 |
private PartnerInvestmentService partnerInvestmentService;
|
144 |
private PartnerInvestmentService partnerInvestmentService;
|
| 147 |
|
145 |
|
| 148 |
@Autowired
|
146 |
@Autowired
|
| 149 |
DocumentRepository documentRepository;
|
147 |
DocumentRepository documentRepository;
|
| - |
|
148 |
|
| - |
|
149 |
@Autowired
|
| - |
|
150 |
InventoryItemRepository inventoryItemRepository;
|
| 150 |
|
151 |
|
| 151 |
@Autowired
|
152 |
@Autowired
|
| 152 |
InventoryService inventoryService;
|
153 |
InventoryService inventoryService;
|
| 153 |
|
154 |
|
| 154 |
@Autowired
|
155 |
@Autowired
|
| Line 201... |
Line 202... |
| 201 |
model.addAttribute("webApiPort", webApiPort);
|
202 |
model.addAttribute("webApiPort", webApiPort);
|
| 202 |
model.addAttribute("webApiScheme", webApiScheme);
|
203 |
model.addAttribute("webApiScheme", webApiScheme);
|
| 203 |
model.addAttribute("webApiRoot", webApiRoot);
|
204 |
model.addAttribute("webApiRoot", webApiRoot);
|
| 204 |
if (isAdmin) {
|
205 |
if (isAdmin) {
|
| 205 |
return "dashboard1";
|
206 |
return "dashboard1";
|
| 206 |
} else {
|
- |
|
| 207 |
FofoStore fofoStore = null;
|
207 |
FofoStore fofoStore = null;
|
| 208 |
try {
|
208 |
try {
|
| 209 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
209 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 210 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
210 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 211 |
if (!fofoStore.isActive()) {
|
211 |
if (!fofoStore.isActive()) {
|
| 212 |
return "redirect:/login";
|
212 |
return "redirect:/login";
|
| 213 |
}
|
- |
|
| 214 |
|
- |
|
| 215 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
- |
|
| 216 |
model.addAttribute("partnerType", partnerType);
|
- |
|
| 217 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
- |
|
| 218 |
model.addAttribute("fofoStore", customRetailer);
|
- |
|
| 219 |
model.addAttribute("partnerType", partnerType);
|
- |
|
| 220 |
model.addAttribute("hasGift", hasGift(fofoId));
|
- |
|
| 221 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
- |
|
| 222 |
|
- |
|
| 223 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(fofoId));
|
- |
|
| 224 |
model.addAttribute("salesMap", this.getSales(fofoId));
|
- |
|
| 225 |
// this.setInvestments
|
- |
|
| 226 |
//
|
- |
|
| 227 |
model.addAttribute("investments", this.getInvestments(fofoId));
|
- |
|
| 228 |
model.addAttribute("isInvestmentOk",
|
- |
|
| 229 |
partnerInvestmentService.isInvestmentOk(fofoId, 10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
- |
|
| 230 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 231 |
LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
|
- |
|
| 232 |
|
- |
|
| 233 |
}
|
213 |
}
|
| - |
|
214 |
|
| - |
|
215 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
| - |
|
216 |
model.addAttribute("partnerType", partnerType);
|
| - |
|
217 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
| - |
|
218 |
model.addAttribute("fofoStore", customRetailer);
|
| - |
|
219 |
model.addAttribute("partnerType", partnerType);
|
| - |
|
220 |
model.addAttribute("hasGift", hasGift(fofoId));
|
| - |
|
221 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| - |
|
222 |
|
| - |
|
223 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(fofoId));
|
| - |
|
224 |
model.addAttribute("salesMap", this.getSales(fofoId));
|
| - |
|
225 |
model.addAttribute("activatedImeis", inventoryItemRepository.selectCountByActivatedNotSold(fofoId));
|
| - |
|
226 |
// this.setInvestments
|
| - |
|
227 |
//
|
| - |
|
228 |
model.addAttribute("investments", this.getInvestments(fofoId));
|
| - |
|
229 |
model.addAttribute("isInvestmentOk",
|
| - |
|
230 |
partnerInvestmentService.isInvestmentOk(fofoId, 10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| - |
|
231 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
232 |
LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
|
| - |
|
233 |
|
| 234 |
}
|
234 |
}
|
| 235 |
|
235 |
|
| 236 |
LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
|
236 |
LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
|
| 237 |
LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
|
237 |
LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
|
| 238 |
double currentMonthRating = hygieneDataRepository.selectRatingAvg(fofoId, currentMonthStart, currentMonthEnd)
|
238 |
double currentMonthRating = hygieneDataRepository.selectRatingAvg(fofoId, currentMonthStart, currentMonthEnd)
|