| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.util.Date;
|
3 |
import java.util.Date;
|
| - |
|
4 |
import java.util.List;
|
| 4 |
import java.util.Set;
|
5 |
import java.util.Set;
|
| 5 |
|
6 |
|
| 6 |
import javax.servlet.http.HttpServletRequest;
|
7 |
import javax.servlet.http.HttpServletRequest;
|
| 7 |
|
8 |
|
| 8 |
import org.slf4j.Logger;
|
9 |
import org.slf4j.Logger;
|
| Line 377... |
Line 378... |
| 377 |
public ResponseEntity<?> createFofoStore(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DISTRICT_NAME) String districtName) throws ProfitMandiBusinessException, Exception{
|
378 |
public ResponseEntity<?> createFofoStore(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DISTRICT_NAME) String districtName) throws ProfitMandiBusinessException, Exception{
|
| 378 |
try{
|
379 |
try{
|
| 379 |
UserInfo userInfo = (UserInfo)request.getAttribute("userInfo");
|
380 |
UserInfo userInfo = (UserInfo)request.getAttribute("userInfo");
|
| 380 |
LOGGER.info("requestAttribute [userInfo={}]", userInfo);
|
381 |
LOGGER.info("requestAttribute [userInfo={}]", userInfo);
|
| 381 |
User user = userRepository.selectById(userInfo.getUserId());
|
382 |
User user = userRepository.selectById(userInfo.getUserId());
|
| 382 |
// = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
383 |
List<RoleType> roleTypes = userRoleRepository.selectRoleTypesByUserId(user.getId());
|
| - |
|
384 |
|
| 383 |
UserAccounts userAccounts = userAccountRepository.selectSaholicByUserId(user.getId());
|
385 |
UserAccounts userAccounts = userAccountRepository.selectSaholicByUserId(user.getId());
|
| 384 |
Retailer retailer = retailerRepository.selectById(Integer.parseInt(userAccounts.getAccount_key()));
|
- |
|
| 385 |
//TODO: Ashik fix it
|
386 |
|
| 386 |
/*if(!retailer.isFofo()){
|
387 |
if(!roleTypes.contains(RoleType.FOFO)){
|
| 387 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.USER_ID, user.getId(), "USR_1013");
|
388 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.USER_ID, user.getId(), "USR_1013");
|
| 388 |
}*/
|
389 |
}
|
| - |
|
390 |
|
| 389 |
boolean foundFofoStore = false;
|
391 |
boolean foundFofoStore = false;
|
| - |
|
392 |
Retailer retailer = retailerRepository.selectById(Integer.parseInt(userAccounts.getAccount_key()));
|
| 390 |
try{
|
393 |
try{
|
| 391 |
fofoStoreRepository.selectByRetailerId(retailer.getId());
|
394 |
fofoStoreRepository.selectByRetailerId(retailer.getId());
|
| 392 |
foundFofoStore = true;
|
395 |
foundFofoStore = true;
|
| 393 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
396 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 394 |
|
397 |
|