Subversion Repositories SmartDukaan

Rev

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

Rev 23041 Rev 23042
Line 206... Line 206...
206
			shop.setDocumentId(createRetailerRequest.getShop().getDocumentId());
206
			shop.setDocumentId(createRetailerRequest.getShop().getDocumentId());
207
			documentRepository.markDocumentAsPersisted(createRetailerRequest.getShop().getDocumentId());
207
			documentRepository.markDocumentAsPersisted(createRetailerRequest.getShop().getDocumentId());
208
		}
208
		}
209
		
209
		
210
		com.spice.profitmandi.dao.entity.user.User saholicUser = null;
210
		com.spice.profitmandi.dao.entity.user.User saholicUser = null;
211
		boolean foundRetailer = false;
211
		boolean foundRetailerFlag = false;
212
		try {
212
		try {
213
			saholicUser = userUserRepository.selectByEmailId(user.getEmailId());
213
			saholicUser = userUserRepository.selectByEmailId(user.getEmailId());
214
		}catch (ProfitMandiBusinessException e) {
214
		}catch (ProfitMandiBusinessException e) {
215
			LOGGER.info("User doesnt exist in old system");
215
			LOGGER.info("User doesnt exist in old system");
216
		}
216
		}
Line 222... Line 222...
222
			saholicUser.setEmailId(user.getEmailId());
222
			saholicUser.setEmailId(user.getEmailId());
223
			saholicUser.setName(createRetailerRequest.getName());
223
			saholicUser.setName(createRetailerRequest.getName());
224
			saholicUser.setActiveCartId(cart.getId());
224
			saholicUser.setActiveCartId(cart.getId());
225
			userUserRepository.persist(saholicUser);
225
			userUserRepository.persist(saholicUser);
226
		}else{
226
		}else{
227
			foundRetailer = true;
227
			foundRetailerFlag = true;
228
		}
228
		}
-
 
229
		Retailer foundRetailer = null;
229
		try{
230
		try{
230
			retailerRepository.selectById(saholicUser.getId());
231
			foundRetailer = retailerRepository.selectById(saholicUser.getId());
231
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, saholicUser.getEmailId(), "RTLR_1011");
-
 
232
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
232
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
233
			LOGGER.info("Retailer is not registered");
233
			LOGGER.info("Retailer is not registered");
234
		}
234
		}
-
 
235
		if(foundRetailer != null){
-
 
236
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, saholicUser.getEmailId(), "RTLR_1011");
-
 
237
		}
235
		//in.shop2020.model.v1.user.User saholicUser = Utils.createSaholicUser(user.getEmailId()); 
238
		//in.shop2020.model.v1.user.User saholicUser = Utils.createSaholicUser(user.getEmailId()); 
236
		retailer.setId(saholicUser.getId());
239
		retailer.setId(saholicUser.getId());
237
		retailerRepository.persist(retailer);
240
		retailerRepository.persist(retailer);
238
		
241
		
239
		shop.setRetailerId(retailer.getId());
242
		shop.setRetailerId(retailer.getId());
Line 281... Line 284...
281
		UserRole ur = new UserRole();
284
		UserRole ur = new UserRole();
282
		ur.setRoleType(RoleType.RETAILER);
285
		ur.setRoleType(RoleType.RETAILER);
283
		ur.setUserId(user.getId());
286
		ur.setUserId(user.getId());
284
		userRoleRepository.persist(ur);
287
		userRoleRepository.persist(ur);
285
		
288
		
286
		if(foundRetailer){
289
		if(foundRetailerFlag){
287
			LOGGER.info("\n\n\n****retailer found\n\n\n");
290
			LOGGER.info("\n\n\n****retailer found\n\n\n");
288
			PrivateDealUser privateDealUser = null;
291
			PrivateDealUser privateDealUser = null;
289
			try{
292
			try{
290
				privateDealUser = privateDealUserRepository.selectById(saholicUser.getId());
293
				privateDealUser = privateDealUserRepository.selectById(saholicUser.getId());
291
			}catch(ProfitMandiBusinessException profitMandiBusinessException){
294
			}catch(ProfitMandiBusinessException profitMandiBusinessException){