| Line 24... |
Line 24... |
| 24 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
24 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 25 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
25 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 26 |
import com.spice.profitmandi.dao.entity.fofo.RetailerTag;
|
26 |
import com.spice.profitmandi.dao.entity.fofo.RetailerTag;
|
| 27 |
import com.spice.profitmandi.dao.entity.fofo.PinCodeTag;
|
27 |
import com.spice.profitmandi.dao.entity.fofo.PinCodeTag;
|
| 28 |
import com.spice.profitmandi.dao.entity.fofo.Tag;
|
28 |
import com.spice.profitmandi.dao.entity.fofo.Tag;
|
| - |
|
29 |
import com.spice.profitmandi.dao.enumuration.fofo.TagType;
|
| 29 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
30 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.fofo.RetailerTagRepository;
|
31 |
import com.spice.profitmandi.dao.repository.fofo.RetailerTagRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.fofo.PinCodeTagRepository;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.PinCodeTagRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.TagRepository;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.TagRepository;
|
| 33 |
import com.spice.profitmandi.web.request.CreateTagRequest;
|
34 |
import com.spice.profitmandi.web.request.CreateTagRequest;
|
| Line 73... |
Line 74... |
| 73 |
}
|
74 |
}
|
| 74 |
Collection<?> notFoundRetailerId = CollectionUtils.subtract(createTagRequest.getRetailerIds(), foundRetailerIds);
|
75 |
Collection<?> notFoundRetailerId = CollectionUtils.subtract(createTagRequest.getRetailerIds(), foundRetailerIds);
|
| 75 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFoundRetailerId, "RTLR_1000");
|
76 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFoundRetailerId, "RTLR_1000");
|
| 76 |
return responseSender.badRequest(profitMandiBusinessException);
|
77 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 77 |
}else{
|
78 |
}else{
|
| - |
|
79 |
if(createTagRequest.getTagType() == TagType.FOFO){
|
| 78 |
// given retailer ids are fofo user id's or not
|
80 |
// given retailer ids are fofo user id's or not
|
| 79 |
Set<Integer> notFofoRetailerIds = new HashSet<>();
|
81 |
Set<Integer> notFofoRetailerIds = new HashSet<>();
|
| 80 |
for(Retailer retailer : retailers){
|
82 |
for(Retailer retailer : retailers){
|
| 81 |
if(!retailer.isFofo()){
|
83 |
if(!retailer.isFofo()){
|
| 82 |
notFofoRetailerIds.add(retailer.getId());
|
84 |
notFofoRetailerIds.add(retailer.getId());
|
| - |
|
85 |
}
|
| - |
|
86 |
}
|
| - |
|
87 |
if(!notFofoRetailerIds.isEmpty()){
|
| - |
|
88 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFofoRetailerIds, "RTLR_1010");
|
| - |
|
89 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 83 |
}
|
90 |
}
|
| 84 |
}
|
- |
|
| 85 |
if(!notFofoRetailerIds.isEmpty()){
|
- |
|
| 86 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ProfitMandiConstants.REJECTED_USER_IDS, notFofoRetailerIds, "RTLR_1010");
|
- |
|
| 87 |
return responseSender.badRequest(profitMandiBusinessException);
|
- |
|
| 88 |
}
|
91 |
}
|
| 89 |
}
|
92 |
}
|
| 90 |
}
|
93 |
}
|
| 91 |
Tag tag = null;
|
94 |
Tag tag = null;
|
| 92 |
try{
|
95 |
try{
|