Subversion Repositories SmartDukaan

Rev

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

Rev 25895 Rev 25910
Line 72... Line 72...
72
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
72
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
73
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
73
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
74
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
74
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
75
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
75
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
76
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
76
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
77
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
-
 
78
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
77
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
79
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
78
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
80
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
79
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
81
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
80
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
82
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
81
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
Line 89... Line 88...
89
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
88
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
90
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
89
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
91
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
90
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
92
import com.spice.profitmandi.dao.entity.user.Address;
91
import com.spice.profitmandi.dao.entity.user.Address;
93
import com.spice.profitmandi.dao.entity.user.Device;
92
import com.spice.profitmandi.dao.entity.user.Device;
-
 
93
import com.spice.profitmandi.dao.entity.user.Lead;
94
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
94
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
95
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
95
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
96
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
96
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
97
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
97
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
98
import com.spice.profitmandi.dao.model.SimpleCampaign;
98
import com.spice.profitmandi.dao.model.SimpleCampaign;
Line 105... Line 105...
105
import com.spice.profitmandi.dao.repository.cs.CsService;
105
import com.spice.profitmandi.dao.repository.cs.CsService;
106
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
106
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
107
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
107
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
108
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
108
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
109
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
109
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
-
 
110
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
110
import com.spice.profitmandi.dao.repository.dtr.Mongo;
111
import com.spice.profitmandi.dao.repository.dtr.Mongo;
111
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
112
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
112
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
113
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
113
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderCreditWalletHistoryRepository;
114
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderCreditWalletHistoryRepository;
114
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
115
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
Line 164... Line 165...
164
 
165
 
165
	@Autowired
166
	@Autowired
166
	private PartnerTypeChangeService partnerTypeChangeService;
167
	private PartnerTypeChangeService partnerTypeChangeService;
167
 
168
 
168
	@Autowired
169
	@Autowired
-
 
170
	private LeadRepository leadRepository;
-
 
171
	
-
 
172
	@Autowired
169
	private AuthRepository authRepository;
173
	private AuthRepository authRepository;
170
 
174
 
171
	@Autowired
175
	@Autowired
172
	private PriceDropService priceDropService;
176
	private PriceDropService priceDropService;
173
 
177
 
Line 1309... Line 1313...
1309
 
1313
 
1310
	}
1314
	}
1311
 
1315
 
1312
	public void sendDailySalesNotificationToPartner(Integer fofoIdInt)
1316
	public void sendDailySalesNotificationToPartner(Integer fofoIdInt)
1313
			throws ProfitMandiBusinessException, MessagingException, IOException {
1317
			throws ProfitMandiBusinessException, MessagingException, IOException {
-
 
1318
		
1314
		LocalDateTime now = LocalDateTime.now();
1319
		LocalDateTime now = LocalDateTime.now();
1315
		LocalDateTime from = now.with(LocalTime.MIN);
1320
		LocalDateTime from = now.with(LocalTime.MIN);
-
 
1321
		if(now.getHour() < 12) {
-
 
1322
			from = now.minusDays(1);
-
 
1323
			now = from.with(LocalTime.MAX);
-
 
1324
			  
-
 
1325
		}
1316
		List<Integer> fofoIds = null;
1326
		List<Integer> fofoIds = null;
1317
		if (fofoIdInt == null) {
1327
		if (fofoIdInt == null) {
1318
			fofoIds = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive()).map(x -> x.getId())
1328
			fofoIds = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive()).map(x -> x.getId())
1319
					.collect(Collectors.toList());
1329
					.collect(Collectors.toList());
1320
		} else {
1330
		} else {
Line 1920... Line 1930...
1920
		sb.append("</tbody></table></body></html>");
1930
		sb.append("</tbody></table></body></html>");
1921
 
1931
 
1922
		return sb.toString();
1932
		return sb.toString();
1923
	}
1933
	}
1924
 
1934
 
-
 
1935
	public void notifyLead() throws Exception{
-
 
1936
		List<Lead> leadsToNotify = leadRepository.selectLeadsScheduledBetweenDate(LocalDateTime.now().minusDays(15), LocalDateTime.now().plusHours(2));
-
 
1937
		
-
 
1938
		
-
 
1939
		
-
 
1940
		
-
 
1941
		String notificationMessage = "";
-
 
1942
		SendNotificationModel sendNotificationModel = new SendNotificationModel();
-
 
1943
		sendNotificationModel.setCampaignName("Stock Alert");
-
 
1944
		sendNotificationModel.setTitle("Alert");
-
 
1945
		sendNotificationModel.setMessage(notificationMessage);
-
 
1946
		sendNotificationModel.setType("url");
-
 
1947
		sendNotificationModel.setUrl("http://app.profitmandi.com/pages/home/notifications");
-
 
1948
		sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
-
 
1949
		sendNotificationModel.setMessageType(MessageType.reminder);
-
 
1950
		int userId = userAccountRepository.selectUserIdByRetailerId(0);
-
 
1951
		sendNotificationModel.setUserIds(Arrays.asList(userId));
-
 
1952
		notificationService.sendNotification(sendNotificationModel);
-
 
1953
	}
-
 
1954
 
1925
}
1955
}
1926
1956