| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.pricing;
|
1 |
package com.spice.profitmandi.service.pricing;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.util.ArrayList;
|
| 3 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
| 4 |
import java.util.HashSet;
|
5 |
import java.util.HashSet;
|
| 5 |
import java.util.List;
|
6 |
import java.util.List;
|
| 6 |
import java.util.Map;
|
7 |
import java.util.Map;
|
| 7 |
import java.util.Set;
|
8 |
import java.util.Set;
|
| Line 166... |
Line 167... |
| 166 |
}
|
167 |
}
|
| 167 |
}
|
168 |
}
|
| 168 |
}
|
169 |
}
|
| 169 |
return mopPriceMap;
|
170 |
return mopPriceMap;
|
| 170 |
}
|
171 |
}
|
| - |
|
172 |
|
| - |
|
173 |
//Currently it only handles fofos
|
| - |
|
174 |
public List<Integer> getTagsIdsByRetailerId(int retailerId) throws Throwable {
|
| - |
|
175 |
int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(retailerId);
|
| - |
|
176 |
Address retailerAddress = addressRepository.selectById(addressId);
|
| - |
|
177 |
Set<Integer> pinCodeTagIds = tagService.getFofoTagIdsByPinCode(retailerAddress.getPinCode());
|
| - |
|
178 |
Set<Integer> pinNegativeTagIds = tagService.getPinCodeNegativeTagIds();
|
| - |
|
179 |
Set<Integer> pinCodeIntersection = new HashSet<>(CollectionUtils.intersection(pinCodeTagIds, pinNegativeTagIds));
|
| - |
|
180 |
|
| - |
|
181 |
Set<Integer> validTagIds = new HashSet<>(CollectionUtils.subtract(pinNegativeTagIds, pinCodeIntersection));
|
| - |
|
182 |
Set<Integer> pinPositiveTagIds = tagService.getPinCodePositiveTagIds();
|
| - |
|
183 |
validTagIds.addAll(CollectionUtils.intersection(pinPositiveTagIds, pinCodeTagIds));
|
| - |
|
184 |
if(validTagIds.isEmpty()){
|
| - |
|
185 |
return new ArrayList<>(validTagIds);
|
| - |
|
186 |
}
|
| - |
|
187 |
Set<Integer> retailerTagIds = tagService.getUserTagIdsByTagIds(validTagIds);
|
| - |
|
188 |
Set<Integer> userNegativeTagIds = tagService.getUserNegativeTagIds();
|
| - |
|
189 |
Set<Integer> userIntersection = new HashSet<>(CollectionUtils.intersection(retailerTagIds, userNegativeTagIds));
|
| - |
|
190 |
validTagIds = new HashSet<>(CollectionUtils.subtract(userNegativeTagIds, userIntersection));
|
| - |
|
191 |
Set<Integer> userPositiveTagIds = tagService.getUserPositiveTagIds();
|
| - |
|
192 |
validTagIds.addAll(CollectionUtils.intersection(userPositiveTagIds, retailerTagIds));
|
| - |
|
193 |
return new ArrayList<>(validTagIds);
|
| - |
|
194 |
}
|
| 171 |
}
|
195 |
}
|