| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDateTime;
|
- |
|
| 4 |
|
- |
|
| 5 |
import javax.servlet.http.HttpServletRequest;
|
3 |
import javax.servlet.http.HttpServletRequest;
|
| 6 |
|
4 |
|
| 7 |
import org.slf4j.Logger;
|
5 |
import org.slf4j.Logger;
|
| 8 |
import org.slf4j.LoggerFactory;
|
6 |
import org.slf4j.LoggerFactory;
|
| 9 |
import org.springframework.beans.factory.annotation.Autowired;
|
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 10 |
import org.springframework.http.HttpStatus;
|
- |
|
| 11 |
import org.springframework.http.ResponseEntity;
|
8 |
import org.springframework.http.ResponseEntity;
|
| 12 |
import org.springframework.stereotype.Controller;
|
9 |
import org.springframework.stereotype.Controller;
|
| - |
|
10 |
import org.springframework.transaction.annotation.Transactional;
|
| 13 |
import org.springframework.web.bind.annotation.RequestBody;
|
11 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 14 |
import org.springframework.web.bind.annotation.RequestMapping;
|
12 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 15 |
import org.springframework.web.bind.annotation.RequestMethod;
|
13 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 16 |
import org.springframework.web.bind.annotation.RequestParam;
|
14 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 17 |
|
15 |
|
| Line 33... |
Line 31... |
| 33 |
import com.spice.profitmandi.dao.repository.RetailerBrandRepository;
|
31 |
import com.spice.profitmandi.dao.repository.RetailerBrandRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.RetailerRegisteredAddressRepository;
|
32 |
import com.spice.profitmandi.dao.repository.RetailerRegisteredAddressRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.RetailerRepository;
|
33 |
import com.spice.profitmandi.dao.repository.RetailerRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.ShopAddressRepository;
|
34 |
import com.spice.profitmandi.dao.repository.ShopAddressRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.ShopRepository;
|
35 |
import com.spice.profitmandi.dao.repository.ShopRepository;
|
| 38 |
import com.spice.profitmandi.web.model.ProfitMandiResponse;
|
- |
|
| 39 |
import com.spice.profitmandi.web.model.Response;
|
- |
|
| 40 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
- |
|
| 41 |
import com.spice.profitmandi.web.req.Category;
|
36 |
import com.spice.profitmandi.web.req.Category;
|
| 42 |
import com.spice.profitmandi.web.req.CreateRetailerAddressRequest;
|
37 |
import com.spice.profitmandi.web.req.CreateRetailerAddressRequest;
|
| 43 |
import com.spice.profitmandi.web.req.CreateRetailerRequest;
|
38 |
import com.spice.profitmandi.web.req.CreateRetailerRequest;
|
| 44 |
import com.spice.profitmandi.web.req.RetailerAddBrandRequest;
|
39 |
import com.spice.profitmandi.web.req.RetailerAddBrandRequest;
|
| - |
|
40 |
import com.spice.profitmandi.web.util.ResponseSender;
|
| 45 |
|
41 |
|
| 46 |
import io.swagger.annotations.ApiImplicitParam;
|
42 |
import io.swagger.annotations.ApiImplicitParam;
|
| 47 |
import io.swagger.annotations.ApiImplicitParams;
|
43 |
import io.swagger.annotations.ApiImplicitParams;
|
| 48 |
import io.swagger.annotations.ApiOperation;
|
44 |
import io.swagger.annotations.ApiOperation;
|
| 49 |
|
45 |
|
| Line 51... |
Line 47... |
| 51 |
public class RetailerController {
|
47 |
public class RetailerController {
|
| 52 |
|
48 |
|
| 53 |
private static final Logger LOGGER=LoggerFactory.getLogger(RetailerController.class);
|
49 |
private static final Logger LOGGER=LoggerFactory.getLogger(RetailerController.class);
|
| 54 |
|
50 |
|
| 55 |
@Autowired
|
51 |
@Autowired
|
| - |
|
52 |
ResponseSender<?> responseSender;
|
| - |
|
53 |
|
| - |
|
54 |
@Autowired
|
| 56 |
RetailerRepository retailerRepository;
|
55 |
RetailerRepository retailerRepository;
|
| 57 |
|
56 |
|
| 58 |
@Autowired
|
57 |
@Autowired
|
| 59 |
BrandRepository brandRepository;
|
58 |
BrandRepository brandRepository;
|
| 60 |
|
59 |
|
| Line 86... |
Line 85... |
| 86 |
|
85 |
|
| 87 |
@ApiOperation(value = "Create Retailer")
|
86 |
@ApiOperation(value = "Create Retailer")
|
| 88 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER, method=RequestMethod.POST)
|
87 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER, method=RequestMethod.POST)
|
| 89 |
public ResponseEntity<?> createRetailer(HttpServletRequest request, @RequestBody CreateRetailerRequest createRetailerRequest){
|
88 |
public ResponseEntity<?> createRetailer(HttpServletRequest request, @RequestBody CreateRetailerRequest createRetailerRequest){
|
| 90 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
89 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| - |
|
90 |
try{
|
| - |
|
91 |
this.createRetailer(createRetailerRequest);
|
| - |
|
92 |
return responseSender.ok(ResponseCodeHolder.getMessage("RTLR_OK_1000"));
|
| - |
|
93 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| - |
|
94 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| - |
|
95 |
return responseSender.badRequest(profitMandiBusinessException);
|
| - |
|
96 |
}
|
| - |
|
97 |
}
|
| - |
|
98 |
|
| - |
|
99 |
@Transactional
|
| - |
|
100 |
private void createRetailer(CreateRetailerRequest createRetailerRequest)
|
| - |
|
101 |
throws ProfitMandiBusinessException{
|
| 91 |
Retailer retailer = new Retailer();
|
102 |
Retailer retailer = new Retailer();
|
| 92 |
retailer.setName(createRetailerRequest.getName());
|
103 |
retailer.setName(createRetailerRequest.getName());
|
| 93 |
retailer.setNumber(createRetailerRequest.getNumber());
|
104 |
retailer.setNumber(createRetailerRequest.getNumber());
|
| 94 |
retailer.setType(createRetailerRequest.getType());
|
105 |
retailer.setType(createRetailerRequest.getType());
|
| 95 |
retailer.setMonthlySaleValue(createRetailerRequest.getMonthlySaleValue());
|
106 |
retailer.setMonthlySaleValue(createRetailerRequest.getMonthlySaleValue());
|
| Line 97... |
Line 108... |
| 97 |
retailer.setRecharge(createRetailerRequest.getLineOfBusiness().isRecharge());
|
108 |
retailer.setRecharge(createRetailerRequest.getLineOfBusiness().isRecharge());
|
| 98 |
retailer.setMobile(createRetailerRequest.getLineOfBusiness().isMobile());
|
109 |
retailer.setMobile(createRetailerRequest.getLineOfBusiness().isMobile());
|
| 99 |
retailer.setAccessories(createRetailerRequest.getLineOfBusiness().isAccessories());
|
110 |
retailer.setAccessories(createRetailerRequest.getLineOfBusiness().isAccessories());
|
| 100 |
retailer.setOther1(createRetailerRequest.getLineOfBusiness().getOther1());
|
111 |
retailer.setOther1(createRetailerRequest.getLineOfBusiness().getOther1());
|
| 101 |
retailer.setOther2(createRetailerRequest.getLineOfBusiness().getOther2());
|
112 |
retailer.setOther2(createRetailerRequest.getLineOfBusiness().getOther2());
|
| 102 |
//Set<String> brandNames = createRetailerRequest.getBrandNames();
|
- |
|
| 103 |
|
- |
|
| 104 |
try {
|
- |
|
| 105 |
|
- |
|
| 106 |
Document retailerDocument = documentRepository.selectById(createRetailerRequest.getDocumentId());
|
113 |
Document retailerDocument = documentRepository.selectById(createRetailerRequest.getDocumentId());
|
| 107 |
if(retailerRepository.isExistByDocumentId(retailerDocument.getId())){
|
114 |
if(retailerRepository.isExistByDocumentId(retailerDocument.getId())){
|
| 108 |
LOGGER.error("documet is already mapped with another retailer");
|
115 |
LOGGER.error("documet is already mapped with another retailer");
|
| 109 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, retailerDocument.getId(), "");
|
116 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, retailerDocument.getId(), "");
|
| 110 |
}
|
117 |
}
|
| 111 |
retailer.setDocumentId(retailerDocument.getId());
|
118 |
retailer.setDocumentId(retailerDocument.getId());
|
| 112 |
retailerRepository.persist(retailer);
|
- |
|
| 113 |
final Document shopDocument = documentRepository.selectById(createRetailerRequest.getShop().getDocumentId());
|
119 |
final Document shopDocument = documentRepository.selectById(createRetailerRequest.getShop().getDocumentId());
|
| 114 |
if(shopRepository.isExistByDocumentId(shopDocument.getId())){
|
120 |
if(shopRepository.isExistByDocumentId(shopDocument.getId())){
|
| 115 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, shopDocument.getId(), "");
|
121 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, shopDocument.getId(), "");
|
| 116 |
}
|
122 |
}
|
| - |
|
123 |
retailerRepository.persist(retailer);
|
| 117 |
Shop shop = new Shop();
|
124 |
Shop shop = new Shop();
|
| 118 |
shop.setName(createRetailerRequest.getShop().getName());
|
125 |
shop.setName(createRetailerRequest.getShop().getName());
|
| 119 |
shop.setDocumentId(shopDocument.getId());
|
126 |
shop.setDocumentId(shopDocument.getId());
|
| 120 |
shop.setRetailerId(retailer.getId());
|
127 |
shop.setRetailerId(retailer.getId());
|
| 121 |
try{
|
- |
|
| 122 |
shopRepository.persist(shop);
|
128 |
shopRepository.persist(shop);
|
| 123 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
- |
|
| 124 |
|
- |
|
| 125 |
}
|
- |
|
| 126 |
for(Category category : createRetailerRequest.getCategories()){
|
129 |
for(Category category : createRetailerRequest.getCategories()){
|
| 127 |
for(com.spice.profitmandi.web.req.Brand brandModel : category.getBrands()){
|
130 |
for(com.spice.profitmandi.web.req.Brand brandModel : category.getBrands()){
|
| 128 |
Brand brand = brandRepository.selectByIdAndName(brandModel.getId(), brandModel.getName());
|
131 |
Brand brand = brandRepository.selectByIdAndName(brandModel.getId(), brandModel.getName());
|
| 129 |
final RetailerBrand retailerBrand = new RetailerBrand();
|
132 |
final RetailerBrand retailerBrand = new RetailerBrand();
|
| 130 |
retailerBrand.setRetailerId(retailer.getId());
|
133 |
retailerBrand.setRetailerId(retailer.getId());
|
| 131 |
retailerBrand.setBrandId(brand.getId());
|
134 |
retailerBrand.setBrandId(brand.getId());
|
| 132 |
retailerBrandRepository.persist(retailerBrand);
|
135 |
retailerBrandRepository.persist(retailerBrand);
|
| 133 |
}
|
- |
|
| 134 |
}
|
- |
|
| 135 |
final Address addressRetailer = this.createAddress(createRetailerRequest.getAddress());
|
- |
|
| 136 |
|
- |
|
| 137 |
if(!addressRepository.isExist(addressRetailer)){
|
- |
|
| 138 |
addressRepository.persist(addressRetailer);
|
- |
|
| 139 |
}
|
- |
|
| 140 |
final RetailerRegisteredAddress retailerRegisteredAddress = new RetailerRegisteredAddress();
|
- |
|
| 141 |
retailerRegisteredAddress.setRetailerId(retailer.getId());
|
- |
|
| 142 |
retailerRegisteredAddress.setAddressId(addressRetailer.getId());
|
- |
|
| 143 |
try{
|
- |
|
| 144 |
retailerRegisteredAddressRepository.persist(retailerRegisteredAddress);
|
- |
|
| 145 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
- |
|
| 146 |
|
- |
|
| 147 |
}
|
136 |
}
|
| - |
|
137 |
}
|
| - |
|
138 |
final Address addressRetailer = this.createAddress(createRetailerRequest.getAddress());
|
| 148 |
|
139 |
|
| 149 |
final Address addressShop = this.createAddress(createRetailerRequest.getShop().getAddress());
|
- |
|
| 150 |
if(!addressRepository.isExist(addressShop)){
|
140 |
if(!addressRepository.isExist(addressRetailer)){
|
| 151 |
addressRepository.persist(addressShop);
|
141 |
addressRepository.persist(addressRetailer);
|
| 152 |
ShopAddress shopAddress = new ShopAddress();
|
- |
|
| 153 |
shopAddress.setShopId(shop.getId());
|
- |
|
| 154 |
shopAddress.setAddressId(addressShop.getId());
|
- |
|
| 155 |
try{
|
- |
|
| 156 |
shopAddressRepository.persist(shopAddress);
|
- |
|
| 157 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
- |
|
| 158 |
|
- |
|
| 159 |
}
|
- |
|
| 160 |
}
|
- |
|
| 161 |
ShopAddress shopAddress = new ShopAddress();
|
- |
|
| 162 |
shopAddress.setShopId(shop.getId());
|
- |
|
| 163 |
shopAddress.setAddressId(addressShop.getId());
|
- |
|
| 164 |
try{
|
- |
|
| 165 |
shopAddressRepository.persist(shopAddress);
|
- |
|
| 166 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
- |
|
| 167 |
|
- |
|
| 168 |
}
|
- |
|
| 169 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("RTLR_OK_1000"));
|
- |
|
| 170 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
- |
|
| 171 |
}catch (ProfitMandiBusinessException pmbe) {
|
- |
|
| 172 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
- |
|
| 173 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 174 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 175 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
- |
|
| 176 |
}
|
142 |
}
|
| - |
|
143 |
final RetailerRegisteredAddress retailerRegisteredAddress = new RetailerRegisteredAddress();
|
| - |
|
144 |
retailerRegisteredAddress.setRetailerId(retailer.getId());
|
| - |
|
145 |
retailerRegisteredAddress.setAddressId(addressRetailer.getId());
|
| - |
|
146 |
retailerRegisteredAddressRepository.persist(retailerRegisteredAddress);
|
| - |
|
147 |
final Address addressShop = this.createAddress(createRetailerRequest.getShop().getAddress());
|
| - |
|
148 |
if(!addressRepository.isExist(addressShop)){
|
| - |
|
149 |
addressRepository.persist(addressShop);
|
| - |
|
150 |
}
|
| - |
|
151 |
ShopAddress shopAddress = new ShopAddress();
|
| - |
|
152 |
shopAddress.setShopId(shop.getId());
|
| - |
|
153 |
shopAddress.setAddressId(addressShop.getId());
|
| - |
|
154 |
shopAddressRepository.persist(shopAddress);
|
| 177 |
}
|
155 |
}
|
| 178 |
|
156 |
|
| 179 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ALL,method=RequestMethod.GET)
|
157 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ALL,method=RequestMethod.GET)
|
| 180 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
158 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
| 181 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
159 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 182 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, retailerRepository.selectAll());
|
- |
|
| 183 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
160 |
return responseSender.ok(retailerRepository.selectAll());
|
| 184 |
}
|
161 |
}
|
| 185 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ID, method=RequestMethod.GET)
|
162 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ID, method=RequestMethod.GET)
|
| 186 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
163 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 187 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
164 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 188 |
try {
|
165 |
try {
|
| 189 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, retailerRepository.selectById(id));
|
- |
|
| 190 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
166 |
return responseSender.ok(retailerRepository.selectById(id));
|
| 191 |
}catch (ProfitMandiBusinessException pmbe) {
|
167 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 192 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
168 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 193 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 194 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 195 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
169 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 196 |
}
|
170 |
}
|
| 197 |
}
|
171 |
}
|
| 198 |
|
172 |
|
| 199 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_NAME, method=RequestMethod.GET)
|
173 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_NAME, method=RequestMethod.GET)
|
| 200 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
174 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
| 201 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
175 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 202 |
try {
|
176 |
try {
|
| 203 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, retailerRepository.selectByName(name));
|
- |
|
| 204 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
177 |
return responseSender.ok(retailerRepository.selectByName(name));
|
| 205 |
}catch (ProfitMandiBusinessException pmbe) {
|
178 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 206 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
179 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 207 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 208 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 209 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
180 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 210 |
}
|
181 |
}
|
| 211 |
}
|
182 |
}
|
| 212 |
|
183 |
|
| 213 |
|
184 |
|
| 214 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ID,method=RequestMethod.DELETE)
|
185 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ID,method=RequestMethod.DELETE)
|
| 215 |
public ResponseEntity<?> removeById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
186 |
public ResponseEntity<?> removeById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 216 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
187 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 217 |
try {
|
188 |
try {
|
| 218 |
retailerRepository.deleteById(id);
|
189 |
retailerRepository.deleteById(id);
|
| 219 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 220 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
190 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 221 |
}catch (ProfitMandiBusinessException pmbe) {
|
191 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 222 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
192 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 223 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 224 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 225 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
193 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 226 |
}
|
194 |
}
|
| 227 |
}
|
195 |
}
|
| 228 |
|
196 |
|
| - |
|
197 |
@Transactional
|
| 229 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_ADD, method=RequestMethod.POST)
|
198 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_ADD, method=RequestMethod.POST)
|
| 230 |
public ResponseEntity<?> addShop(HttpServletRequest request, @RequestBody com.spice.profitmandi.web.req.Shop createShop, @RequestParam(name = "retailerId") int retailerId){
|
199 |
public ResponseEntity<?> addShop(HttpServletRequest request, @RequestBody com.spice.profitmandi.web.req.Shop createShop, @RequestParam(name = "retailerId") int retailerId){
|
| 231 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
200 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 232 |
try {
|
201 |
try {
|
| 233 |
Document document = documentRepository.selectById(createShop.getDocumentId());
|
202 |
Document document = documentRepository.selectById(createShop.getDocumentId());
|
| Line 245... |
Line 214... |
| 245 |
shopRepository.persist(shop);
|
214 |
shopRepository.persist(shop);
|
| 246 |
ShopAddress shopAddress = new ShopAddress();
|
215 |
ShopAddress shopAddress = new ShopAddress();
|
| 247 |
shopAddress.setAddressId(address.getId());
|
216 |
shopAddress.setAddressId(address.getId());
|
| 248 |
shopAddress.setShopId(shop.getId());
|
217 |
shopAddress.setShopId(shop.getId());
|
| 249 |
shopAddressRepository.persist(shopAddress);
|
218 |
shopAddressRepository.persist(shopAddress);
|
| 250 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 251 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
219 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 252 |
}catch (ProfitMandiBusinessException pmbe) {
|
220 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 253 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
221 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 254 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 255 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 256 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
222 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 257 |
}
|
223 |
}
|
| 258 |
}
|
224 |
}
|
| 259 |
|
225 |
|
| 260 |
|
226 |
|
| 261 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_REMOVE, method=RequestMethod.DELETE)
|
227 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_REMOVE, method=RequestMethod.DELETE)
|
| 262 |
public ResponseEntity<?> removeShop(HttpServletRequest request, @RequestParam(name = "shopId") int shopId, @RequestParam(name = "retailerId") int retailerId){
|
228 |
public ResponseEntity<?> removeShop(HttpServletRequest request, @RequestParam(name = "shopId") int shopId, @RequestParam(name = "retailerId") int retailerId){
|
| 263 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
229 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 264 |
try {
|
230 |
try {
|
| 265 |
retailerRepository.removeShop(shopId, retailerId);
|
231 |
retailerRepository.removeShop(shopId, retailerId);
|
| 266 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 267 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
232 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 268 |
}catch (ProfitMandiBusinessException pmbe) {
|
233 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 269 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
234 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 270 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 271 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 272 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
235 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 273 |
}
|
236 |
}
|
| 274 |
}
|
237 |
}
|
| 275 |
|
238 |
|
| 276 |
private Address createAddress(com.spice.profitmandi.web.req.Address createAddress){
|
239 |
private Address createAddress(com.spice.profitmandi.web.req.Address createAddress){
|
| 277 |
Address address = new Address();
|
240 |
Address address = new Address();
|
| Line 284... |
Line 247... |
| 284 |
address.setPinCode(createAddress.getPinCode());
|
247 |
address.setPinCode(createAddress.getPinCode());
|
| 285 |
address.setCountry(createAddress.getCountry());
|
248 |
address.setCountry(createAddress.getCountry());
|
| 286 |
address.setPhoneNumber(createAddress.getPhoneNumber());
|
249 |
address.setPhoneNumber(createAddress.getPhoneNumber());
|
| 287 |
return address;
|
250 |
return address;
|
| 288 |
}
|
251 |
}
|
| - |
|
252 |
|
| 289 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_ADD, method=RequestMethod.POST)
|
253 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_ADD, method=RequestMethod.POST)
|
| 290 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CreateRetailerAddressRequest createRetailerAddress){
|
254 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CreateRetailerAddressRequest createRetailerAddress){
|
| 291 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
255 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 292 |
try {
|
256 |
try {
|
| 293 |
retailerRepository.addAddress(this.createAddress(createRetailerAddress.getAddress()), createRetailerAddress.getRetailerId());
|
257 |
retailerRepository.addAddress(this.createAddress(createRetailerAddress.getAddress()), createRetailerAddress.getRetailerId());
|
| 294 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 295 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
258 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 296 |
}catch (ProfitMandiBusinessException pmbe) {
|
259 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 297 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
260 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 298 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 299 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 300 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
261 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 301 |
}
|
262 |
}
|
| 302 |
}
|
263 |
}
|
| 303 |
|
264 |
|
| 304 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_REMOVE, method=RequestMethod.DELETE)
|
265 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_REMOVE, method=RequestMethod.DELETE)
|
| 305 |
public ResponseEntity<?> removeAddress(HttpServletRequest request, @RequestParam(name = "addressId") int addressId, @RequestParam(name = "retailerId") int retailerId){
|
266 |
public ResponseEntity<?> removeAddress(HttpServletRequest request, @RequestParam(name = "addressId") int addressId, @RequestParam(name = "retailerId") int retailerId){
|
| 306 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
267 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 307 |
try {
|
268 |
try {
|
| 308 |
retailerRepository.removeAddress(addressId, retailerId);
|
269 |
retailerRepository.removeAddress(addressId, retailerId);
|
| 309 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 310 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
270 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 311 |
}catch (ProfitMandiBusinessException pmbe) {
|
271 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 312 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
272 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 313 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 314 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 315 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
273 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 316 |
}
|
274 |
}
|
| 317 |
}
|
275 |
}
|
| 318 |
|
276 |
|
| 319 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_ADD, method=RequestMethod.POST)
|
277 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_ADD, method=RequestMethod.POST)
|
| 320 |
public ResponseEntity<?> addBrand(HttpServletRequest request, @RequestBody RetailerAddBrandRequest retailerAddBrandRequest){
|
278 |
public ResponseEntity<?> addBrand(HttpServletRequest request, @RequestBody RetailerAddBrandRequest retailerAddBrandRequest){
|
| 321 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
279 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 322 |
try {
|
280 |
try {
|
| 323 |
Retailer retailer = retailerRepository.selectById(retailerAddBrandRequest.getRetailerId());
|
281 |
Retailer retailer = retailerRepository.selectById(retailerAddBrandRequest.getRetailerId());
|
| 324 |
for(String brandName : retailerAddBrandRequest.getBrandNames()){
|
282 |
for(String brandName : retailerAddBrandRequest.getBrandNames()){
|
| 325 |
Brand brand = null;
|
- |
|
| 326 |
try{
|
- |
|
| 327 |
brand = brandRepository.selectByName(brandName);
|
283 |
Brand brand = brandRepository.selectByName(brandName);
|
| 328 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
- |
|
| 329 |
brand = new Brand();
|
- |
|
| 330 |
brand.setName(brandName);
|
- |
|
| 331 |
brandRepository.persist(brand);
|
- |
|
| 332 |
}
|
- |
|
| 333 |
RetailerBrand retailerBrand = new RetailerBrand();
|
284 |
RetailerBrand retailerBrand = new RetailerBrand();
|
| 334 |
retailerBrand.setBrandId(brand.getId());
|
285 |
retailerBrand.setBrandId(brand.getId());
|
| 335 |
retailerBrand.setRetailerId(retailer.getId());
|
286 |
retailerBrand.setRetailerId(retailer.getId());
|
| 336 |
}
|
287 |
}
|
| 337 |
//retailerRepository.addAddress(this.createAddress(createRetailerAddress.getAddress()), createRetailerAddress.getRetailerId());
|
- |
|
| 338 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 339 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
288 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 340 |
}catch (ProfitMandiBusinessException pmbe) {
|
289 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 341 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
290 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 342 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 343 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 344 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
291 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 345 |
}
|
292 |
}
|
| 346 |
}
|
293 |
}
|
| 347 |
|
294 |
|
| 348 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_REMOVE, method=RequestMethod.DELETE)
|
295 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_REMOVE, method=RequestMethod.DELETE)
|
| 349 |
public ResponseEntity<?> removeBrand(HttpServletRequest request, @RequestParam(name = "brandId") int brandId, @RequestParam(name = "retailerId") int retailerId){
|
296 |
public ResponseEntity<?> removeBrand(HttpServletRequest request, @RequestParam(name = "brandId") int brandId, @RequestParam(name = "retailerId") int retailerId){
|
| 350 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
297 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 351 |
try {
|
298 |
try {
|
| 352 |
brandRepository.selectById(brandId);
|
299 |
brandRepository.selectById(brandId);
|
| 353 |
retailerRepository.selectById(retailerId);
|
300 |
retailerRepository.selectById(retailerId);
|
| 354 |
retailerBrandRepository.deleteByRetailerId(retailerId, brandId);
|
301 |
retailerBrandRepository.deleteByRetailerId(retailerId, brandId);
|
| 355 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
- |
|
| 356 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
302 |
return responseSender.ok(ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 357 |
}catch (ProfitMandiBusinessException pmbe) {
|
303 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 358 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
304 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 359 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 360 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 361 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
305 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 362 |
}
|
306 |
}
|
| 363 |
}
|
307 |
}
|
| 364 |
|
308 |
|
| 365 |
|
309 |
|
| 366 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_DOCUMENT_DOCUMENT_ID, method=RequestMethod.GET)
|
310 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_DOCUMENT_DOCUMENT_ID, method=RequestMethod.GET)
|
| 367 |
public ResponseEntity<?> getDocumentById(HttpServletRequest request, @RequestParam(name = "document") int documentId){
|
311 |
public ResponseEntity<?> getDocumentById(HttpServletRequest request, @RequestParam(name = "document") int documentId){
|
| 368 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
312 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 369 |
try {
|
313 |
try {
|
| 370 |
retailerRepository.selectByDocumentId(documentId);
|
314 |
retailerRepository.selectByDocumentId(documentId);
|
| 371 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, documentRepository.selectById(documentId));
|
- |
|
| 372 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
315 |
return responseSender.ok(documentRepository.selectById(documentId));
|
| 373 |
}catch (ProfitMandiBusinessException pmbe) {
|
316 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 374 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
317 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 375 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 376 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 377 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
318 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 378 |
}
|
319 |
}
|
| 379 |
}
|
320 |
}
|
| 380 |
|
321 |
|
| 381 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_ALL, method=RequestMethod.GET)
|
322 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_SHOP_ALL, method=RequestMethod.GET)
|
| 382 |
public ResponseEntity<?> getAllShops(HttpServletRequest request, @RequestParam(name = "id") int id){
|
323 |
public ResponseEntity<?> getAllShops(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 383 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
324 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 384 |
try {
|
325 |
try {
|
| 385 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, shopRepository.selectByRetailerId(id));
|
- |
|
| 386 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
326 |
return responseSender.ok(shopRepository.selectByRetailerId(id));
|
| 387 |
}catch (ProfitMandiBusinessException pmbe) {
|
327 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 388 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
328 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 389 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
- |
|
| 390 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 391 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
329 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 392 |
}
|
330 |
}
|
| 393 |
}
|
331 |
}
|
| 394 |
|
332 |
|
| 395 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_ALL, method=RequestMethod.GET)
|
333 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_ADDRESS_ALL, method=RequestMethod.GET)
|
| 396 |
public ResponseEntity<?> getAllAddresses(HttpServletRequest request, @RequestParam(name = "id") int id){
|
334 |
public ResponseEntity<?> getAllAddresses(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 397 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
335 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 398 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, retailerAddressRepository.selectAddressesByRetailerId(id));
|
336 |
return responseSender.ok(retailerAddressRepository.selectAddressesByRetailerId(id));
|
| 399 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
- |
|
| 400 |
}
|
337 |
}
|
| 401 |
|
338 |
|
| 402 |
|
339 |
|
| 403 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_ALL, method=RequestMethod.GET)
|
340 |
@RequestMapping(value = ProfitMandiConstants.URL_RETAILER_BRAND_ALL, method=RequestMethod.GET)
|
| 404 |
public ResponseEntity<?> getAllBrads(HttpServletRequest request, @RequestParam(name = "id") int id){
|
341 |
public ResponseEntity<?> getAllBrads(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 405 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
342 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 406 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, retailerBrandRepository.selectBrandNamesByRetailerId(id));
|
343 |
return responseSender.ok(retailerBrandRepository.selectBrandNamesByRetailerId(id));
|
| 407 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
- |
|
| 408 |
}
|
344 |
}
|
| 409 |
|
345 |
|
| 410 |
}
|
346 |
}
|