| Line 3... |
Line 3... |
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.net.URISyntaxException;
|
4 |
import java.net.URISyntaxException;
|
| 5 |
import java.time.DayOfWeek;
|
5 |
import java.time.DayOfWeek;
|
| 6 |
import java.time.LocalDate;
|
6 |
import java.time.LocalDate;
|
| 7 |
import java.time.LocalDateTime;
|
7 |
import java.time.LocalDateTime;
|
| - |
|
8 |
import java.time.LocalTime;
|
| 8 |
import java.time.temporal.TemporalAdjusters;
|
9 |
import java.time.temporal.TemporalAdjusters;
|
| 9 |
import java.util.ArrayList;
|
10 |
import java.util.ArrayList;
|
| - |
|
11 |
import java.util.HashMap;
|
| 10 |
import java.util.List;
|
12 |
import java.util.List;
|
| - |
|
13 |
import java.util.Map;
|
| - |
|
14 |
import java.util.Set;
|
| - |
|
15 |
import java.util.function.IntFunction;
|
| - |
|
16 |
import java.util.function.IntPredicate;
|
| - |
|
17 |
import java.util.stream.Collectors;
|
| 11 |
|
18 |
|
| 12 |
import javax.servlet.http.HttpServletRequest;
|
19 |
import javax.servlet.http.HttpServletRequest;
|
| 13 |
|
20 |
|
| 14 |
import org.apache.logging.log4j.LogManager;
|
21 |
import org.apache.logging.log4j.LogManager;
|
| 15 |
import org.apache.logging.log4j.Logger;
|
22 |
import org.apache.logging.log4j.Logger;
|
| Line 22... |
Line 29... |
| 22 |
import org.springframework.ui.Model;
|
29 |
import org.springframework.ui.Model;
|
| 23 |
import org.springframework.web.bind.annotation.RequestMapping;
|
30 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 24 |
import org.springframework.web.bind.annotation.RequestMethod;
|
31 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 25 |
import org.springframework.web.bind.annotation.RequestParam;
|
32 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 26 |
|
33 |
|
| - |
|
34 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
| 27 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
35 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 28 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
36 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
37 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| - |
|
38 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
| 29 |
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
|
39 |
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
|
| - |
|
40 |
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
|
| - |
|
41 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| - |
|
42 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 30 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
43 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 31 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
44 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| - |
|
45 |
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
|
| - |
|
46 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
47 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| - |
|
48 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
| - |
|
49 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
| - |
|
51 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
52 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| - |
|
53 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| - |
|
54 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
55 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
56 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 37 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
57 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 38 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
58 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 39 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
59 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| - |
|
60 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
| 40 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
61 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 41 |
import com.spice.profitmandi.service.wallet.WalletService;
|
62 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 42 |
import com.spice.profitmandi.web.model.LoginDetails;
|
63 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 43 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
64 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 44 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
65 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| Line 61... |
Line 82... |
| 61 |
|
82 |
|
| 62 |
@Autowired
|
83 |
@Autowired
|
| 63 |
private CookiesProcessor cookiesProcessor;
|
84 |
private CookiesProcessor cookiesProcessor;
|
| 64 |
|
85 |
|
| 65 |
@Autowired
|
86 |
@Autowired
|
| 66 |
private RoleManager roleManager;
|
- |
|
| 67 |
|
- |
|
| 68 |
@Autowired
|
- |
|
| 69 |
private FofoStoreRepository fofoStoreRepository;
|
87 |
private ItemRepository itemRepository;
|
| 70 |
|
88 |
|
| 71 |
@Autowired
|
89 |
@Autowired
|
| 72 |
private WalletService walletService;
|
90 |
private RoleManager roleManager;
|
| 73 |
|
- |
|
| 74 |
@Autowired
|
- |
|
| 75 |
private InventoryService inventoryService;
|
- |
|
| 76 |
|
- |
|
| 77 |
|
91 |
|
| 78 |
@Autowired
|
92 |
@Autowired
|
| 79 |
private OrderRepository orderRepository;
|
93 |
private FofoStoreRepository fofoStoreRepository;
|
| 80 |
|
- |
|
| 81 |
|
94 |
|
| 82 |
@Autowired
|
95 |
@Autowired
|
| 83 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
96 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
| 84 |
|
97 |
|
| 85 |
@Autowired
|
98 |
@Autowired
|
| 86 |
private PartnerInvestmentService partnerInvestmentService;
|
99 |
private PartnerInvestmentService partnerInvestmentService;
|
| 87 |
|
100 |
|
| - |
|
101 |
@Autowired
|
| - |
|
102 |
private InsurancePolicyRepository insurancePolicyRepository;
|
| 88 |
/*
|
103 |
/*
|
| 89 |
* @Autowired private ScanRepository scanRepository;
|
104 |
* @Autowired private ScanRepository scanRepository;
|
| 90 |
*/
|
105 |
*/
|
| - |
|
106 |
@Autowired
|
| - |
|
107 |
private RechargeTransactionRepository rechargeTransactionRepository;
|
| 91 |
|
108 |
|
| 92 |
@Autowired
|
109 |
@Autowired
|
| 93 |
private TransactionService transactionService;
|
110 |
private TransactionService transactionService;
|
| 94 |
|
111 |
|
| 95 |
@Autowired
|
112 |
@Autowired
|
| Line 99... |
Line 116... |
| 99 |
private NotificationPanelRepository notificationPanelRepository;
|
116 |
private NotificationPanelRepository notificationPanelRepository;
|
| 100 |
|
117 |
|
| 101 |
@Autowired
|
118 |
@Autowired
|
| 102 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
119 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 103 |
|
120 |
|
| - |
|
121 |
@Autowired
|
| - |
|
122 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| - |
|
123 |
|
| - |
|
124 |
@Autowired
|
| - |
|
125 |
private InsuranceProviderRepository insuranceProviderRepository;
|
| - |
|
126 |
|
| 104 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
127 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 105 |
|
128 |
|
| 106 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
129 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 107 |
public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
130 |
public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 108 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
131 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| Line 128... |
Line 151... |
| 128 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|
151 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|
| 129 |
size = notificationPanelRepository.selectAllCount();
|
152 |
size = notificationPanelRepository.selectAllCount();
|
| 130 |
LOGGER.info("notification_data {}", notificationData);
|
153 |
LOGGER.info("notification_data {}", notificationData);
|
| 131 |
|
154 |
|
| 132 |
LOGGER.info("notification_data {}", size);
|
155 |
LOGGER.info("notification_data {}", size);
|
| 133 |
|
- |
|
| - |
|
156 |
// Map<String, Object> saleSummary=this.getAllSaleDetails(loginDetails);
|
| - |
|
157 |
// model.addAllAttributes(saleSummary);
|
| 134 |
if (!notificationData.isEmpty()) {
|
158 |
if (!notificationData.isEmpty()) {
|
| 135 |
|
159 |
|
| 136 |
model.addAttribute("notificationData", notificationData);
|
160 |
model.addAttribute("notificationData", notificationData);
|
| 137 |
LOGGER.info("notificationdata", notificationData);
|
161 |
LOGGER.info("notificationdata", notificationData);
|
| 138 |
model.addAttribute("start", offset + 1);
|
162 |
model.addAttribute("start", offset + 1);
|
| Line 168... |
Line 192... |
| 168 |
size = notificationPanelRepository.selectCountByActiveFlag(true);
|
192 |
size = notificationPanelRepository.selectCountByActiveFlag(true);
|
| 169 |
LOGGER.info("notification_data {}", notificationData);
|
193 |
LOGGER.info("notification_data {}", notificationData);
|
| 170 |
|
194 |
|
| 171 |
LOGGER.info("notification_data {}", size);
|
195 |
LOGGER.info("notification_data {}", size);
|
| 172 |
|
196 |
|
| - |
|
197 |
///// DashBoard ......................///////
|
| - |
|
198 |
model.addAllAttributes(this.getAllInsuranceDetails(loginDetails.getFofoId()));
|
| - |
|
199 |
model.addAllAttributes(this.getAllRechargeDetails(loginDetails.getFofoId()));
|
| - |
|
200 |
model.addAllAttributes(this.getAllSaleDetails(loginDetails.getFofoId()));
|
| - |
|
201 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
| - |
|
202 |
///////////////////////////////
|
| 173 |
if (!notificationData.isEmpty()) {
|
203 |
if (!notificationData.isEmpty()) {
|
| 174 |
|
204 |
|
| 175 |
model.addAttribute("notificationData", notificationData);
|
205 |
model.addAttribute("notificationData", notificationData);
|
| 176 |
LOGGER.info("notificationdata", notificationData);
|
206 |
LOGGER.info("notificationdata", notificationData);
|
| 177 |
model.addAttribute("start", offset + 1);
|
207 |
model.addAttribute("start", offset + 1);
|
| Line 197... |
Line 227... |
| 197 |
model.addAttribute("size", size);
|
227 |
model.addAttribute("size", size);
|
| 198 |
LOGGER.info("sizeOriginal {}", size);
|
228 |
LOGGER.info("sizeOriginal {}", size);
|
| 199 |
|
229 |
|
| 200 |
}
|
230 |
}
|
| 201 |
}
|
231 |
}
|
| 202 |
|
232 |
|
| 203 |
boolean isInvestmentOk = partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30);
|
233 |
boolean isInvestmentOk = partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30);
|
| 204 |
LocalDate endDate = LocalDate.now().minusDays(1);
|
234 |
LocalDate endDate = LocalDate.now().minusDays(1);
|
| 205 |
LocalDate weekStartDate = endDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
235 |
LocalDate weekStartDate = endDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
| 206 |
LocalDate startDate = weekStartDate.minusWeeks(2);
|
236 |
LocalDate startDate = weekStartDate.minusWeeks(2);
|
| 207 |
List<PartnerDailyInvestment> partnerInvestments = new ArrayList<>();
|
237 |
List<PartnerDailyInvestment> partnerInvestments = new ArrayList<>();
|
| 208 |
try
|
238 |
try {
|
| 209 |
{
|
- |
|
| 210 |
partnerInvestments.add(partnerInvestmentService.getInvestment(loginDetails.getFofoId(), 1));
|
239 |
partnerInvestments.add(partnerInvestmentService.getInvestment(loginDetails.getFofoId(), 1));
|
| - |
|
240 |
partnerInvestments
|
| 211 |
partnerInvestments.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
|
241 |
.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
|
| 212 |
|
242 |
|
| 213 |
}
|
- |
|
| 214 |
catch(Exception e)
|
243 |
} catch (Exception e) {
|
| 215 |
{
|
- |
|
| 216 |
LOGGER.error("partner Investment can't exists");
|
244 |
LOGGER.error("partner Investment can't exists");
|
| 217 |
}
|
245 |
}
|
| 218 |
model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
|
246 |
model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 219 |
model.addAttribute("partnerInvestment", partnerInvestments.get(0));
|
247 |
model.addAttribute("partnerInvestment", partnerInvestments.get(0));
|
| 220 |
model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
|
248 |
model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
|
| Line 234... |
Line 262... |
| 234 |
// inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
|
262 |
// inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
|
| 235 |
return "dashboard";
|
263 |
return "dashboard";
|
| 236 |
}
|
264 |
}
|
| 237 |
|
265 |
|
| 238 |
private String getInvestmentChartData(List<PartnerDailyInvestment> partnerInvestments) {
|
266 |
private String getInvestmentChartData(List<PartnerDailyInvestment> partnerInvestments) {
|
| 239 |
|
- |
|
| 240 |
|
267 |
|
| 241 |
JSONObject scale = new JSONObject().put("scaleLabel", new JSONObject().put("scaleLabel", "Amount in Rs"));
|
268 |
JSONObject scale = new JSONObject().put("scaleLabel", new JSONObject().put("scaleLabel", "Amount in Rs"));
|
| 242 |
JSONObject titleObject = new JSONObject()
|
269 |
JSONObject titleObject = new JSONObject().put("display", true).put("text", "Investment Overview").put("display",
|
| 243 |
.put("display", true)
|
270 |
true);
|
| 244 |
.put("text", "Investment Overview").put("display", true);
|
- |
|
| 245 |
|
271 |
|
| 246 |
JSONObject barData = new JSONObject();
|
272 |
JSONObject barData = new JSONObject();
|
| 247 |
|
273 |
|
| 248 |
JSONObject walletStack = new JSONObject().put("backgroundColor","rgba(255, 99, 132, 0.2)")
|
274 |
JSONObject walletStack = new JSONObject().put("backgroundColor", "rgba(255, 99, 132, 0.2)")
|
| 249 |
.put("label", "Wallet").put("stack", "Stack1").put("data", new JSONArray());
|
275 |
.put("label", "Wallet").put("stack", "Stack1").put("data", new JSONArray());
|
| 250 |
JSONObject inStockStack = new JSONObject().put("label", "In Stock").put("backgroundColor","rgba(54, 162, 235, 0.2)")
|
276 |
JSONObject inStockStack = new JSONObject().put("label", "In Stock")
|
| - |
|
277 |
.put("backgroundColor", "rgba(54, 162, 235, 0.2)").put("stack", "Stack1").put("data", new JSONArray());
|
| - |
|
278 |
JSONObject salesStack = new JSONObject().put("backgroundColor", "rgba(255, 206, 86, 0.2)").put("label", "Sales")
|
| 251 |
.put("stack", "Stack1").put("data", new JSONArray());
|
279 |
.put("stack", "Stack1").put("data", new JSONArray());
|
| 252 |
JSONObject salesStack = new JSONObject().put("backgroundColor","rgba(255, 206, 86, 0.2)")
|
- |
|
| 253 |
.put("label", "Sales").put("stack", "Stack1").put("data", new JSONArray());
|
- |
|
| 254 |
JSONObject grnPendingStack = new JSONObject().put("backgroundColor","rgba(75, 192, 192, 0.2)")
|
280 |
JSONObject grnPendingStack = new JSONObject().put("backgroundColor", "rgba(75, 192, 192, 0.2)")
|
| 255 |
.put("label", "Grn Pending").put("stack", "Stack1").put("data", new JSONArray());
|
281 |
.put("label", "Grn Pending").put("stack", "Stack1").put("data", new JSONArray());
|
| 256 |
JSONObject billingPendingStack = new JSONObject().put("backgroundColor","rgba(153, 102, 255, 0.2)")
|
282 |
JSONObject billingPendingStack = new JSONObject().put("backgroundColor", "rgba(153, 102, 255, 0.2)")
|
| 257 |
.put("label", "Billing Pending").put("stack", "Stack1").put("data", new JSONArray());
|
283 |
.put("label", "Billing Pending").put("stack", "Stack1").put("data", new JSONArray());
|
| 258 |
JSONObject inTransitStack = new JSONObject().put("backgroundColor","rgba(255, 159, 64, 0.2)")
|
284 |
JSONObject inTransitStack = new JSONObject().put("backgroundColor", "rgba(255, 159, 64, 0.2)")
|
| 259 |
.put("label", "Returned").put("stack", "Stack1").put("data", new JSONArray());
|
285 |
.put("label", "Returned").put("stack", "Stack1").put("data", new JSONArray());
|
| 260 |
|
286 |
|
| 261 |
JSONObject minInvestmentDataSet = new JSONObject().put("label", "Min. Ivestment").put("data", new JSONArray()).put("type", "line");
|
287 |
JSONObject minInvestmentDataSet = new JSONObject().put("label", "Min. Ivestment").put("data", new JSONArray())
|
| - |
|
288 |
.put("type", "line");
|
| 262 |
JSONArray dateLabels = new JSONArray();
|
289 |
JSONArray dateLabels = new JSONArray();
|
| 263 |
|
290 |
|
| 264 |
for (PartnerDailyInvestment pdi : partnerInvestments) {
|
291 |
for (PartnerDailyInvestment pdi : partnerInvestments) {
|
| 265 |
dateLabels = dateLabels.put(pdi.getDate().toString());
|
292 |
dateLabels = dateLabels.put(pdi.getDate().toString());
|
| 266 |
walletStack.getJSONArray("data").put((int)pdi.getWalletAmount());
|
293 |
walletStack.getJSONArray("data").put((int) pdi.getWalletAmount());
|
| 267 |
inStockStack.getJSONArray("data").put((int)pdi.getInStockAmount());
|
294 |
inStockStack.getJSONArray("data").put((int) pdi.getInStockAmount());
|
| 268 |
salesStack.getJSONArray("data").put((int)pdi.getSalesAmount());
|
295 |
salesStack.getJSONArray("data").put((int) pdi.getSalesAmount());
|
| 269 |
grnPendingStack.getJSONArray("data").put((int)pdi.getUnbilledAmount());
|
296 |
grnPendingStack.getJSONArray("data").put((int) pdi.getUnbilledAmount());
|
| 270 |
billingPendingStack.getJSONArray("data").put((int)pdi.getGrnPendingAmount());
|
297 |
billingPendingStack.getJSONArray("data").put((int) pdi.getGrnPendingAmount());
|
| 271 |
inTransitStack.getJSONArray("data").put((int)pdi.getReturnInTransitAmount());
|
298 |
inTransitStack.getJSONArray("data").put((int) pdi.getReturnInTransitAmount());
|
| 272 |
minInvestmentDataSet.getJSONArray("data").put((int)pdi.getMinInvestment());
|
299 |
minInvestmentDataSet.getJSONArray("data").put((int) pdi.getMinInvestment());
|
| 273 |
}
|
300 |
}
|
| 274 |
|
301 |
|
| 275 |
JSONArray barDataSetsArray = new JSONArray().put(walletStack).put(inStockStack)
|
302 |
JSONArray barDataSetsArray = new JSONArray().put(walletStack).put(inStockStack).put(salesStack)
|
| 276 |
.put(salesStack).put(grnPendingStack).put(billingPendingStack).put(inTransitStack);
|
303 |
.put(grnPendingStack).put(billingPendingStack).put(inTransitStack);
|
| 277 |
barData.put("labels", dateLabels).put("datasets", barDataSetsArray);
|
304 |
barData.put("labels", dateLabels).put("datasets", barDataSetsArray);
|
| 278 |
scale.put("yAxes", new JSONArray().put(new JSONObject().put("stacked", true)))
|
305 |
scale.put("yAxes", new JSONArray().put(new JSONObject().put("stacked", true))).put("xAxes",
|
| 279 |
.put("xAxes", new JSONArray().put(new JSONObject().put("stacked", true)));
|
306 |
new JSONArray().put(new JSONObject().put("stacked", true)));
|
| 280 |
|
307 |
|
| 281 |
JSONObject barOptions = new JSONObject()
|
- |
|
| 282 |
.put("title", titleObject).put("responsive", true).put("scales", scale)
|
308 |
JSONObject barOptions = new JSONObject().put("title", titleObject).put("responsive", true).put("scales", scale)
|
| 283 |
.put("tooltips", new JSONObject().put("mode", "index").put("intersect", false));
|
309 |
.put("tooltips", new JSONObject().put("mode", "index").put("intersect", false));
|
| 284 |
|
310 |
|
| 285 |
JSONObject chartJSOn = new JSONObject().put("type", "bar").put("data", barData).put("options", barOptions);
|
311 |
JSONObject chartJSOn = new JSONObject().put("type", "bar").put("data", barData).put("options", barOptions);
|
| 286 |
return chartJSOn.toString();
|
312 |
return chartJSOn.toString();
|
| 287 |
}
|
313 |
}
|
| 288 |
|
314 |
|
| 289 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
315 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
| Line 390... |
Line 416... |
| 390 |
|
416 |
|
| 391 |
}
|
417 |
}
|
| 392 |
return "response";
|
418 |
return "response";
|
| 393 |
}
|
419 |
}
|
| 394 |
|
420 |
|
| - |
|
421 |
private Map<String, Object> getAllInsuranceDetails(int fofoId) {
|
| - |
|
422 |
|
| - |
|
423 |
LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
|
| - |
|
424 |
LocalDateTime previousDayStart = currentDayStart.minusDays(1);
|
| - |
|
425 |
LocalDateTime currentDayEnd = LocalDateTime.now();
|
| - |
|
426 |
LocalDateTime currentMonthDayStart = LocalDateTime
|
| - |
|
427 |
.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
|
| - |
|
428 |
LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
|
| - |
|
429 |
LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
|
| - |
|
430 |
LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
|
| - |
|
431 |
|
| - |
|
432 |
List<String> insuranceProviders = insuranceProviderRepository.selectAll().stream().map(x -> x.getName())
|
| - |
|
433 |
.collect(Collectors.toList());
|
| - |
|
434 |
|
| - |
|
435 |
Map<String, Object> map = new HashMap<>();
|
| - |
|
436 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository
|
| - |
|
437 |
.selectByRetailerIdAndBetweenCreatedTimeStamp(fofoId, previousMonthFirstDay, LocalDateTime.now());
|
| - |
|
438 |
|
| - |
|
439 |
Map<Integer, Double> currentMonthTotalInsurance = insurancePolicies.stream()
|
| - |
|
440 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
441 |
&& x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
442 |
.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
|
| - |
|
443 |
Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
444 |
|
| - |
|
445 |
Map<Integer, Double> previousMonthTotalInsurance = insurancePolicies.stream()
|
| - |
|
446 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
447 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
|
| - |
|
448 |
.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
|
| - |
|
449 |
Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
450 |
|
| - |
|
451 |
Map<Integer, Double> currentDayTotalInsurance = insurancePolicies.stream().filter(
|
| - |
|
452 |
x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
453 |
.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
|
| - |
|
454 |
Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
455 |
|
| - |
|
456 |
Map<Integer, Double> previousDayTotalInsurance = insurancePolicies.stream()
|
| - |
|
457 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
458 |
&& x.getCreateTimestamp().isBefore(previousDayEnd))
|
| - |
|
459 |
.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
|
| - |
|
460 |
Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
461 |
|
| - |
|
462 |
IntFunction<String> intFunction = (providerId) -> {
|
| - |
|
463 |
try {
|
| - |
|
464 |
return insuranceProviderRepository.selectById(providerId).getName();
|
| - |
|
465 |
} catch (ProfitMandiBusinessException e1) {
|
| - |
|
466 |
// TODO Auto-generated catch block
|
| - |
|
467 |
return "";
|
| - |
|
468 |
}
|
| - |
|
469 |
};
|
| - |
|
470 |
Map<String, Double> currentMonthTotalInsuranceByPolicyName = insurancePolicies.stream()
|
| - |
|
471 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
472 |
&& x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
473 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
474 |
return intFunction.apply(x.getProviderId());
|
| - |
|
475 |
}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
476 |
|
| - |
|
477 |
Map<String, Double> previousMonthTotalInsuranceByPolicyName = insurancePolicies.stream()
|
| - |
|
478 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
479 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
|
| - |
|
480 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
481 |
return intFunction.apply(x.getProviderId());
|
| - |
|
482 |
}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
483 |
|
| - |
|
484 |
Map<String, Double> previousDayTotalInsuranceByPolicyName = insurancePolicies.stream()
|
| - |
|
485 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
486 |
&& x.getCreateTimestamp().isBefore(previousDayEnd))
|
| - |
|
487 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
488 |
return intFunction.apply(x.getProviderId());
|
| - |
|
489 |
}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
490 |
|
| - |
|
491 |
Map<String, Double> currentDayTotalInsuranceByPolicyName = insurancePolicies.stream().filter(
|
| - |
|
492 |
x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
493 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
494 |
return intFunction.apply(x.getProviderId());
|
| - |
|
495 |
}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
|
| - |
|
496 |
|
| - |
|
497 |
map.put("currentMonthTotalInsurance", currentMonthTotalInsurance);
|
| - |
|
498 |
map.put("previousMonthTotalInsurance", previousMonthTotalInsurance);
|
| - |
|
499 |
map.put("currentDayTotalInsurance", currentDayTotalInsurance);
|
| - |
|
500 |
map.put("previousDayTotalInsurance", previousDayTotalInsurance);
|
| - |
|
501 |
map.put("currentMonthTotalInsuranceByPolicyName", currentMonthTotalInsuranceByPolicyName);
|
| - |
|
502 |
map.put("previousMonthTotalInsuranceByPolicyName", previousMonthTotalInsuranceByPolicyName);
|
| - |
|
503 |
map.put("previousDayTotalInsuranceByPolicyName", previousDayTotalInsuranceByPolicyName);
|
| - |
|
504 |
map.put("currentDayTotalInsuranceByPolicyName", currentDayTotalInsuranceByPolicyName);
|
| - |
|
505 |
map.put("insuranceProviders", insuranceProviders);
|
| - |
|
506 |
return map;
|
| - |
|
507 |
}
|
| - |
|
508 |
|
| - |
|
509 |
private Map<String, Object> getAllRechargeDetails(int fofoId) {
|
| - |
|
510 |
|
| - |
|
511 |
LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
|
| - |
|
512 |
LocalDateTime previousDayStart = currentDayStart.minusDays(1);
|
| - |
|
513 |
LocalDateTime currentDayEnd = LocalDateTime.now();
|
| - |
|
514 |
LocalDateTime currentMonthDayStart = LocalDateTime
|
| - |
|
515 |
.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
|
| - |
|
516 |
LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
|
| - |
|
517 |
LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
|
| - |
|
518 |
LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
|
| - |
|
519 |
|
| - |
|
520 |
List<RechargeTransaction> rechargeTransactions = rechargeTransactionRepository
|
| - |
|
521 |
.getAllRechargeTransactionByCreatedTimeStamp(fofoId, previousMonthFirstDay, currentDayEnd).stream()
|
| - |
|
522 |
.filter(x -> x.getStatus().equals(RechargeStatus.SUCCESS)).collect(Collectors.toList());
|
| - |
|
523 |
|
| - |
|
524 |
LOGGER.info(rechargeTransactions);
|
| - |
|
525 |
Map<Integer, Double> currentMonthTotalRecharge = rechargeTransactions.stream()
|
| - |
|
526 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
527 |
&& x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
528 |
.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
|
| - |
|
529 |
Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
530 |
LOGGER.info(currentMonthTotalRecharge);
|
| - |
|
531 |
Map<Integer, Double> previousMonthTotalRecharge = rechargeTransactions.stream()
|
| - |
|
532 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
533 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
|
| - |
|
534 |
.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
|
| - |
|
535 |
Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
536 |
|
| - |
|
537 |
LOGGER.info(previousMonthTotalRecharge);
|
| - |
|
538 |
Map<Integer, Double> currentDayTotalRecharge = rechargeTransactions.stream().filter(
|
| - |
|
539 |
x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
540 |
.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
|
| - |
|
541 |
Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
542 |
|
| - |
|
543 |
Map<Integer, Double> previousDayTotalRecharge = rechargeTransactions.stream()
|
| - |
|
544 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
545 |
&& x.getCreateTimestamp().isBefore(previousDayEnd))
|
| - |
|
546 |
.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
|
| - |
|
547 |
Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
548 |
|
| - |
|
549 |
Map<Object, Double> currentMonthTotalRechargeByRechargeType = rechargeTransactions.stream()
|
| - |
|
550 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
551 |
&& x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
552 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
553 |
return x.getType();
|
| - |
|
554 |
}, Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
555 |
|
| - |
|
556 |
Map<Object, Double> previosMonthTotalRechargeByRechargeType = rechargeTransactions.stream()
|
| - |
|
557 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
558 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
|
| - |
|
559 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
560 |
return x.getType();
|
| - |
|
561 |
}, Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
562 |
|
| - |
|
563 |
Map<Object, Double> currentDayTotalRechargeByRechargeType = rechargeTransactions.stream().filter(
|
| - |
|
564 |
x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
565 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
566 |
return x.getType();
|
| - |
|
567 |
}, Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
568 |
|
| - |
|
569 |
Map<Object, Double> previousDayTotalRechargeByRechargeType = rechargeTransactions.stream()
|
| - |
|
570 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
571 |
&& x.getCreateTimestamp().isBefore(previousDayEnd))
|
| - |
|
572 |
.collect(Collectors.groupingBy(x -> {
|
| - |
|
573 |
return x.getType();
|
| - |
|
574 |
}, Collectors.summingDouble(RechargeTransaction::getAmount)));
|
| - |
|
575 |
|
| - |
|
576 |
LOGGER.info("previosMonthTotalRechargeByRechargeType" + previosMonthTotalRechargeByRechargeType);
|
| - |
|
577 |
Map<String, Object> map = new HashMap<>();
|
| - |
|
578 |
map.put("currentMonthTotalRecharge", currentMonthTotalRecharge);
|
| - |
|
579 |
map.put("previousMonthTotalRecharge", previousMonthTotalRecharge);
|
| - |
|
580 |
map.put("currentDayTotalRecharge", currentDayTotalRecharge);
|
| - |
|
581 |
map.put("previousDayTotalRecharge", previousDayTotalRecharge);
|
| - |
|
582 |
map.put("currentMonthTotalRechargeByRechargeType", currentMonthTotalRechargeByRechargeType);
|
| - |
|
583 |
map.put("previosMonthTotalRechargeByRechargeType", previosMonthTotalRechargeByRechargeType);
|
| - |
|
584 |
map.put("currentDayTotalRechargeByRechargeType", currentDayTotalRechargeByRechargeType);
|
| - |
|
585 |
map.put("previousDayTotalRechargeByRechargeType", previousDayTotalRechargeByRechargeType);
|
| - |
|
586 |
map.put("rechargeTypes", RechargeType.values());
|
| - |
|
587 |
|
| - |
|
588 |
return map;
|
| - |
|
589 |
|
| - |
|
590 |
}
|
| - |
|
591 |
|
| - |
|
592 |
private Map<String, Object> getAllSaleDetails(int fofoId) {
|
| - |
|
593 |
|
| - |
|
594 |
LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
|
| - |
|
595 |
LocalDateTime previousDayStart = currentDayStart.minusDays(1);
|
| - |
|
596 |
LocalDateTime currentDayEnd = LocalDateTime.now();
|
| - |
|
597 |
LocalDateTime currentMonthDayStart = LocalDateTime
|
| - |
|
598 |
.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
|
| - |
|
599 |
LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
|
| - |
|
600 |
LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
|
| - |
|
601 |
LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
|
| - |
|
602 |
|
| - |
|
603 |
Map<String, Object> map = new HashMap<>();
|
| - |
|
604 |
|
| - |
|
605 |
List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectBetweenCreatedTime(fofoId,
|
| - |
|
606 |
previousMonthFirstDay, currentDayEnd);
|
| - |
|
607 |
|
| - |
|
608 |
Double currentMonthTotalSale = fofoOrderItems.stream()
|
| - |
|
609 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
610 |
&& x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
611 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
612 |
|
| - |
|
613 |
LOGGER.info("currentMonthTotalSale" + currentMonthTotalSale);
|
| - |
|
614 |
Double previousMonthTotalSale = fofoOrderItems.stream()
|
| - |
|
615 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
616 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
|
| - |
|
617 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
618 |
|
| - |
|
619 |
Double currentDayTotalSale = fofoOrderItems.stream().filter(
|
| - |
|
620 |
x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
|
| - |
|
621 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
622 |
|
| - |
|
623 |
LOGGER.info(currentDayTotalSale);
|
| - |
|
624 |
|
| - |
|
625 |
Double previousDayTotalSale = fofoOrderItems.stream()
|
| - |
|
626 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
627 |
&& x.getCreateTimestamp().isBefore(previousDayEnd))
|
| - |
|
628 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
629 |
LOGGER.info(previousDayTotalSale);
|
| - |
|
630 |
IntPredicate checkHandset = (itemId) -> {
|
| - |
|
631 |
try {
|
| - |
|
632 |
Item item = itemRepository.selectById(itemId);
|
| - |
|
633 |
return item.getCategoryId() == 10006;
|
| - |
|
634 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
635 |
// TODO Auto-generated catch block
|
| - |
|
636 |
e.printStackTrace();
|
| - |
|
637 |
return false;
|
| - |
|
638 |
}
|
| - |
|
639 |
};
|
| - |
|
640 |
|
| - |
|
641 |
Set<String> brands = fofoOrderItemRepository
|
| - |
|
642 |
.selectBetweenDates(previousMonthFirstDay.minusMonths(1), currentDayEnd).stream()
|
| - |
|
643 |
.filter(x -> checkHandset.test(x.getItemId())).map(x -> x.getBrand()).collect(Collectors.toSet());
|
| - |
|
644 |
Set<String> accessories = fofoOrderItemRepository
|
| - |
|
645 |
.selectBetweenDates(previousMonthFirstDay.minusMonths(1), currentDayEnd).stream()
|
| - |
|
646 |
.filter(x -> !checkHandset.test(x.getItemId())).map(x -> x.getBrand()).collect(Collectors.toSet());
|
| - |
|
647 |
|
| - |
|
648 |
Double currentMonthTotalMobileSale = fofoOrderItems.stream()
|
| - |
|
649 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
650 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
651 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
652 |
|
| - |
|
653 |
Double previousMonthTotalMobileSale = fofoOrderItems.stream()
|
| - |
|
654 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
655 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && checkHandset.test(x.getItemId()))
|
| - |
|
656 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
657 |
|
| - |
|
658 |
Double previousDayTotalMobileSale = fofoOrderItems.stream()
|
| - |
|
659 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
660 |
&& x.getCreateTimestamp().isBefore(previousDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
661 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
662 |
|
| - |
|
663 |
Double currentDayTotalMobileSale = fofoOrderItems.stream()
|
| - |
|
664 |
.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
|
| - |
|
665 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
666 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
667 |
|
| - |
|
668 |
Double currentMonthTotalAccessoriesSale = fofoOrderItems.stream()
|
| - |
|
669 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
670 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
671 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
672 |
|
| - |
|
673 |
Double previousMonthTotalAccessoriesSale = fofoOrderItems.stream()
|
| - |
|
674 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
675 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && !checkHandset.test(x.getItemId()))
|
| - |
|
676 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
677 |
|
| - |
|
678 |
Double previousDayTotalAccessoriesSale = fofoOrderItems.stream()
|
| - |
|
679 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
680 |
&& x.getCreateTimestamp().isBefore(previousDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
681 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
682 |
|
| - |
|
683 |
Double currentDayTotalAccessoriesSale = fofoOrderItems.stream()
|
| - |
|
684 |
.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
|
| - |
|
685 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
686 |
.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
|
| - |
|
687 |
|
| - |
|
688 |
Map<String, Double> currentMonthMobileSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
689 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
690 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
691 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
692 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
693 |
|
| - |
|
694 |
Map<String, Double> currentMonthAccesoriesSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
695 |
.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
|
| - |
|
696 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
697 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
698 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
699 |
|
| - |
|
700 |
Map<String, Double> previousMonthAccesoriesSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
701 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
702 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && !checkHandset.test(x.getItemId()))
|
| - |
|
703 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
704 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
705 |
|
| - |
|
706 |
Map<String, Double> currentDayAccesoriesSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
707 |
.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
|
| - |
|
708 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
709 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
710 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
711 |
|
| - |
|
712 |
Map<String, Double> previousDayAccesoriesSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
713 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
714 |
&& x.getCreateTimestamp().isBefore(previousDayEnd) && !checkHandset.test(x.getItemId()))
|
| - |
|
715 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
716 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
717 |
|
| - |
|
718 |
Map<String, Double> currentDayMobileSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
719 |
.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
|
| - |
|
720 |
&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
721 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
722 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
723 |
|
| - |
|
724 |
Map<String, Double> previousDayMobileSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
725 |
.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
|
| - |
|
726 |
&& x.getCreateTimestamp().isBefore(previousDayEnd) && checkHandset.test(x.getItemId()))
|
| - |
|
727 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
728 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
729 |
Map<String, Double> previousMonthMobileSalegroupByBrand = fofoOrderItems.stream()
|
| - |
|
730 |
.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
|
| - |
|
731 |
&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && checkHandset.test(x.getItemId()))
|
| - |
|
732 |
.collect(Collectors.groupingBy(x -> x.getBrand(),
|
| - |
|
733 |
Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
|
| - |
|
734 |
|
| - |
|
735 |
map.put("brands", brands);
|
| - |
|
736 |
map.put("accessories", accessories);
|
| - |
|
737 |
map.put("currentMonthTotalSale", currentMonthTotalSale);
|
| - |
|
738 |
map.put("previousMonthTotalSale", previousMonthTotalSale);
|
| - |
|
739 |
map.put("currentDayTotalSale", currentDayTotalSale);
|
| - |
|
740 |
map.put("previousDayTotalSale", previousDayTotalSale);
|
| - |
|
741 |
map.put("currentMonthMobileSalegroupByBrand", currentMonthMobileSalegroupByBrand);
|
| - |
|
742 |
map.put("currentMonthAccesoriesSalegroupByBrand", currentMonthAccesoriesSalegroupByBrand);
|
| - |
|
743 |
map.put("previousMonthAccesoriesSalegroupByBrand", previousMonthAccesoriesSalegroupByBrand);
|
| - |
|
744 |
map.put("previousDayAccesoriesSalegroupByBrand", previousDayAccesoriesSalegroupByBrand);
|
| - |
|
745 |
map.put("currentDayMobileSalegroupByBrand", currentDayMobileSalegroupByBrand);
|
| - |
|
746 |
map.put("previousDayMobileSalegroupByBrand", previousDayMobileSalegroupByBrand);
|
| - |
|
747 |
map.put("currentDayAccesoriesSalegroupByBrand", currentDayAccesoriesSalegroupByBrand);
|
| - |
|
748 |
map.put("previousMonthMobileSalegroupByBrand", previousMonthMobileSalegroupByBrand);
|
| - |
|
749 |
|
| - |
|
750 |
map.put("currentMonthTotalMobileSale", currentMonthTotalMobileSale);
|
| - |
|
751 |
map.put("previousMonthTotalMobileSale", previousMonthTotalMobileSale);
|
| - |
|
752 |
map.put("previousDayTotalMobileSale", previousDayTotalMobileSale);
|
| - |
|
753 |
map.put("currentDayTotalMobileSale", currentDayTotalMobileSale);
|
| - |
|
754 |
map.put("currentMonthTotalAccessoriesSale", currentMonthTotalAccessoriesSale);
|
| - |
|
755 |
map.put("previousMonthTotalAccessoriesSale", previousMonthTotalAccessoriesSale);
|
| - |
|
756 |
map.put("previousDayTotalAccessoriesSale", previousDayTotalAccessoriesSale);
|
| - |
|
757 |
map.put("currentDayTotalAccessoriesSale", currentDayTotalAccessoriesSale);
|
| - |
|
758 |
|
| - |
|
759 |
return map;
|
| - |
|
760 |
}
|
| 395 |
}
|
761 |
}
|