| 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.util.ArrayList;
|
- |
|
| 7 |
import java.util.HashMap;
|
6 |
import java.util.HashMap;
|
| 8 |
import java.util.List;
|
7 |
import java.util.List;
|
| 9 |
import java.util.Map;
|
8 |
import java.util.Map;
|
| 10 |
import java.util.stream.Collectors;
|
- |
|
| 11 |
|
9 |
|
| - |
|
10 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
11 |
import org.apache.logging.log4j.Logger;
|
| 12 |
import org.springframework.beans.factory.annotation.Autowired;
|
12 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 13 |
import org.springframework.cache.annotation.Cacheable;
|
13 |
import org.springframework.cache.annotation.Cacheable;
|
| 14 |
import org.springframework.stereotype.Component;
|
14 |
import org.springframework.stereotype.Component;
|
| 15 |
import org.springframework.stereotype.Service;
|
- |
|
| 16 |
|
15 |
|
| 17 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 18 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
17 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 19 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
18 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 20 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
19 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| Line 24... |
Line 23... |
| 24 |
import com.spice.profitmandi.service.user.RetailerService;
|
23 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 25 |
|
24 |
|
| 26 |
@Component
|
25 |
@Component
|
| 27 |
public class PartnerStatsServiceImpl implements PartnerStatsService {
|
26 |
public class PartnerStatsServiceImpl implements PartnerStatsService {
|
| 28 |
|
27 |
|
| - |
|
28 |
private static final Logger LOGGER = LogManager.getLogger(PartnerStatsServiceImpl.class);
|
| - |
|
29 |
|
| 29 |
@Autowired
|
30 |
@Autowired
|
| 30 |
RetailerService retailerService;
|
31 |
RetailerService retailerService;
|
| 31 |
|
32 |
|
| 32 |
@Autowired
|
33 |
@Autowired
|
| 33 |
FofoOrderItemRepository fofoOrderItemRepository;
|
34 |
FofoOrderItemRepository fofoOrderItemRepository;
|
| Line 51... |
Line 52... |
| 51 |
Map<Integer, Double> lmtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(
|
52 |
Map<Integer, Double> lmtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(
|
| 52 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), 0, false);
|
53 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), 0, false);
|
| 53 |
Map<Integer, Double> mtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1),
|
54 |
Map<Integer, Double> mtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1),
|
| 54 |
curDate.with(LocalTime.MAX), 0, false);
|
55 |
curDate.with(LocalTime.MAX), 0, false);
|
| 55 |
|
56 |
|
| 56 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
- |
|
| 57 |
Map<Integer, Long> ticketMap = ticketRepository.selectAllOpenTicketsGroupByRetailer();
|
57 |
Map<Integer, Long> ticketMap = ticketRepository.selectAllOpenTicketsGroupByRetailer();
|
| 58 |
|
58 |
|
| 59 |
Map<Integer, String> fofoRetailerMap = retailerService.getAllFofoRetailerIdNameMap();
|
59 |
Map<Integer, String> fofoRetailerMap = retailerService.getAllFofoRetailerIdNameMap();
|
| 60 |
Map<Integer, PartnerDetailModel> allPartnerStats = new HashMap<>();
|
60 |
Map<Integer, PartnerDetailModel> allPartnerStats = new HashMap<>();
|
| 61 |
|
61 |
|
| Line 79... |
Line 79... |
| 79 |
pm.setHygiene(hygieneCount);
|
79 |
pm.setHygiene(hygieneCount);
|
| 80 |
pm.setTotalHygiene(totalHygieneCount);
|
80 |
pm.setTotalHygiene(totalHygieneCount);
|
| 81 |
|
81 |
|
| 82 |
pm.setTicket(ticketMap.get(fofoId) == null ? 0 : ticketMap.get(fofoId).intValue());
|
82 |
pm.setTicket(ticketMap.get(fofoId) == null ? 0 : ticketMap.get(fofoId).intValue());
|
| 83 |
allPartnerStats.put(fofoId, pm);
|
83 |
allPartnerStats.put(fofoId, pm);
|
| - |
|
84 |
LOGGER.info("pm {}", pm);
|
| 84 |
|
85 |
|
| 85 |
}
|
86 |
}
|
| 86 |
return allPartnerStats;
|
87 |
return allPartnerStats;
|
| 87 |
}
|
88 |
}
|
| 88 |
|
89 |
|
| 89 |
@Override
|
90 |
@Override
|