| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service;
|
1 |
package com.spice.profitmandi.service;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDate;
|
3 |
import java.time.LocalDate;
|
| 4 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.LocalTime;
|
5 |
import java.time.LocalTime;
|
| - |
|
6 |
import java.time.YearMonth;
|
| 6 |
import java.util.HashMap;
|
7 |
import java.util.HashMap;
|
| 7 |
import java.util.List;
|
8 |
import java.util.List;
|
| 8 |
import java.util.Map;
|
9 |
import java.util.Map;
|
| 9 |
import java.util.Set;
|
10 |
import java.util.Set;
|
| 10 |
import java.util.stream.Collectors;
|
11 |
import java.util.stream.Collectors;
|
| 11 |
|
12 |
|
| 12 |
import org.apache.logging.log4j.LogManager;
|
13 |
import org.apache.logging.log4j.LogManager;
|
| 13 |
import org.apache.logging.log4j.Logger;
|
14 |
import org.apache.logging.log4j.Logger;
|
| 14 |
import org.springframework.beans.factory.annotation.Autowired;
|
15 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 15 |
import org.springframework.cache.annotation.Cacheable;
|
- |
|
| 16 |
import org.springframework.stereotype.Component;
|
16 |
import org.springframework.stereotype.Component;
|
| 17 |
|
17 |
|
| 18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 19 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
19 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 20 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
20 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| Line 26... |
Line 26... |
| 26 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
26 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 27 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
27 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
28 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
29 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
30 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
- |
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
31 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 33 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
32 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 34 |
import com.spice.profitmandi.service.user.RetailerService;
|
33 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 35 |
|
34 |
|
| 36 |
@Component
|
35 |
@Component
|
| Line 72... |
Line 71... |
| 72 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
71 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 73 |
Map<Integer, Double> lmtdSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(
|
72 |
Map<Integer, Double> lmtdSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(
|
| 74 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), 0, false);
|
73 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), 0, false);
|
| 75 |
Map<Integer, Double> mtdSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate.withDayOfMonth(1),
|
74 |
Map<Integer, Double> mtdSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate.withDayOfMonth(1),
|
| 76 |
curDate.with(LocalTime.MAX), 0, false);
|
75 |
curDate.with(LocalTime.MAX), 0, false);
|
| - |
|
76 |
int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
|
| - |
|
77 |
|
| - |
|
78 |
Map<Integer, Double> lmsSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(
|
| - |
|
79 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1).withDayOfMonth(lengthOfMonth), 0,
|
| - |
|
80 |
false);
|
| 77 |
|
81 |
|
| 78 |
Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
|
82 |
Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
|
| 79 |
curDate.with(LocalTime.MAX), 0, false);
|
83 |
curDate.with(LocalTime.MAX), 0, false);
|
| 80 |
|
84 |
|
| 81 |
Map<Integer, Long> last3daystertiary = fofoOrderItemRepository.selectQtyGroupByRetailer(curDate.minusDays(4),
|
85 |
Map<Integer, Long> last3daystertiary = fofoOrderItemRepository.selectQtyGroupByRetailer(curDate.minusDays(4),
|
| Line 111... |
Line 115... |
| 111 |
Map<EscalationType, AuthUser> authuserEsclationTypeMap = csService
|
115 |
Map<EscalationType, AuthUser> authuserEsclationTypeMap = csService
|
| 112 |
.getAuthUserAndEsclationByPartnerId(fofoId);
|
116 |
.getAuthUserAndEsclationByPartnerId(fofoId);
|
| 113 |
PartnerDetailModel pm = new PartnerDetailModel();
|
117 |
PartnerDetailModel pm = new PartnerDetailModel();
|
| 114 |
pm.setLmtd(lmtdSale.get(fofoId) == null ? 0 : lmtdSale.get(fofoId).intValue());
|
118 |
pm.setLmtd(lmtdSale.get(fofoId) == null ? 0 : lmtdSale.get(fofoId).intValue());
|
| 115 |
pm.setMtd(mtdSale.get(fofoId) == null ? 0 : mtdSale.get(fofoId).intValue());
|
119 |
pm.setMtd(mtdSale.get(fofoId) == null ? 0 : mtdSale.get(fofoId).intValue());
|
| - |
|
120 |
pm.setLms(lmsSale.get(fofoId) == null ? 0 : lmsSale.get(fofoId).intValue());
|
| 116 |
pm.setTodayTertiary(todaytertiary.get(fofoId) == null ? 0 : todaytertiary.get(fofoId).intValue());
|
121 |
pm.setTodayTertiary(todaytertiary.get(fofoId) == null ? 0 : todaytertiary.get(fofoId).intValue());
|
| 117 |
pm.setLastThreeDaytertiary(last3daystertiary.get(fofoId) == null ? 0 : last3daystertiary.get(fofoId));
|
122 |
pm.setLastThreeDaytertiary(last3daystertiary.get(fofoId) == null ? 0 : last3daystertiary.get(fofoId));
|
| 118 |
pm.setWalletAmount(userWallet.get(fofoId) == null ? 0 : userWallet.get(fofoId).getAmount());
|
123 |
pm.setWalletAmount(userWallet.get(fofoId) == null ? 0 : userWallet.get(fofoId).getAmount());
|
| 119 |
pm.setInvestment(investmentMap.get(fofoId));
|
124 |
pm.setInvestment(investmentMap.get(fofoId));
|
| 120 |
pm.setTicket(ticketMap.get(fofoId) == null ? 0 : ticketMap.get(fofoId).intValue());
|
125 |
pm.setTicket(ticketMap.get(fofoId) == null ? 0 : ticketMap.get(fofoId).intValue());
|