| Line 28... |
Line 28... |
| 28 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
28 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 29 |
import com.spice.profitmandi.dao.entity.dtr.ShopAddress;
|
29 |
import com.spice.profitmandi.dao.entity.dtr.ShopAddress;
|
| 30 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
30 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 31 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
31 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 32 |
import com.spice.profitmandi.dao.entity.dtr.UserRole;
|
32 |
import com.spice.profitmandi.dao.entity.dtr.UserRole;
|
| - |
|
33 |
import com.spice.profitmandi.dao.entity.fofo.FofoPartnerPaymentOption;
|
| 33 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
34 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 34 |
import com.spice.profitmandi.dao.entity.fofo.FofoStoreSequenceGeneration;
|
35 |
import com.spice.profitmandi.dao.entity.fofo.FofoStoreSequenceGeneration;
|
| - |
|
36 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
| 35 |
import com.spice.profitmandi.dao.entity.user.Address;
|
37 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 36 |
import com.spice.profitmandi.dao.entity.user.Cart;
|
38 |
import com.spice.profitmandi.dao.entity.user.Cart;
|
| 37 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
39 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
| 38 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
40 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
| 39 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUserAddressMapping;
|
41 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUserAddressMapping;
|
| 40 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
42 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
| 41 |
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
|
43 |
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
|
| 42 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
44 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
| - |
|
45 |
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
|
| 43 |
import com.spice.profitmandi.dao.repository.dtr.DistrictMasterRepository;
|
46 |
import com.spice.profitmandi.dao.repository.dtr.DistrictMasterRepository;
|
| 44 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
47 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 45 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
48 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 46 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreSequenceGenerationRepository;
|
49 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreSequenceGenerationRepository;
|
| 47 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| Line 49... |
Line 52... |
| 49 |
import com.spice.profitmandi.dao.repository.dtr.ShopAddressRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.ShopAddressRepository;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
53 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
| 51 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
54 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 52 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
55 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
| 53 |
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
|
56 |
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
|
| - |
|
57 |
import com.spice.profitmandi.dao.repository.fofo.FofoPartnerPaymentOptionRepository;
|
| - |
|
58 |
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
|
| 54 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
59 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 55 |
import com.spice.profitmandi.dao.repository.user.CartRepository;
|
60 |
import com.spice.profitmandi.dao.repository.user.CartRepository;
|
| 56 |
import com.spice.profitmandi.dao.repository.user.CounterRepository;
|
61 |
import com.spice.profitmandi.dao.repository.user.CounterRepository;
|
| 57 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserAddressMappingRepository;
|
62 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserAddressMappingRepository;
|
| 58 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
|
63 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
|
| Line 115... |
Line 120... |
| 115 |
private FofoStoreRepository fofoStoreRepository;
|
120 |
private FofoStoreRepository fofoStoreRepository;
|
| 116 |
|
121 |
|
| 117 |
@Autowired
|
122 |
@Autowired
|
| 118 |
private FofoStoreSequenceGenerationRepository fofoStoreSequenceGenerationRepository;
|
123 |
private FofoStoreSequenceGenerationRepository fofoStoreSequenceGenerationRepository;
|
| 119 |
|
124 |
|
| - |
|
125 |
@Autowired
|
| - |
|
126 |
private PaymentOptionRepository paymentOptionRepository;
|
| - |
|
127 |
|
| - |
|
128 |
@Autowired
|
| - |
|
129 |
private FofoPartnerPaymentOptionRepository fofoPartnerPaymentOptionRepository;
|
| - |
|
130 |
|
| - |
|
131 |
|
| 120 |
@Override
|
132 |
@Override
|
| 121 |
public Map<String, Object> getByEmailIdOrMobileNumber(String emailIdOrMobileNumber)
|
133 |
public Map<String, Object> getByEmailIdOrMobileNumber(String emailIdOrMobileNumber)
|
| 122 |
throws ProfitMandiBusinessException {
|
134 |
throws ProfitMandiBusinessException {
|
| 123 |
User user = null;
|
135 |
User user = null;
|
| 124 |
try{
|
136 |
try{
|
| Line 250... |
Line 262... |
| 250 |
if(updateRetailerRequest.isFofo()){
|
262 |
if(updateRetailerRequest.isFofo()){
|
| 251 |
userRoles = this.addRole(userRoles, user.getId(), RoleType.FOFO);
|
263 |
userRoles = this.addRole(userRoles, user.getId(), RoleType.FOFO);
|
| 252 |
}
|
264 |
}
|
| 253 |
|
265 |
|
| 254 |
if(this.containsRoleType(userRoles, RoleType.FOFO)){
|
266 |
if(this.containsRoleType(userRoles, RoleType.FOFO)){
|
| 255 |
|
- |
|
| - |
|
267 |
this.createDefaultPaymentOption(retailer.getId());
|
| 256 |
}
|
268 |
}
|
| 257 |
|
269 |
|
| 258 |
map.put("userRoles", userRoles);
|
270 |
map.put("userRoles", userRoles);
|
| 259 |
map.put("userRoleNames", this.toString(userRoles));
|
271 |
map.put("userRoleNames", this.toString(userRoles));
|
| 260 |
|
272 |
|
| Line 277... |
Line 289... |
| 277 |
}
|
289 |
}
|
| 278 |
this.updateRetailerShops(shops, updateRetailerRequest.getShops(), retailer.getId(), retailerAddress);
|
290 |
this.updateRetailerShops(shops, updateRetailerRequest.getShops(), retailer.getId(), retailerAddress);
|
| 279 |
return map;
|
291 |
return map;
|
| 280 |
}
|
292 |
}
|
| 281 |
|
293 |
|
| - |
|
294 |
private void createDefaultPaymentOption(int fofoId){
|
| - |
|
295 |
List<Integer> paymentOptionIds = fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(fofoId);
|
| - |
|
296 |
if(paymentOptionIds.isEmpty()){
|
| - |
|
297 |
PaymentOption paymentOption = null;
|
| - |
|
298 |
try{
|
| - |
|
299 |
paymentOption = paymentOptionRepository.selectByName(PaymentOptionType.CASH.toString());
|
| - |
|
300 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| - |
|
301 |
paymentOption = new PaymentOption();
|
| - |
|
302 |
paymentOption.setName(PaymentOptionType.CASH.toString());
|
| - |
|
303 |
paymentOptionRepository.persist(paymentOption);
|
| - |
|
304 |
}
|
| - |
|
305 |
FofoPartnerPaymentOption fofoPartnerPaymentOption = new FofoPartnerPaymentOption();
|
| - |
|
306 |
fofoPartnerPaymentOption.setFofoId(fofoId);
|
| - |
|
307 |
fofoPartnerPaymentOption.setPaymentOptionId(paymentOption.getId());
|
| - |
|
308 |
fofoPartnerPaymentOptionRepository.persist(fofoPartnerPaymentOption);
|
| - |
|
309 |
}
|
| - |
|
310 |
}
|
| - |
|
311 |
|
| 282 |
private User createUser(User user, UpdateRetailerRequest updateRetailerRequest){
|
312 |
private User createUser(User user, UpdateRetailerRequest updateRetailerRequest){
|
| 283 |
if(user == null){
|
313 |
if(user == null){
|
| 284 |
user = new User();
|
314 |
user = new User();
|
| 285 |
user.setCity("");
|
315 |
user.setCity("");
|
| 286 |
user.setPinCode(0);
|
316 |
user.setPinCode(0);
|