Subversion Repositories SmartDukaan

Rev

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

Rev 22173 Rev 22568
Line 29... Line 29...
29
import com.spice.profitmandi.common.model.ProfitMandiResponse;
29
import com.spice.profitmandi.common.model.ProfitMandiResponse;
30
import com.spice.profitmandi.common.model.ResponseStatus;
30
import com.spice.profitmandi.common.model.ResponseStatus;
31
import com.spice.profitmandi.common.web.util.ResponseSender;
31
import com.spice.profitmandi.common.web.util.ResponseSender;
32
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
32
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
33
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
33
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
-
 
34
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
34
import com.spice.profitmandi.dao.model.ProductPojo;
35
import com.spice.profitmandi.dao.model.ProductPojo;
35
import com.spice.profitmandi.dao.model.UserCart;
36
import com.spice.profitmandi.dao.model.UserCart;
36
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
37
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
-
 
38
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
37
import com.spice.profitmandi.dao.util.ContentPojoPopulator;
39
import com.spice.profitmandi.dao.util.ContentPojoPopulator;
38
import com.spice.profitmandi.dao.util.LogisticsService;
40
import com.spice.profitmandi.dao.util.LogisticsService;
39
import com.spice.profitmandi.thrift.clients.UserClient;
41
import com.spice.profitmandi.thrift.clients.UserClient;
40
import com.spice.profitmandi.web.req.AddCartRequest;
42
import com.spice.profitmandi.web.req.AddCartRequest;
41
import com.spice.profitmandi.web.req.CartItems;
43
import com.spice.profitmandi.web.req.CartItems;
Line 61... Line 63...
61
 
63
 
62
	@Autowired
64
	@Autowired
63
	UserAccountRepository userAccountRepository;
65
	UserAccountRepository userAccountRepository;
64
	
66
	
65
	@Autowired
67
	@Autowired
-
 
68
	UserRoleRepository userRoleRepository;
-
 
69
	
-
 
70
	@Autowired
66
	ContentPojoPopulator contentPojoPopulator;
71
	ContentPojoPopulator contentPojoPopulator;
67
	
72
	
68
 
73
 
69
	@RequestMapping(value = ProfitMandiConstants.URL_CART, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
74
	@RequestMapping(value = ProfitMandiConstants.URL_CART, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
70
	@ApiImplicitParams({
75
	@ApiImplicitParams({
Line 96... Line 101...
96
			vc = new ValidateCartResponse(null, "Error","Problem occurred while updating cart");
101
			vc = new ValidateCartResponse(null, "Error","Problem occurred while updating cart");
97
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, vc);
102
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, vc);
98
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
103
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
99
		}
104
		}
100
		String cartString=null;
105
		String cartString=null;
-
 
106
		//Use source id temporarily for purpose of tag id as it is just one lets hardcode the tag id
-
 
107
		int source = -1;
-
 
108
		if(userRoleRepository.selectRoleTypesByUserId(userId).contains(RoleType.FOFO)) {
-
 
109
			source = 53;
-
 
110
		}
101
		cartString = userClient.validateCartNew(Integer.valueOf(userAccount.getAccount_key()), pincode, -1);
111
		cartString = userClient.validateCartNew(Integer.valueOf(userAccount.getAccount_key()), pincode, source);
102
		JSONObject cartObj = new JSONObject(cartString);
112
		JSONObject cartObj = new JSONObject(cartString);
103
		JSONArray arr = cartObj.getJSONArray("cartItems");
113
		JSONArray arr = cartObj.getJSONArray("cartItems");
104
		int maxEstimate=-2;
114
		int maxEstimate=-2;
105
		boolean allSame=true;
115
		boolean allSame=true;
106
		int removedCount = 0;
116
		int removedCount = 0;