Subversion Repositories SmartDukaan

Rev

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

Rev 25104 Rev 25162
Line 1134... Line 1134...
1134
		fofoOrderItem.setItemId(customFofoOrderItem.getItemId());
1134
		fofoOrderItem.setItemId(customFofoOrderItem.getItemId());
1135
		fofoOrderItem.setQuantity(customFofoOrderItem.getQuantity());
1135
		fofoOrderItem.setQuantity(customFofoOrderItem.getQuantity());
1136
		fofoOrderItem.setSellingPrice(customFofoOrderItem.getSellingPrice());
1136
		fofoOrderItem.setSellingPrice(customFofoOrderItem.getSellingPrice());
1137
		fofoOrderItem.setOrderId(fofoOrderId);
1137
		fofoOrderItem.setOrderId(fofoOrderId);
1138
		TagListing tl = tagListingRepository.selectByItemId(customFofoOrderItem.getItemId());
1138
		TagListing tl = tagListingRepository.selectByItemId(customFofoOrderItem.getItemId());
1139
		//In case listing gets removed rebill it using the selling price
1139
		// In case listing gets removed rebill it using the selling price
1140
		if(tl != null) {
1140
		if (tl != null) {
1141
			fofoOrderItem.setDp(tl.getSellingPrice());
1141
			fofoOrderItem.setDp(tl.getSellingPrice());
1142
		} else {
1142
		} else {
1143
			fofoOrderItem.setDp(customFofoOrderItem.getSellingPrice());
1143
			fofoOrderItem.setDp(customFofoOrderItem.getSellingPrice());
1144
		}
1144
		}
1145
		fofoOrderItem.setDiscount(customFofoOrderItem.getDiscountAmount());
1145
		fofoOrderItem.setDiscount(customFofoOrderItem.getDiscountAmount());
Line 1210... Line 1210...
1210
	}
1210
	}
1211
 
1211
 
1212
	private Customer createAndGetCustomer(CustomCustomer customCustomer) throws ProfitMandiBusinessException {
1212
	private Customer createAndGetCustomer(CustomCustomer customCustomer) throws ProfitMandiBusinessException {
1213
		Customer customer = null;
1213
		Customer customer = null;
1214
		try {
1214
		try {
1215
			customer = customerRepository.selectByMobileNumber(customCustomer.getMobileNumber());
1215
			List<Customer> customers = customerRepository.selectAllByMobileNumber(customCustomer.getMobileNumber());
-
 
1216
			List<Customer> filtered = customers.stream().filter(x->
-
 
1217
					x.getEmailId().equals(customCustomer.getEmailId()) &&
-
 
1218
					x.getFirstName().equals(customCustomer.getFirstName()) &&
-
 
1219
					x.getLastName().equals(customCustomer.getLastName())
-
 
1220
			).collect(Collectors.toList());
-
 
1221
			if(filtered.size() > 0) {
-
 
1222
				return filtered.get(0);
-
 
1223
			}
1216
		} catch (ProfitMandiBusinessException profitMandiBusinessException) {
1224
		} catch (ProfitMandiBusinessException profitMandiBusinessException) {
1217
			LOGGER.error("Customer not found with mobileNumber [{}]", customCustomer.getMobileNumber());
1225
			LOGGER.error("Customer not found with mobileNumber [{}]", customCustomer.getMobileNumber());
1218
			customer = new Customer();
1226
			customer = new Customer();
1219
		}
1227
		}
1220
		customer.setFirstName(customCustomer.getFirstName());
1228
		customer.setFirstName(customCustomer.getFirstName());