Subversion Repositories SmartDukaan

Rev

Rev 25003 | Rev 25136 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21615 kshitij.so 1
package com.spice.profitmandi.web.controller;
2
 
23568 govind 3
import java.io.IOException;
4
import java.net.URISyntaxException;
24288 amit.gupta 5
import java.time.DayOfWeek;
6
import java.time.LocalDate;
24276 amit.gupta 7
import java.time.LocalDateTime;
24880 govind 8
import java.time.LocalTime;
24288 amit.gupta 9
import java.time.temporal.TemporalAdjusters;
24339 amit.gupta 10
import java.util.ArrayList;
24880 govind 11
import java.util.HashMap;
23884 amit.gupta 12
import java.util.List;
24880 govind 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;
23568 govind 18
 
22086 amit.gupta 19
import javax.servlet.http.HttpServletRequest;
20
 
23786 amit.gupta 21
import org.apache.logging.log4j.LogManager;
23568 govind 22
import org.apache.logging.log4j.Logger;
24321 amit.gupta 23
import org.json.JSONArray;
24
import org.json.JSONObject;
22481 ashik.ali 25
import org.springframework.beans.factory.annotation.Autowired;
23379 ashik.ali 26
import org.springframework.beans.factory.annotation.Value;
21615 kshitij.so 27
import org.springframework.stereotype.Controller;
22481 ashik.ali 28
import org.springframework.transaction.annotation.Transactional;
22073 ashik.ali 29
import org.springframework.ui.Model;
21615 kshitij.so 30
import org.springframework.web.bind.annotation.RequestMapping;
31
import org.springframework.web.bind.annotation.RequestMethod;
24098 tejbeer 32
import org.springframework.web.bind.annotation.RequestParam;
21615 kshitij.so 33
 
24996 amit.gupta 34
import com.mongodb.DBObject;
24880 govind 35
import com.spice.profitmandi.common.enumuration.RechargeStatus;
22481 ashik.ali 36
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
24996 amit.gupta 37
import com.spice.profitmandi.common.model.BrandStockPrice;
24203 amit.gupta 38
import com.spice.profitmandi.common.model.ProfitMandiConstants;
24880 govind 39
import com.spice.profitmandi.dao.entity.catalog.Item;
40
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
24098 tejbeer 41
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
24880 govind 42
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
43
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
22654 ashik.ali 44
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
24288 amit.gupta 45
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
24880 govind 46
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
47
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
22481 ashik.ali 48
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
24880 govind 49
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
50
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
24996 amit.gupta 51
import com.spice.profitmandi.dao.repository.dtr.Mongo;
24098 tejbeer 52
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
24880 govind 53
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
24203 amit.gupta 54
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
24880 govind 55
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
24288 amit.gupta 56
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
24336 amit.gupta 57
import com.spice.profitmandi.service.PartnerInvestmentService;
23844 amit.gupta 58
import com.spice.profitmandi.service.authentication.RoleManager;
23884 amit.gupta 59
import com.spice.profitmandi.service.inventory.InventoryService;
60
import com.spice.profitmandi.service.transaction.TransactionService;
22481 ashik.ali 61
import com.spice.profitmandi.web.model.LoginDetails;
62
import com.spice.profitmandi.web.util.CookiesProcessor;
24263 tejbeer 63
import com.spice.profitmandi.web.util.MVCResponseSender;
22481 ashik.ali 64
 
21615 kshitij.so 65
@Controller
22481 ashik.ali 66
@Transactional(rollbackFor = Throwable.class)
21615 kshitij.so 67
public class DashboardController {
23923 amit.gupta 68
 
23379 ashik.ali 69
	@Value("${web.api.host}")
70
	private String webApiHost;
23923 amit.gupta 71
 
24072 amit.gupta 72
	@Value("${web.api.scheme}")
73
	private String webApiScheme;
24288 amit.gupta 74
 
24078 amit.gupta 75
	@Value("${web.api.root}")
76
	private String webApiRoot;
77
 
23379 ashik.ali 78
	@Value("${web.api.port}")
79
	private int webApiPort;
21615 kshitij.so 80
 
22481 ashik.ali 81
	@Autowired
22927 ashik.ali 82
	private CookiesProcessor cookiesProcessor;
23923 amit.gupta 83
 
23568 govind 84
	@Autowired
24880 govind 85
	private ItemRepository itemRepository;
86
 
87
	@Autowired
23786 amit.gupta 88
	private RoleManager roleManager;
23923 amit.gupta 89
 
23838 ashik.ali 90
	@Autowired
91
	private FofoStoreRepository fofoStoreRepository;
23884 amit.gupta 92
 
93
	@Autowired
24880 govind 94
	private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
23923 amit.gupta 95
 
23884 amit.gupta 96
	@Autowired
24880 govind 97
	private PartnerInvestmentService partnerInvestmentService;
24288 amit.gupta 98
 
23884 amit.gupta 99
	@Autowired
24880 govind 100
	private InsurancePolicyRepository insurancePolicyRepository;
23923 amit.gupta 101
	/*
102
	 * @Autowired private ScanRepository scanRepository;
103
	 */
24880 govind 104
	@Autowired
105
	private RechargeTransactionRepository rechargeTransactionRepository;
23923 amit.gupta 106
 
23884 amit.gupta 107
	@Autowired
108
	private TransactionService transactionService;
24996 amit.gupta 109
 
110
	@Autowired
111
	private InventoryService inventoryService;
24263 tejbeer 112
 
24098 tejbeer 113
	@Autowired
24263 tejbeer 114
	private MVCResponseSender mvcResponseSender;
115
 
116
	@Autowired
24098 tejbeer 117
	private NotificationPanelRepository notificationPanelRepository;
23923 amit.gupta 118
 
24203 amit.gupta 119
	@Autowired
120
	private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
121
 
24880 govind 122
	@Autowired
123
	private FofoOrderItemRepository fofoOrderItemRepository;
124
 
125
	@Autowired
126
	private InsuranceProviderRepository insuranceProviderRepository;
24996 amit.gupta 127
 
128
	@Autowired
129
	private Mongo mongoClient;
24880 govind 130
 
23568 govind 131
	private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
23923 amit.gupta 132
 
21615 kshitij.so 133
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
24312 amit.gupta 134
	public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
24098 tejbeer 135
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
23923 amit.gupta 136
			throws ProfitMandiBusinessException, URISyntaxException, IOException {
137
		// LOGGER.info("scanRepository.selectScansByInventoryItemId(1)",
138
		// scanRepository.selectScansByInventoryItemId(1));
23884 amit.gupta 139
		LOGGER.info("In Dashboard");
22927 ashik.ali 140
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
23923 amit.gupta 141
 
22481 ashik.ali 142
		FofoStore fofoStore = null;
143
		try {
22927 ashik.ali 144
			fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
22481 ashik.ali 145
		} catch (ProfitMandiBusinessException e) {
22927 ashik.ali 146
			LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
22481 ashik.ali 147
		}
23884 amit.gupta 148
 
24312 amit.gupta 149
		float sale = 0;
23923 amit.gupta 150
		if (roleManager.isAdmin(loginDetails.getRoleIds())) {
24263 tejbeer 151
			model.addAttribute("sale", sale);
152
			List<NotificationData> notificationData = null;
153
			long size = 0;
154
 
155
			notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
156
			size = notificationPanelRepository.selectAllCount();
157
			LOGGER.info("notification_data {}", notificationData);
158
 
159
			LOGGER.info("notification_data {}", size);
24880 govind 160
			// Map<String, Object> saleSummary=this.getAllSaleDetails(loginDetails);
161
			// model.addAllAttributes(saleSummary);
24263 tejbeer 162
			if (!notificationData.isEmpty()) {
163
 
164
				model.addAttribute("notificationData", notificationData);
165
				LOGGER.info("notificationdata", notificationData);
166
				model.addAttribute("start", offset + 1);
167
				model.addAttribute("size", size);
168
				model.addAttribute("url", "/getPaginatedNotificationData");
169
 
170
				LOGGER.info("start {}", offset + 1);
171
				LOGGER.info("SIZE {}", size);
172
 
173
				if (notificationData.size() < limit) {
174
					model.addAttribute("end", offset + notificationData.size());
175
					LOGGER.info("SIZE2 {}", offset + notificationData.size());
176
				} else {
177
					model.addAttribute("end", offset + limit);
178
 
179
					LOGGER.info("end {}", size);
180
 
181
				}
182
 
183
			} else {
184
 
185
				model.addAttribute("notificationData", notificationData);
186
				model.addAttribute("size", size);
187
				LOGGER.info("sizeOriginal {}", size);
188
 
189
			}
23923 amit.gupta 190
		} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
24312 amit.gupta 191
 
24263 tejbeer 192
			List<NotificationData> notificationData = null;
193
			long size = 0;
194
 
195
			notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
196
			size = notificationPanelRepository.selectCountByActiveFlag(true);
197
			LOGGER.info("notification_data {}", notificationData);
198
 
199
			LOGGER.info("notification_data {}", size);
200
 
24880 govind 201
			///// DashBoard ......................///////
202
			model.addAllAttributes(this.getAllInsuranceDetails(loginDetails.getFofoId()));
203
			model.addAllAttributes(this.getAllRechargeDetails(loginDetails.getFofoId()));
204
			model.addAllAttributes(this.getAllSaleDetails(loginDetails.getFofoId()));
205
			model.addAttribute("fofoId", loginDetails.getFofoId());
206
			///////////////////////////////
24263 tejbeer 207
			if (!notificationData.isEmpty()) {
208
 
209
				model.addAttribute("notificationData", notificationData);
210
				LOGGER.info("notificationdata", notificationData);
211
				model.addAttribute("start", offset + 1);
212
				model.addAttribute("size", size);
213
				model.addAttribute("url", "/getPaginatedNotificationData");
214
 
215
				LOGGER.info("start {}", offset + 1);
216
				LOGGER.info("SIZE {}", size);
217
 
218
				if (notificationData.size() < limit) {
219
					model.addAttribute("end", offset + notificationData.size());
220
					LOGGER.info("SIZE2 {}", offset + notificationData.size());
221
				} else {
222
					model.addAttribute("end", offset + limit);
223
 
224
					LOGGER.info("end {}", size);
225
 
226
				}
227
 
228
			} else {
229
 
230
				model.addAttribute("notificationData", notificationData);
231
				model.addAttribute("size", size);
232
				LOGGER.info("sizeOriginal {}", size);
233
 
234
			}
23884 amit.gupta 235
		}
24880 govind 236
 
24366 amit.gupta 237
		boolean isInvestmentOk = partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30);
24288 amit.gupta 238
		LocalDate endDate = LocalDate.now().minusDays(1);
239
		LocalDate weekStartDate = endDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
24336 amit.gupta 240
		LocalDate startDate = weekStartDate.minusWeeks(2);
24339 amit.gupta 241
		List<PartnerDailyInvestment> partnerInvestments = new ArrayList<>();
24880 govind 242
		try {
243
			partnerInvestments.add(partnerInvestmentService.getInvestment(loginDetails.getFofoId(), 1));
244
			partnerInvestments
245
					.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
246
 
247
		} catch (Exception e) {
24383 amit.gupta 248
			LOGGER.error("partner Investment can't exists");
249
		}
24996 amit.gupta 250
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(loginDetails.getFofoId());
251
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(loginDetails.getFofoId(), loginDetails.getEmailId(), 3);
252
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
253
		mobileBrands.stream().forEach(x->{
24999 amit.gupta 254
			String brand = (String)x.get("name");
24996 amit.gupta 255
			if(brandStockPricesMap.containsKey(brand)) {
256
				BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
257
				brandStockPrice.setBrandUrl((String)x.get("url"));
25003 amit.gupta 258
				brandStockPrice.setRank(((Double)x.get("rank")).intValue());
24996 amit.gupta 259
				brandStockPrices.add(brandStockPrice);
260
			} else {
261
			}
262
		});
263
		model.addAttribute("brandStockPrices", brandStockPrices.stream().sorted((x,y)-> y.getRank() - x.getRank()).collect(Collectors.toList()));
24366 amit.gupta 264
		model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
24387 amit.gupta 265
		model.addAttribute("partnerInvestment", partnerInvestments.get(0));
24996 amit.gupta 266
		//model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
23848 ashik.ali 267
		model.addAttribute("fofoStore", fofoStore);
23918 amit.gupta 268
		model.addAttribute("walletAmount");
22086 amit.gupta 269
		model.addAttribute("appContextPath", request.getContextPath());
25135 amit.gupta 270
		//model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
271
		model.addAttribute("isAdmin", false);
23379 ashik.ali 272
		model.addAttribute("webApiHost", webApiHost);
273
		model.addAttribute("webApiPort", webApiPort);
24072 amit.gupta 274
		model.addAttribute("webApiScheme", webApiScheme);
24077 amit.gupta 275
		model.addAttribute("webApiRoot", webApiRoot);
24203 amit.gupta 276
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
277
		model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
24248 govind 278
		model.addAttribute("sale", sale);
24098 tejbeer 279
 
23923 amit.gupta 280
		// LOGGER.info("loginDetails.getFofoId()"+loginDetails.getFofoId());
281
		// inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
21615 kshitij.so 282
		return "dashboard";
283
	}
23923 amit.gupta 284
 
24312 amit.gupta 285
	private String getInvestmentChartData(List<PartnerDailyInvestment> partnerInvestments) {
24880 govind 286
 
24321 amit.gupta 287
		JSONObject scale = new JSONObject().put("scaleLabel", new JSONObject().put("scaleLabel", "Amount in Rs"));
24880 govind 288
		JSONObject titleObject = new JSONObject().put("display", true).put("text", "Investment Overview").put("display",
289
				true);
290
 
24321 amit.gupta 291
		JSONObject barData = new JSONObject();
24880 govind 292
 
293
		JSONObject walletStack = new JSONObject().put("backgroundColor", "rgba(255, 99, 132, 0.2)")
24323 amit.gupta 294
				.put("label", "Wallet").put("stack", "Stack1").put("data", new JSONArray());
24880 govind 295
		JSONObject inStockStack = new JSONObject().put("label", "In Stock")
296
				.put("backgroundColor", "rgba(54, 162, 235, 0.2)").put("stack", "Stack1").put("data", new JSONArray());
297
		JSONObject salesStack = new JSONObject().put("backgroundColor", "rgba(255, 206, 86, 0.2)").put("label", "Sales")
24325 amit.gupta 298
				.put("stack", "Stack1").put("data", new JSONArray());
24880 govind 299
		JSONObject grnPendingStack = new JSONObject().put("backgroundColor", "rgba(75, 192, 192, 0.2)")
24323 amit.gupta 300
				.put("label", "Grn Pending").put("stack", "Stack1").put("data", new JSONArray());
24880 govind 301
		JSONObject billingPendingStack = new JSONObject().put("backgroundColor", "rgba(153, 102, 255, 0.2)")
24323 amit.gupta 302
				.put("label", "Billing Pending").put("stack", "Stack1").put("data", new JSONArray());
24880 govind 303
		JSONObject inTransitStack = new JSONObject().put("backgroundColor", "rgba(255, 159, 64, 0.2)")
24324 amit.gupta 304
				.put("label", "Returned").put("stack", "Stack1").put("data", new JSONArray());
24880 govind 305
 
306
		JSONObject minInvestmentDataSet = new JSONObject().put("label", "Min. Ivestment").put("data", new JSONArray())
307
				.put("type", "line");
24321 amit.gupta 308
		JSONArray dateLabels = new JSONArray();
24880 govind 309
 
24312 amit.gupta 310
		for (PartnerDailyInvestment pdi : partnerInvestments) {
24321 amit.gupta 311
			dateLabels = dateLabels.put(pdi.getDate().toString());
24880 govind 312
			walletStack.getJSONArray("data").put((int) pdi.getWalletAmount());
313
			inStockStack.getJSONArray("data").put((int) pdi.getInStockAmount());
314
			salesStack.getJSONArray("data").put((int) pdi.getSalesAmount());
315
			grnPendingStack.getJSONArray("data").put((int) pdi.getUnbilledAmount());
316
			billingPendingStack.getJSONArray("data").put((int) pdi.getGrnPendingAmount());
317
			inTransitStack.getJSONArray("data").put((int) pdi.getReturnInTransitAmount());
318
			minInvestmentDataSet.getJSONArray("data").put((int) pdi.getMinInvestment());
24312 amit.gupta 319
		}
24880 govind 320
 
321
		JSONArray barDataSetsArray = new JSONArray().put(walletStack).put(inStockStack).put(salesStack)
322
				.put(grnPendingStack).put(billingPendingStack).put(inTransitStack);
24321 amit.gupta 323
		barData.put("labels", dateLabels).put("datasets", barDataSetsArray);
24880 govind 324
		scale.put("yAxes", new JSONArray().put(new JSONObject().put("stacked", true))).put("xAxes",
325
				new JSONArray().put(new JSONObject().put("stacked", true)));
24321 amit.gupta 326
 
24880 govind 327
		JSONObject barOptions = new JSONObject().put("title", titleObject).put("responsive", true).put("scales", scale)
24321 amit.gupta 328
				.put("tooltips", new JSONObject().put("mode", "index").put("intersect", false));
24880 govind 329
 
24321 amit.gupta 330
		JSONObject chartJSOn = new JSONObject().put("type", "bar").put("data", barData).put("options", barOptions);
331
		return chartJSOn.toString();
24312 amit.gupta 332
	}
333
 
24288 amit.gupta 334
	// This method is currently hardcoded to faciliate watches sold as gift.
24203 amit.gupta 335
	private boolean hasGift(int fofoId) {
336
		try {
24288 amit.gupta 337
			return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
338
					.getAvailability() > 0;
24203 amit.gupta 339
		} catch (ProfitMandiBusinessException e) {
340
			return false;
341
		}
342
	}
24288 amit.gupta 343
 
24098 tejbeer 344
	@RequestMapping(value = "/getPaginatedNotificationData", method = RequestMethod.GET)
345
	public String getPaginatedNotificationData(HttpServletRequest request,
346
			@RequestParam(name = "offset", defaultValue = "0") int offset,
347
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
24263 tejbeer 348
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
24098 tejbeer 349
 
24263 tejbeer 350
		if (roleManager.isAdmin(loginDetails.getRoleIds())) {
351
			List<NotificationData> notificationData = null;
24098 tejbeer 352
 
24263 tejbeer 353
			notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
24098 tejbeer 354
 
24263 tejbeer 355
			LOGGER.info("notification_data {}", notificationData);
24098 tejbeer 356
 
24263 tejbeer 357
			if (!notificationData.isEmpty()) {
24098 tejbeer 358
 
24263 tejbeer 359
				model.addAttribute("notificationData", notificationData);
360
				model.addAttribute("url", "/getPaginatedNotificationData");
361
 
362
			} else {
363
				model.addAttribute("notificationData", notificationData);
364
 
365
			}
366
		} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
367
 
368
			List<NotificationData> notificationData = null;
369
 
370
			notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
371
			LOGGER.info("notification_data {}", notificationData);
372
 
373
			if (!notificationData.isEmpty()) {
374
 
375
				model.addAttribute("notificationData", notificationData);
376
				model.addAttribute("url", "/getPaginatedNotificationData");
377
 
378
			} else {
379
				model.addAttribute("notificationData", notificationData);
380
 
381
			}
24098 tejbeer 382
		}
383
 
384
		return "dashboard-paginated";
385
	}
24288 amit.gupta 386
 
22354 ashik.ali 387
	@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
23923 amit.gupta 388
	public String contactUs(HttpServletRequest request, Model model) throws Throwable {
22354 ashik.ali 389
		model.addAttribute("appContextPath", request.getContextPath());
390
		return "contact-us";
391
	}
23923 amit.gupta 392
 
393
	/*
394
	 * private List<PaymentOption> getPaymentOptions(int fofoId){ List<Integer>
395
	 * paymentOptionIds =
24288 amit.gupta 396
	 * fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(fofoId) ;
397
	 * if(paymentOptionIds.isEmpty()){ return new ArrayList<>(); } return
23923 amit.gupta 398
	 * paymentOptionRepository.selectByIds(new HashSet<>(paymentOptionIds)); }
399
	 */
400
 
24263 tejbeer 401
	@RequestMapping(value = "/inactiveNotificationData", method = RequestMethod.POST)
402
	public String inactiveNotificationData(HttpServletRequest request,
403
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
404
 
405
		NotificationData notificationData = notificationPanelRepository.selectById(id);
406
		if (notificationData != null) {
407
 
408
			notificationData.setActive(false);
409
			LOGGER.info("notification" + notificationData);
410
			notificationPanelRepository.persist(notificationData);
411
 
412
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
413
		} else {
414
			model.addAttribute("response", mvcResponseSender.createResponseString(false));
415
 
416
		}
417
		return "response";
418
	}
419
 
420
	@RequestMapping(value = "/activeNotificationData", method = RequestMethod.POST)
421
	public String activeNotificationData(HttpServletRequest request,
422
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
423
 
424
		NotificationData notificationData = notificationPanelRepository.selectById(id);
425
		if (notificationData != null) {
426
 
427
			notificationData.setActive(true);
428
			notificationData.setCreated_timestamp(LocalDateTime.now());
429
			LOGGER.info("notification" + notificationData);
430
			notificationPanelRepository.persist(notificationData);
431
 
432
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
433
		} else {
434
			model.addAttribute("response", mvcResponseSender.createResponseString(false));
435
 
436
		}
437
		return "response";
438
	}
439
 
24880 govind 440
	private Map<String, Object> getAllInsuranceDetails(int fofoId) {
441
 
442
		LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
443
		LocalDateTime previousDayStart = currentDayStart.minusDays(1);
444
		LocalDateTime currentDayEnd = LocalDateTime.now();
445
		LocalDateTime currentMonthDayStart = LocalDateTime
446
				.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
447
		LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
448
		LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
449
		LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
450
 
451
		List<String> insuranceProviders = insuranceProviderRepository.selectAll().stream().map(x -> x.getName())
452
				.collect(Collectors.toList());
453
 
454
		Map<String, Object> map = new HashMap<>();
455
		List<InsurancePolicy> insurancePolicies = insurancePolicyRepository
456
				.selectByRetailerIdAndBetweenCreatedTimeStamp(fofoId, previousMonthFirstDay, LocalDateTime.now());
457
 
458
		Map<Integer, Double> currentMonthTotalInsurance = insurancePolicies.stream()
459
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
460
						&& x.getCreateTimestamp().isBefore(currentDayEnd))
461
				.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
462
						Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
463
 
464
		Map<Integer, Double> previousMonthTotalInsurance = insurancePolicies.stream()
465
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
466
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
467
				.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
468
						Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
469
 
470
		Map<Integer, Double> currentDayTotalInsurance = insurancePolicies.stream().filter(
471
				x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
472
				.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
473
						Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
474
 
475
		Map<Integer, Double> previousDayTotalInsurance = insurancePolicies.stream()
476
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
477
						&& x.getCreateTimestamp().isBefore(previousDayEnd))
478
				.collect(Collectors.groupingBy(InsurancePolicy::getRetailerId,
479
						Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
480
 
481
		IntFunction<String> intFunction = (providerId) -> {
482
			try {
483
				return insuranceProviderRepository.selectById(providerId).getName();
484
			} catch (ProfitMandiBusinessException e1) {
485
				// TODO Auto-generated catch block
486
				return "";
487
			}
488
		};
489
		Map<String, Double> currentMonthTotalInsuranceByPolicyName = insurancePolicies.stream()
490
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
491
						&& x.getCreateTimestamp().isBefore(currentDayEnd))
492
				.collect(Collectors.groupingBy(x -> {
493
					return intFunction.apply(x.getProviderId());
494
				}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
495
 
496
		Map<String, Double> previousMonthTotalInsuranceByPolicyName = insurancePolicies.stream()
497
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
498
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
499
				.collect(Collectors.groupingBy(x -> {
500
					return intFunction.apply(x.getProviderId());
501
				}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
502
 
503
		Map<String, Double> previousDayTotalInsuranceByPolicyName = insurancePolicies.stream()
504
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
505
						&& x.getCreateTimestamp().isBefore(previousDayEnd))
506
				.collect(Collectors.groupingBy(x -> {
507
					return intFunction.apply(x.getProviderId());
508
				}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
509
 
510
		Map<String, Double> currentDayTotalInsuranceByPolicyName = insurancePolicies.stream().filter(
511
				x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
512
				.collect(Collectors.groupingBy(x -> {
513
					return intFunction.apply(x.getProviderId());
514
				}, Collectors.summingDouble(InsurancePolicy::getSellingPrice)));
515
 
516
		map.put("currentMonthTotalInsurance", currentMonthTotalInsurance);
517
		map.put("previousMonthTotalInsurance", previousMonthTotalInsurance);
518
		map.put("currentDayTotalInsurance", currentDayTotalInsurance);
519
		map.put("previousDayTotalInsurance", previousDayTotalInsurance);
520
		map.put("currentMonthTotalInsuranceByPolicyName", currentMonthTotalInsuranceByPolicyName);
521
		map.put("previousMonthTotalInsuranceByPolicyName", previousMonthTotalInsuranceByPolicyName);
522
		map.put("previousDayTotalInsuranceByPolicyName", previousDayTotalInsuranceByPolicyName);
523
		map.put("currentDayTotalInsuranceByPolicyName", currentDayTotalInsuranceByPolicyName);
524
		map.put("insuranceProviders", insuranceProviders);
525
		return map;
526
	}
527
 
528
	private Map<String, Object> getAllRechargeDetails(int fofoId) {
529
 
530
		LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
531
		LocalDateTime previousDayStart = currentDayStart.minusDays(1);
532
		LocalDateTime currentDayEnd = LocalDateTime.now();
533
		LocalDateTime currentMonthDayStart = LocalDateTime
534
				.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
535
		LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
536
		LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
537
		LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
538
 
539
		List<RechargeTransaction> rechargeTransactions = rechargeTransactionRepository
540
				.getAllRechargeTransactionByCreatedTimeStamp(fofoId, previousMonthFirstDay, currentDayEnd).stream()
541
				.filter(x -> x.getStatus().equals(RechargeStatus.SUCCESS)).collect(Collectors.toList());
542
 
543
		LOGGER.info(rechargeTransactions);
544
		Map<Integer, Double> currentMonthTotalRecharge = rechargeTransactions.stream()
545
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
546
						&& x.getCreateTimestamp().isBefore(currentDayEnd))
547
				.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
548
						Collectors.summingDouble(RechargeTransaction::getAmount)));
549
		LOGGER.info(currentMonthTotalRecharge);
550
		Map<Integer, Double> previousMonthTotalRecharge = rechargeTransactions.stream()
551
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
552
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
553
				.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
554
						Collectors.summingDouble(RechargeTransaction::getAmount)));
555
 
556
		LOGGER.info(previousMonthTotalRecharge);
557
		Map<Integer, Double> currentDayTotalRecharge = rechargeTransactions.stream().filter(
558
				x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
559
				.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
560
						Collectors.summingDouble(RechargeTransaction::getAmount)));
561
 
562
		Map<Integer, Double> previousDayTotalRecharge = rechargeTransactions.stream()
563
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
564
						&& x.getCreateTimestamp().isBefore(previousDayEnd))
565
				.collect(Collectors.groupingBy(RechargeTransaction::getRetailerId,
566
						Collectors.summingDouble(RechargeTransaction::getAmount)));
567
 
568
		Map<Object, Double> currentMonthTotalRechargeByRechargeType = rechargeTransactions.stream()
569
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
570
						&& x.getCreateTimestamp().isBefore(currentDayEnd))
571
				.collect(Collectors.groupingBy(x -> {
572
					return x.getType();
573
				}, Collectors.summingDouble(RechargeTransaction::getAmount)));
574
 
575
		Map<Object, Double> previosMonthTotalRechargeByRechargeType = rechargeTransactions.stream()
576
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
577
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
578
				.collect(Collectors.groupingBy(x -> {
579
					return x.getType();
580
				}, Collectors.summingDouble(RechargeTransaction::getAmount)));
581
 
582
		Map<Object, Double> currentDayTotalRechargeByRechargeType = rechargeTransactions.stream().filter(
583
				x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
584
				.collect(Collectors.groupingBy(x -> {
585
					return x.getType();
586
				}, Collectors.summingDouble(RechargeTransaction::getAmount)));
587
 
588
		Map<Object, Double> previousDayTotalRechargeByRechargeType = rechargeTransactions.stream()
589
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
590
						&& x.getCreateTimestamp().isBefore(previousDayEnd))
591
				.collect(Collectors.groupingBy(x -> {
592
					return x.getType();
593
				}, Collectors.summingDouble(RechargeTransaction::getAmount)));
594
 
595
		LOGGER.info("previosMonthTotalRechargeByRechargeType" + previosMonthTotalRechargeByRechargeType);
596
		Map<String, Object> map = new HashMap<>();
597
		map.put("currentMonthTotalRecharge", currentMonthTotalRecharge);
598
		map.put("previousMonthTotalRecharge", previousMonthTotalRecharge);
599
		map.put("currentDayTotalRecharge", currentDayTotalRecharge);
600
		map.put("previousDayTotalRecharge", previousDayTotalRecharge);
601
		map.put("currentMonthTotalRechargeByRechargeType", currentMonthTotalRechargeByRechargeType);
602
		map.put("previosMonthTotalRechargeByRechargeType", previosMonthTotalRechargeByRechargeType);
603
		map.put("currentDayTotalRechargeByRechargeType", currentDayTotalRechargeByRechargeType);
604
		map.put("previousDayTotalRechargeByRechargeType", previousDayTotalRechargeByRechargeType);
605
		map.put("rechargeTypes", RechargeType.values());
606
 
607
		return map;
608
 
609
	}
610
 
611
	private Map<String, Object> getAllSaleDetails(int fofoId) {
612
 
613
		LocalDateTime currentDayStart = LocalDateTime.of(LocalDate.now(), LocalTime.of(00, 00));
614
		LocalDateTime previousDayStart = currentDayStart.minusDays(1);
615
		LocalDateTime currentDayEnd = LocalDateTime.now();
616
		LocalDateTime currentMonthDayStart = LocalDateTime
617
				.of(LocalDate.of(currentDayStart.getYear(), currentDayStart.getMonth(), 01), LocalTime.of(00, 00));
618
		LocalDateTime previousDayEnd = currentDayStart.minusMinutes(1);
619
		LocalDateTime previousMonthFirstDay = currentMonthDayStart.minusMonths(1);
620
		LocalDateTime previousMonthLastDay = currentMonthDayStart.minusMinutes(1);
621
 
622
		Map<String, Object> map = new HashMap<>();
623
 
624
		List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectBetweenCreatedTime(fofoId,
625
				previousMonthFirstDay, currentDayEnd);
626
 
627
		Double currentMonthTotalSale = fofoOrderItems.stream()
628
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
629
						&& x.getCreateTimestamp().isBefore(currentDayEnd))
630
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
631
 
632
		LOGGER.info("currentMonthTotalSale" + currentMonthTotalSale);
633
		Double previousMonthTotalSale = fofoOrderItems.stream()
634
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
635
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay))
636
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
637
 
638
		Double currentDayTotalSale = fofoOrderItems.stream().filter(
639
				x -> x.getCreateTimestamp().isAfter(currentDayStart) && x.getCreateTimestamp().isBefore(currentDayEnd))
640
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
641
 
642
		LOGGER.info(currentDayTotalSale);
643
 
644
		Double previousDayTotalSale = fofoOrderItems.stream()
645
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
646
						&& x.getCreateTimestamp().isBefore(previousDayEnd))
647
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
648
		LOGGER.info(previousDayTotalSale);
649
		IntPredicate checkHandset = (itemId) -> {
650
			try {
651
				Item item = itemRepository.selectById(itemId);
652
				return item.getCategoryId() == 10006;
653
			} catch (ProfitMandiBusinessException e) {
654
				// TODO Auto-generated catch block
655
				e.printStackTrace();
656
				return false;
657
			}
658
		};
659
 
660
		Set<String> brands = fofoOrderItemRepository
661
				.selectBetweenDates(previousMonthFirstDay.minusMonths(1), currentDayEnd).stream()
662
				.filter(x -> checkHandset.test(x.getItemId())).map(x -> x.getBrand()).collect(Collectors.toSet());
663
		Set<String> accessories = fofoOrderItemRepository
664
				.selectBetweenDates(previousMonthFirstDay.minusMonths(1), currentDayEnd).stream()
665
				.filter(x -> !checkHandset.test(x.getItemId())).map(x -> x.getBrand()).collect(Collectors.toSet());
666
 
667
		Double currentMonthTotalMobileSale = fofoOrderItems.stream()
668
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
669
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
670
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
671
 
672
		Double previousMonthTotalMobileSale = fofoOrderItems.stream()
673
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
674
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && checkHandset.test(x.getItemId()))
675
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
676
 
677
		Double previousDayTotalMobileSale = fofoOrderItems.stream()
678
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
679
						&& x.getCreateTimestamp().isBefore(previousDayEnd) && checkHandset.test(x.getItemId()))
680
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
681
 
682
		Double currentDayTotalMobileSale = fofoOrderItems.stream()
683
				.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
684
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
685
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
686
 
687
		Double currentMonthTotalAccessoriesSale = fofoOrderItems.stream()
688
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
689
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
690
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
691
 
692
		Double previousMonthTotalAccessoriesSale = fofoOrderItems.stream()
693
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
694
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && !checkHandset.test(x.getItemId()))
695
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
696
 
697
		Double previousDayTotalAccessoriesSale = fofoOrderItems.stream()
698
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
699
						&& x.getCreateTimestamp().isBefore(previousDayEnd) && !checkHandset.test(x.getItemId()))
700
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
701
 
702
		Double currentDayTotalAccessoriesSale = fofoOrderItems.stream()
703
				.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
704
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
705
				.collect(Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity()));
706
 
707
		Map<String, Double> currentMonthMobileSalegroupByBrand = fofoOrderItems.stream()
708
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
709
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
710
				.collect(Collectors.groupingBy(x -> x.getBrand(),
711
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
712
 
713
		Map<String, Double> currentMonthAccesoriesSalegroupByBrand = fofoOrderItems.stream()
714
				.filter(x -> x.getCreateTimestamp().isAfter(currentMonthDayStart)
715
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
716
				.collect(Collectors.groupingBy(x -> x.getBrand(),
717
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
718
 
719
		Map<String, Double> previousMonthAccesoriesSalegroupByBrand = fofoOrderItems.stream()
720
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
721
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && !checkHandset.test(x.getItemId()))
722
				.collect(Collectors.groupingBy(x -> x.getBrand(),
723
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
724
 
725
		Map<String, Double> currentDayAccesoriesSalegroupByBrand = fofoOrderItems.stream()
726
				.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
727
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && !checkHandset.test(x.getItemId()))
728
				.collect(Collectors.groupingBy(x -> x.getBrand(),
729
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
730
 
731
		Map<String, Double> previousDayAccesoriesSalegroupByBrand = fofoOrderItems.stream()
732
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
733
						&& x.getCreateTimestamp().isBefore(previousDayEnd) && !checkHandset.test(x.getItemId()))
734
				.collect(Collectors.groupingBy(x -> x.getBrand(),
735
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
736
 
737
		Map<String, Double> currentDayMobileSalegroupByBrand = fofoOrderItems.stream()
738
				.filter(x -> x.getCreateTimestamp().isAfter(currentDayStart)
739
						&& x.getCreateTimestamp().isBefore(currentDayEnd) && checkHandset.test(x.getItemId()))
740
				.collect(Collectors.groupingBy(x -> x.getBrand(),
741
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
742
 
743
		Map<String, Double> previousDayMobileSalegroupByBrand = fofoOrderItems.stream()
744
				.filter(x -> x.getCreateTimestamp().isAfter(previousDayStart)
745
						&& x.getCreateTimestamp().isBefore(previousDayEnd) && checkHandset.test(x.getItemId()))
746
				.collect(Collectors.groupingBy(x -> x.getBrand(),
747
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
748
		Map<String, Double> previousMonthMobileSalegroupByBrand = fofoOrderItems.stream()
749
				.filter(x -> x.getCreateTimestamp().isAfter(previousMonthFirstDay)
750
						&& x.getCreateTimestamp().isBefore(previousMonthLastDay) && checkHandset.test(x.getItemId()))
751
				.collect(Collectors.groupingBy(x -> x.getBrand(),
752
						Collectors.summingDouble(x -> x.getSellingPrice() * x.getQuantity())));
753
 
754
		map.put("brands", brands);
755
		map.put("accessories", accessories);
756
		map.put("currentMonthTotalSale", currentMonthTotalSale);
757
		map.put("previousMonthTotalSale", previousMonthTotalSale);
758
		map.put("currentDayTotalSale", currentDayTotalSale);
759
		map.put("previousDayTotalSale", previousDayTotalSale);
760
		map.put("currentMonthMobileSalegroupByBrand", currentMonthMobileSalegroupByBrand);
761
		map.put("currentMonthAccesoriesSalegroupByBrand", currentMonthAccesoriesSalegroupByBrand);
762
		map.put("previousMonthAccesoriesSalegroupByBrand", previousMonthAccesoriesSalegroupByBrand);
763
		map.put("previousDayAccesoriesSalegroupByBrand", previousDayAccesoriesSalegroupByBrand);
764
		map.put("currentDayMobileSalegroupByBrand", currentDayMobileSalegroupByBrand);
765
		map.put("previousDayMobileSalegroupByBrand", previousDayMobileSalegroupByBrand);
766
		map.put("currentDayAccesoriesSalegroupByBrand", currentDayAccesoriesSalegroupByBrand);
767
		map.put("previousMonthMobileSalegroupByBrand", previousMonthMobileSalegroupByBrand);
768
 
769
		map.put("currentMonthTotalMobileSale", currentMonthTotalMobileSale);
770
		map.put("previousMonthTotalMobileSale", previousMonthTotalMobileSale);
771
		map.put("previousDayTotalMobileSale", previousDayTotalMobileSale);
772
		map.put("currentDayTotalMobileSale", currentDayTotalMobileSale);
773
		map.put("currentMonthTotalAccessoriesSale", currentMonthTotalAccessoriesSale);
774
		map.put("previousMonthTotalAccessoriesSale", previousMonthTotalAccessoriesSale);
775
		map.put("previousDayTotalAccessoriesSale", previousDayTotalAccessoriesSale);
776
		map.put("currentDayTotalAccessoriesSale", currentDayTotalAccessoriesSale);
777
 
778
		return map;
779
	}
21615 kshitij.so 780
}