| Line 25... |
Line 25... |
| 25 |
import org.apache.logging.log4j.LogManager;
|
25 |
import org.apache.logging.log4j.LogManager;
|
| 26 |
import org.apache.logging.log4j.Logger;
|
26 |
import org.apache.logging.log4j.Logger;
|
| 27 |
import org.json.JSONObject;
|
27 |
import org.json.JSONObject;
|
| 28 |
import org.springframework.beans.factory.annotation.Autowired;
|
28 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 29 |
import org.springframework.beans.factory.annotation.Value;
|
29 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
30 |
import org.springframework.cglib.core.Local;
|
| 30 |
import org.springframework.core.io.InputStreamResource;
|
31 |
import org.springframework.core.io.InputStreamResource;
|
| 31 |
import org.springframework.http.HttpHeaders;
|
32 |
import org.springframework.http.HttpHeaders;
|
| 32 |
import org.springframework.http.HttpStatus;
|
33 |
import org.springframework.http.HttpStatus;
|
| 33 |
import org.springframework.http.ResponseEntity;
|
34 |
import org.springframework.http.ResponseEntity;
|
| 34 |
import org.springframework.stereotype.Controller;
|
35 |
import org.springframework.stereotype.Controller;
|
| Line 95... |
Line 96... |
| 95 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
96 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 96 |
|
97 |
|
| 97 |
@Controller
|
98 |
@Controller
|
| 98 |
@Transactional(rollbackOn = Throwable.class)
|
99 |
@Transactional(rollbackOn = Throwable.class)
|
| 99 |
public class DashboardController {
|
100 |
public class DashboardController {
|
| - |
|
101 |
|
| - |
|
102 |
private static final double ONE_LAC = 1*1000*100;
|
| - |
|
103 |
private static final double TWO_LAC = 2*1000*100;
|
| - |
|
104 |
private static final double FOUR_LAC = 4*1000*100;
|
| 100 |
|
105 |
|
| 101 |
@Value("${web.api.host}")
|
106 |
@Value("${web.api.host}")
|
| 102 |
private String webApiHost;
|
107 |
private String webApiHost;
|
| 103 |
|
108 |
|
| 104 |
@Value("${web.api.scheme}")
|
109 |
@Value("${web.api.scheme}")
|
| Line 251... |
Line 256... |
| 251 |
currentMonthEnd);
|
256 |
currentMonthEnd);
|
| 252 |
if (hygieneCount == 0 && invalidHygieneCount == 0) {
|
257 |
if (hygieneCount == 0 && invalidHygieneCount == 0) {
|
| 253 |
invalidHygieneCount = 1;
|
258 |
invalidHygieneCount = 1;
|
| 254 |
}
|
259 |
}
|
| 255 |
model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
|
260 |
model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
|
| 256 |
|
261 |
|
| - |
|
262 |
//Hardcoded for valentine
|
| - |
|
263 |
if(LocalDate.now().isBefore(LocalDate.of(2020, 1, 17))) {
|
| - |
|
264 |
double valentineSales = fofoOrderItemRepository.selectSumAmountGroupByRetailer(LocalDate.of(2019, 2, 11).atStartOfDay(),
|
| - |
|
265 |
LocalDate.of(2019, 2, 11).atStartOfDay(), fofoId, false).get(fofoId);
|
| - |
|
266 |
if(valentineSales < ONE_LAC) {
|
| - |
|
267 |
model.addAttribute("valentineSale", "ONE_LAC");
|
| - |
|
268 |
model.addAttribute("valentineShort", ONE_LAC - valentineSales);
|
| - |
|
269 |
} else if(valentineSales < TWO_LAC) {
|
| - |
|
270 |
model.addAttribute("valentineSale", "TWO_LAC");
|
| - |
|
271 |
model.addAttribute("valentineShort", TWO_LAC - valentineSales);
|
| - |
|
272 |
} else if (valentineSales < FOUR_LAC) {
|
| - |
|
273 |
model.addAttribute("valentineSale", "FOUR_LAC");
|
| - |
|
274 |
model.addAttribute("valentineShort", FOUR_LAC - valentineSales);
|
| - |
|
275 |
} else {
|
| - |
|
276 |
model.addAttribute("valentineSale", "CONGO");
|
| - |
|
277 |
}
|
| - |
|
278 |
}
|
| - |
|
279 |
|
| 257 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
280 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
| 258 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
281 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
| 259 |
return "12dashboard34";
|
282 |
return "12dashboard34";
|
| 260 |
}
|
283 |
}
|
| 261 |
|
284 |
|
| Line 296... |
Line 319... |
| 296 |
.get(fofoId);
|
319 |
.get(fofoId);
|
| 297 |
Double lmtdSale = fofoOrderItemRepository
|
320 |
Double lmtdSale = fofoOrderItemRepository
|
| 298 |
.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1).minusMonths(1),
|
321 |
.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1).minusMonths(1),
|
| 299 |
curDate.with(LocalTime.MAX).minusMonths(1), fofoId, false)
|
322 |
curDate.with(LocalTime.MAX).minusMonths(1), fofoId, false)
|
| 300 |
.get(fofoId);
|
323 |
.get(fofoId);
|
| - |
|
324 |
|
| 301 |
|
325 |
|
| 302 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
326 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
| 303 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
|
327 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
|
| 304 |
if (partnerTargetDetails.isEmpty()) {
|
328 |
if (partnerTargetDetails.isEmpty()) {
|
| 305 |
partnerTargetDetails = partnerTargetRepository
|
329 |
partnerTargetDetails = partnerTargetRepository
|
| Line 398... |
Line 422... |
| 398 |
// this.setInvestments
|
422 |
// this.setInvestments
|
| 399 |
//
|
423 |
//
|
| 400 |
model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
|
424 |
model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
|
| 401 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
425 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
| 402 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
426 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| - |
|
427 |
|
| - |
|
428 |
//Hardcoded for valentine
|
| - |
|
429 |
if(LocalDate.now().isBefore(LocalDate.of(2020, 1, 17))) {
|
| - |
|
430 |
double valentineSales = fofoOrderItemRepository.selectSumAmountGroupByRetailer(LocalDate.of(2019, 2, 11).atStartOfDay(),
|
| - |
|
431 |
LocalDate.of(2019, 2, 11).atStartOfDay(), loginDetails.getFofoId(), false).get(loginDetails.getFofoId());
|
| - |
|
432 |
if(valentineSales < ONE_LAC) {
|
| - |
|
433 |
model.addAttribute("valentineSale", "ONE_LAC");
|
| - |
|
434 |
model.addAttribute("valentineShort", ONE_LAC - valentineSales);
|
| - |
|
435 |
} else if(valentineSales < TWO_LAC) {
|
| - |
|
436 |
model.addAttribute("valentineSale", "TWO_LAC");
|
| - |
|
437 |
model.addAttribute("valentineShort", TWO_LAC - valentineSales);
|
| - |
|
438 |
} else if (valentineSales < FOUR_LAC) {
|
| - |
|
439 |
model.addAttribute("valentineSale", "FOUR_LAC");
|
| - |
|
440 |
model.addAttribute("valentineShort", FOUR_LAC - valentineSales);
|
| - |
|
441 |
} else {
|
| - |
|
442 |
model.addAttribute("valentineSale", "CONGO");
|
| - |
|
443 |
}
|
| - |
|
444 |
}
|
| 403 |
} catch (ProfitMandiBusinessException e) {
|
445 |
} catch (ProfitMandiBusinessException e) {
|
| 404 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
446 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 405 |
|
447 |
|
| 406 |
}
|
448 |
}
|
| 407 |
}
|
449 |
}
|