Subversion Repositories SmartDukaan

Rev

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

Rev 21777 Rev 21779
Line 63... Line 63...
63
			ProfitMandiBusinessException profitMandiBusinessException =  new ProfitMandiBusinessException(ProfitMandiConstants.PIN_CODE, invalidPinCodes, "PNCD_VE_1000");
63
			ProfitMandiBusinessException profitMandiBusinessException =  new ProfitMandiBusinessException(ProfitMandiConstants.PIN_CODE, invalidPinCodes, "PNCD_VE_1000");
64
			return responseSender.badRequest(profitMandiBusinessException);
64
			return responseSender.badRequest(profitMandiBusinessException);
65
		}
65
		}
66
		
66
		
67
		Set<Integer> foundRetailerIds = new HashSet<>();
67
		Set<Integer> foundRetailerIds = new HashSet<>();
-
 
68
		if(!createTagRequest.getRetailerIds().isEmpty()){
68
		List<Retailer> retailers = retailerRepository.selectByIds(createTagRequest.getRetailerIds());
69
			List<Retailer> retailers = retailerRepository.selectByIds(createTagRequest.getRetailerIds());
69
		if(retailers.size() != createTagRequest.getRetailerIds().size()){
70
			if(retailers.size() != createTagRequest.getRetailerIds().size()){
70
			for(Retailer retailer : retailers){
71
				for(Retailer retailer : retailers){
71
				foundRetailerIds.add(retailer.getId());
72
					foundRetailerIds.add(retailer.getId());
72
			}
-
 
73
			Collection<?> notFoundRetailerId = CollectionUtils.subtract(createTagRequest.getRetailerIds(), foundRetailerIds);
-
 
74
			ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFoundRetailerId, "RTLR_1000");
-
 
75
			return responseSender.badRequest(profitMandiBusinessException);
-
 
76
		}else{
-
 
77
			// given retailer ids are fofo user id's or not
-
 
78
			Set<Integer> notFofoRetailerIds = new HashSet<>();
-
 
79
			for(Retailer retailer : retailers){
-
 
80
				if(!retailer.isFofo()){
-
 
81
					notFofoRetailerIds.add(retailer.getId());
-
 
82
				}
73
				}
83
			}
-
 
84
			if(!notFofoRetailerIds.isEmpty()){
74
				Collection<?> notFoundRetailerId = CollectionUtils.subtract(createTagRequest.getRetailerIds(), foundRetailerIds);
85
				ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFofoRetailerIds, "RTLR_1010");
75
				ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFoundRetailerId, "RTLR_1000");
86
				return responseSender.badRequest(profitMandiBusinessException);
76
				return responseSender.badRequest(profitMandiBusinessException);
-
 
77
			}else{
-
 
78
				// given retailer ids are fofo user id's or not
-
 
79
				Set<Integer> notFofoRetailerIds = new HashSet<>();
-
 
80
				for(Retailer retailer : retailers){
-
 
81
					if(!retailer.isFofo()){
-
 
82
						notFofoRetailerIds.add(retailer.getId());
-
 
83
					}
-
 
84
				}
-
 
85
				if(!notFofoRetailerIds.isEmpty()){
-
 
86
					ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFofoRetailerIds, "RTLR_1010");
-
 
87
					return responseSender.badRequest(profitMandiBusinessException);
-
 
88
				}
87
			}
89
			}
88
		}
90
		}
89
		Tag tag = null;
91
		Tag tag = null;
90
		try{
92
		try{
91
			tag = tagRepository.selectByLabelAndType(createTagRequest.getLabel(), createTagRequest.getTagType());
93
			tag = tagRepository.selectByLabelAndType(createTagRequest.getLabel(), createTagRequest.getTagType());