Subversion Repositories SmartDukaan

Rev

Rev 29566 | Rev 29670 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29566 Rev 29668
Line 98... Line 98...
98
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
98
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
99
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
99
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
100
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
100
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
101
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
101
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
102
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
102
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
-
 
103
import com.spice.profitmandi.dao.entity.fofo.PartnerBrandService;
103
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
104
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
104
import com.spice.profitmandi.dao.entity.fofo.PartnerProblem;
105
import com.spice.profitmandi.dao.entity.fofo.PartnerProblem;
105
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
106
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
106
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
107
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
107
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
108
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
Line 109... Line 110...
109
import com.spice.profitmandi.dao.entity.fofo.RazorPay;
110
import com.spice.profitmandi.dao.entity.fofo.RazorPay;
110
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
111
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
111
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
112
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
112
import com.spice.profitmandi.dao.entity.inventory.SaholicCIS;
113
import com.spice.profitmandi.dao.entity.inventory.SaholicCIS;
113
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
114
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
-
 
115
import com.spice.profitmandi.dao.entity.inventory.State;
114
import com.spice.profitmandi.dao.entity.transaction.Order;
116
import com.spice.profitmandi.dao.entity.transaction.Order;
115
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
117
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
116
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
118
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
117
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
119
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
118
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
120
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
Line 122... Line 124...
122
import com.spice.profitmandi.dao.entity.user.Lead;
124
import com.spice.profitmandi.dao.entity.user.Lead;
123
import com.spice.profitmandi.dao.entity.user.Refferal;
125
import com.spice.profitmandi.dao.entity.user.Refferal;
124
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
126
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
125
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
127
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
126
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
128
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
-
 
129
import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;
127
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
130
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
128
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
131
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
129
import com.spice.profitmandi.dao.model.SimpleCampaign;
132
import com.spice.profitmandi.dao.model.SimpleCampaign;
130
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
133
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
131
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
134
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
Line 174... Line 177...
174
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
177
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
175
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
178
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
176
import com.spice.profitmandi.dao.repository.fofo.RazorPayRepository;
179
import com.spice.profitmandi.dao.repository.fofo.RazorPayRepository;
177
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
180
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
178
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
181
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
-
 
182
import com.spice.profitmandi.dao.repository.fofo.ServiceConfigRepository;
179
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
183
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
180
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
184
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
181
import com.spice.profitmandi.dao.repository.transaction.HdfcPaymentRepository;
185
import com.spice.profitmandi.dao.repository.transaction.HdfcPaymentRepository;
182
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
186
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
183
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
187
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
Line 185... Line 189...
185
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
189
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
186
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
190
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
187
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
191
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
188
import com.spice.profitmandi.dao.repository.user.AddressRepository;
192
import com.spice.profitmandi.dao.repository.user.AddressRepository;
189
import com.spice.profitmandi.dao.repository.user.UserRepository;
193
import com.spice.profitmandi.dao.repository.user.UserRepository;
-
 
194
import com.spice.profitmandi.service.EmailService;
190
import com.spice.profitmandi.service.NotificationService;
195
import com.spice.profitmandi.service.NotificationService;
191
import com.spice.profitmandi.service.PartnerInvestmentService;
196
import com.spice.profitmandi.service.PartnerInvestmentService;
192
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
197
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
193
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
198
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
194
import com.spice.profitmandi.service.inventory.InventoryService;
199
import com.spice.profitmandi.service.inventory.InventoryService;
Line 196... Line 201...
196
import com.spice.profitmandi.service.order.OrderService;
201
import com.spice.profitmandi.service.order.OrderService;
197
import com.spice.profitmandi.service.pricing.PriceDropService;
202
import com.spice.profitmandi.service.pricing.PriceDropService;
198
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
203
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
199
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
204
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
200
import com.spice.profitmandi.service.scheme.SchemeService;
205
import com.spice.profitmandi.service.scheme.SchemeService;
-
 
206
import com.spice.profitmandi.service.serviceConfig.ServiceConfigService;
201
import com.spice.profitmandi.service.transaction.TransactionService;
207
import com.spice.profitmandi.service.transaction.TransactionService;
202
import com.spice.profitmandi.service.user.RetailerService;
208
import com.spice.profitmandi.service.user.RetailerService;
203
import com.spice.profitmandi.service.wallet.WalletService;
209
import com.spice.profitmandi.service.wallet.WalletService;
204
 
210
 
205
import in.shop2020.model.v1.order.OrderStatus;
211
import in.shop2020.model.v1.order.OrderStatus;
Line 218... Line 224...
218
	@Value("${oxigen.recharge.enquiry.url}")
224
	@Value("${oxigen.recharge.enquiry.url}")
219
	private String oxigenRechargeEnquiryUrl;
225
	private String oxigenRechargeEnquiryUrl;
220
 
226
 
221
	@Autowired
227
	@Autowired
222
	private RegionRepository regionRepository;
228
	private RegionRepository regionRepository;
223
	
229
 
224
	@Autowired
230
	@Autowired
225
	private TecnoImeiActivation tecnoImeiActivation;
231
	private TecnoImeiActivation tecnoImeiActivation;
226
 
232
 
227
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
233
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
228
 
234
 
Line 320... Line 326...
320
	private PartnerTypeChangeRepository partnerTypeChangeRepository;
326
	private PartnerTypeChangeRepository partnerTypeChangeRepository;
321
 
327
 
322
	@Autowired
328
	@Autowired
323
	private SchemeService schemeService;
329
	private SchemeService schemeService;
324
 
330
 
-
 
331
	@Autowired
-
 
332
	private ServiceConfigRepository serviceConfigRepository;
-
 
333
 
325
	@Value("${delhivery.tracking.token}")
334
	@Value("${delhivery.tracking.token}")
326
	private String token;
335
	private String token;
327
 
336
 
328
	private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com",
337
	private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com",
329
			"mohinder.mutreja@smartdukaan.com", "ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
338
			"mohinder.mutreja@smartdukaan.com", "ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
Line 2267... Line 2276...
2267
							inventoryItem.getLastScanType().equals(ScanType.DOA_OUT) + "")));
2276
							inventoryItem.getLastScanType().equals(ScanType.DOA_OUT) + "")));
2268
				}
2277
				}
2269
			}
2278
			}
2270
		}
2279
		}
2271
	}
2280
	}
2272
	
2281
 
2273
	public void toffeeRollback() throws Exception {
2282
	public void toffeeRollback() throws Exception {
2274
		toffeeService.cancelPolicyCopy("110143521986");
2283
		toffeeService.cancelPolicyCopy("110143521986");
2275
		toffeeService.getOrderId("110143521986");
2284
		toffeeService.getOrderId("110143521986");
2276
	}
2285
	}
2277
 
2286
 
Line 2397... Line 2406...
2397
				LOGGER.info("No region found for partner {}", fofoId);
2406
				LOGGER.info("No region found for partner {}", fofoId);
2398
				continue;
2407
				continue;
2399
			}
2408
			}
2400
			Map<Integer, Optional<Integer>> focusedCatalogIdAndQtyMap = focusedModelRepository
2409
			Map<Integer, Optional<Integer>> focusedCatalogIdAndQtyMap = focusedModelRepository
2401
					.selectAllByRegionIds(regionIds).stream().collect(Collectors.groupingBy(FocusedModel::getCatalogId,
2410
					.selectAllByRegionIds(regionIds).stream().collect(Collectors.groupingBy(FocusedModel::getCatalogId,
2402
							Collectors.mapping(FocusedModel::getMinimumQty, Collectors.maxBy(Integer::compareTo))));
2411
							Collectors.mapping(FocusedModel::getObsMinimumQty, Collectors.maxBy(Integer::compareTo))));
2403
 
2412
 
2404
			LOGGER.info("focusedCatalogIdAndQtyMap" + focusedCatalogIdAndQtyMap);
2413
			LOGGER.info("focusedCatalogIdAndQtyMap" + focusedCatalogIdAndQtyMap);
2405
 
2414
 
2406
			for (Map.Entry<Integer, Optional<Integer>> entry : focusedCatalogIdAndQtyMap.entrySet()) {
2415
			for (Map.Entry<Integer, Optional<Integer>> entry : focusedCatalogIdAndQtyMap.entrySet()) {
2407
				int minQty = entry.getValue().get();
2416
				int minQty = entry.getValue().get();
Line 2483... Line 2492...
2483
					focusedModelShortageList.add(fm);
2492
					focusedModelShortageList.add(fm);
2484
				}
2493
				}
2485
 
2494
 
2486
			}
2495
			}
2487
 
2496
 
-
 
2497
			/*
2488
			if (!focusedModelShortageList.isEmpty()) {
2498
			 * if (!focusedModelShortageList.isEmpty()) { String subject = "Stock Alert";
2489
				String subject = "Stock Alert";
-
 
2490
				String messageText = this.getMessage(focusedModelShortageList);
2499
			 * String messageText = this.getMessage(focusedModelShortageList);
2491
 
2500
			 * 
2492
				this.sendMailWithAttachments(subject, messageText, customRetailer.getEmail());
2501
			 * this.sendMailWithAttachments(subject, messageText,
-
 
2502
			 * customRetailer.getEmail()); String notificationMessage =
2493
				String notificationMessage = this.getNotificationMessage(focusedModelShortageList);
2503
			 * this.getNotificationMessage(focusedModelShortageList);
2494
 
2504
			 * 
2495
				LOGGER.info("notificationMessage" + notificationMessage);
2505
			 * LOGGER.info("notificationMessage" + notificationMessage);
2496
 
2506
			 * 
2497
				SendNotificationModel sendNotificationModel = new SendNotificationModel();
2507
			 * SendNotificationModel sendNotificationModel = new SendNotificationModel();
2498
				sendNotificationModel.setCampaignName("Stock Alert");
2508
			 * sendNotificationModel.setCampaignName("Stock Alert");
2499
				sendNotificationModel.setTitle("Alert");
2509
			 * sendNotificationModel.setTitle("Alert");
2500
				sendNotificationModel.setMessage(notificationMessage);
2510
			 * sendNotificationModel.setMessage(notificationMessage);
2501
				sendNotificationModel.setType("url");
2511
			 * sendNotificationModel.setType("url"); sendNotificationModel.setUrl(
2502
				sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
2512
			 * "https://app.smartdukaan.com/pages/home/notifications");
2503
				sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
2513
			 * sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
2504
				sendNotificationModel.setMessageType(MessageType.notification);
2514
			 * sendNotificationModel.setMessageType(MessageType.notification); int userId =
2505
				int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
2515
			 * userAccountRepository.selectUserIdByRetailerId(fofoId);
2506
				sendNotificationModel.setUserIds(Arrays.asList(userId));
2516
			 * sendNotificationModel.setUserIds(Arrays.asList(userId));
2507
				notificationService.sendNotification(sendNotificationModel);
2517
			 * notificationService.sendNotification(sendNotificationModel);
2508
 
2518
			 * 
2509
			}
2519
			 * }
-
 
2520
			 */
2510
 
2521
 
2511
		}
2522
		}
2512
		if (!focusedModelShortageReportMap.isEmpty()) {
2523
		if (!focusedModelShortageReportMap.isEmpty()) {
2513
			String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2524
			String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2514
			Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
2525
			Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
Line 3028... Line 3039...
3028
			// TODO Auto-generated catch block
3039
			// TODO Auto-generated catch block
3029
			e.printStackTrace();
3040
			e.printStackTrace();
3030
		}
3041
		}
3031
 
3042
 
3032
	}
3043
	}
3033
	
-
 
3034
	
-
 
3035
 
3044
 
3036
	public void checkItelImeiActivation(LocalDate date,Integer day) {
3045
	public void checkItelImeiActivation(LocalDate date, Integer day) {
3037
		LOGGER.info("Hello - {}", "hhh");
3046
		LOGGER.info("Hello - {}", "hhh");
3038
 
3047
 
3039
		try {
3048
		try {
3040
			itelImeiActivationService.checkItelImeiActivation(date,day);
3049
			itelImeiActivationService.checkItelImeiActivation(date, day);
3041
		} catch (ProfitMandiBusinessException e) {
3050
		} catch (ProfitMandiBusinessException e) {
3042
			// TODO Auto-generated catch block
3051
			// TODO Auto-generated catch block
3043
			e.printStackTrace();
3052
			e.printStackTrace();
3044
		} catch (IOException e) {
3053
		} catch (IOException e) {
3045
			// TODO Auto-generated catch block
3054
			// TODO Auto-generated catch block
Line 3049... Line 3058...
3049
			e.printStackTrace();
3058
			e.printStackTrace();
3050
		}
3059
		}
3051
 
3060
 
3052
	}
3061
	}
3053
 
3062
 
3054
	public void checkTecnoImeiActivation(LocalDate date,Integer day) {
3063
	public void checkTecnoImeiActivation(LocalDate date, Integer day) {
3055
		LOGGER.info("Hello - {}", "hhh");
3064
		LOGGER.info("Hello - {}", "hhh");
3056
 
3065
 
3057
		try {
3066
		try {
3058
			tecnoImeiActivation.checkTecnoImeiActivation(date,day);
3067
			tecnoImeiActivation.checkTecnoImeiActivation(date, day);
3059
		} catch (ProfitMandiBusinessException e) {
3068
		} catch (ProfitMandiBusinessException e) {
3060
			// TODO Auto-generated catch block
3069
			// TODO Auto-generated catch block
3061
			e.printStackTrace();
3070
			e.printStackTrace();
3062
		} catch (IOException e) {
3071
		} catch (IOException e) {
3063
			// TODO Auto-generated catch block
3072
			// TODO Auto-generated catch block
Line 3067... Line 3076...
3067
			e.printStackTrace();
3076
			e.printStackTrace();
3068
		}
3077
		}
3069
 
3078
 
3070
	}
3079
	}
3071
 
3080
 
3072
	
-
 
3073
	public void checkCancellationMargin() throws Exception {
3081
	public void checkCancellationMargin() throws Exception {
3074
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
3082
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
3075
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
3083
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
3076
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
3084
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
3077
		for (FofoOrder fofoOrder : fofoOrders) {
3085
		for (FofoOrder fofoOrder : fofoOrders) {
Line 3209... Line 3217...
3209
			}
3217
			}
3210
 
3218
 
3211
		}
3219
		}
3212
	}
3220
	}
3213
 
3221
 
-
 
3222
	public void financeServices() {
-
 
3223
		List<PartnerBrandService> pbs = serviceConfigRepository.selectByPartnerStatusType(PartnerStatusType.NOTWORKING);
-
 
3224
		if (!pbs.isEmpty()) {
-
 
3225
			Map<Integer, List<Integer>> fofoIdBrandServiceMap = pbs.stream().collect(Collectors.groupingBy(
-
 
3226
					x -> x.getFofoId(), Collectors.mapping(x -> x.getBrandServiceId(), Collectors.toList())));
-
 
3227
 
-
 
3228
			serviceConfigRepository.selectAll();
-
 
3229
 
-
 
3230
		}
-
 
3231
	}
-
 
3232
 
3214
}
3233
}
3215
//2284
3234
//2284
3216
3235