| 22981 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 23494 |
ashik.ali |
3 |
import java.io.File;
|
|
|
4 |
import java.io.FileInputStream;
|
|
|
5 |
import java.io.FileNotFoundException;
|
| 28710 |
amit.gupta |
6 |
import java.time.Instant;
|
| 24349 |
amit.gupta |
7 |
import java.time.LocalDate;
|
| 24159 |
tejbeer |
8 |
import java.time.LocalDateTime;
|
| 28272 |
tejbeer |
9 |
import java.util.AbstractMap;
|
| 24124 |
govind |
10 |
import java.util.ArrayList;
|
| 25276 |
amit.gupta |
11 |
import java.util.Arrays;
|
| 28710 |
amit.gupta |
12 |
import java.util.Date;
|
| 24349 |
amit.gupta |
13 |
import java.util.HashMap;
|
| 24124 |
govind |
14 |
import java.util.List;
|
| 22981 |
ashik.ali |
15 |
import java.util.Map;
|
| 24986 |
tejbeer |
16 |
import java.util.Set;
|
| 24159 |
tejbeer |
17 |
import java.util.stream.Collectors;
|
| 22981 |
ashik.ali |
18 |
|
|
|
19 |
import javax.servlet.http.HttpServletRequest;
|
| 25276 |
amit.gupta |
20 |
import javax.transaction.Transactional;
|
| 22981 |
ashik.ali |
21 |
|
| 24159 |
tejbeer |
22 |
import org.apache.logging.log4j.LogManager;
|
| 23955 |
govind |
23 |
import org.apache.logging.log4j.Logger;
|
| 24159 |
tejbeer |
24 |
import org.json.JSONObject;
|
| 22981 |
ashik.ali |
25 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24159 |
tejbeer |
26 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 23494 |
ashik.ali |
27 |
import org.springframework.core.io.InputStreamResource;
|
|
|
28 |
import org.springframework.http.HttpHeaders;
|
|
|
29 |
import org.springframework.http.HttpStatus;
|
| 23330 |
ashik.ali |
30 |
import org.springframework.http.ResponseEntity;
|
| 22981 |
ashik.ali |
31 |
import org.springframework.stereotype.Controller;
|
|
|
32 |
import org.springframework.ui.Model;
|
| 24124 |
govind |
33 |
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
34 |
import org.springframework.web.bind.annotation.PostMapping;
|
| 23026 |
ashik.ali |
35 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 22981 |
ashik.ali |
36 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
37 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
38 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
39 |
|
| 23494 |
ashik.ali |
40 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 23955 |
govind |
41 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 28825 |
tejbeer |
42 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
| 22981 |
ashik.ali |
43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24123 |
tejbeer |
44 |
import com.spice.profitmandi.common.model.AddLocationModel;
|
| 24124 |
govind |
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 22981 |
ashik.ali |
46 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 24159 |
tejbeer |
47 |
import com.spice.profitmandi.common.model.PromoterDetailModel;
|
| 23026 |
ashik.ali |
48 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
| 28024 |
tejbeer |
49 |
import com.spice.profitmandi.common.util.Utils;
|
| 23330 |
ashik.ali |
50 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 27231 |
tejbeer |
51 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 28272 |
tejbeer |
52 |
import com.spice.profitmandi.dao.entity.dtr.BrandLimit;
|
| 23494 |
ashik.ali |
53 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
|
|
54 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 28024 |
tejbeer |
55 |
import com.spice.profitmandi.dao.entity.dtr.RetailerBlockBrands;
|
| 28272 |
tejbeer |
56 |
import com.spice.profitmandi.dao.entity.dtr.RetailerBrandsLimit;
|
| 23494 |
ashik.ali |
57 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 24124 |
govind |
58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 28908 |
tejbeer |
59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
| 27797 |
tejbeer |
60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
|
|
61 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
| 28381 |
tejbeer |
62 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 24159 |
tejbeer |
63 |
import com.spice.profitmandi.dao.entity.user.Location;
|
|
|
64 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 24123 |
tejbeer |
65 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 28825 |
tejbeer |
66 |
|
| 27231 |
tejbeer |
67 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
|
|
68 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 28272 |
tejbeer |
69 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
|
|
70 |
import com.spice.profitmandi.dao.repository.dtr.BrandLimitRepository;
|
| 23494 |
ashik.ali |
71 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 24124 |
govind |
72 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 24159 |
tejbeer |
73 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 28908 |
tejbeer |
74 |
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
|
| 28024 |
tejbeer |
75 |
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
|
| 28272 |
tejbeer |
76 |
import com.spice.profitmandi.dao.repository.dtr.RetailerBrandsLimitRepository;
|
| 23494 |
ashik.ali |
77 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
|
|
78 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
| 27797 |
tejbeer |
79 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
|
|
80 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 28381 |
tejbeer |
81 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| 24123 |
tejbeer |
82 |
import com.spice.profitmandi.dao.repository.user.LocationRepository;
|
| 24159 |
tejbeer |
83 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
| 24123 |
tejbeer |
84 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 24349 |
amit.gupta |
85 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 24159 |
tejbeer |
86 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 22981 |
ashik.ali |
87 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 28908 |
tejbeer |
88 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
| 25276 |
amit.gupta |
89 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
90 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 24123 |
tejbeer |
91 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 22981 |
ashik.ali |
92 |
|
|
|
93 |
@Controller
|
| 25277 |
amit.gupta |
94 |
@Transactional(rollbackOn = Throwable.class)
|
| 22981 |
ashik.ali |
95 |
public class RetailerController {
|
|
|
96 |
|
| 23568 |
govind |
97 |
private static final Logger LOGGER = LogManager.getLogger(RetailerController.class);
|
| 24124 |
govind |
98 |
|
| 22981 |
ashik.ali |
99 |
@Autowired
|
|
|
100 |
private RetailerService retailerService;
|
| 24124 |
govind |
101 |
|
| 23330 |
ashik.ali |
102 |
@Autowired
|
| 28832 |
tejbeer |
103 |
private RetailerRepository retailerRepository;
|
|
|
104 |
|
| 23494 |
ashik.ali |
105 |
@Autowired
|
| 28381 |
tejbeer |
106 |
private PincodePartnerRepository PincodePartnerRepository;
|
| 28832 |
tejbeer |
107 |
|
| 28381 |
tejbeer |
108 |
@Autowired
|
| 28272 |
tejbeer |
109 |
private BrandLimitRepository brandLimitRepository;
|
|
|
110 |
|
|
|
111 |
@Autowired
|
|
|
112 |
private RetailerBrandsLimitService retailerBrandsLimitService;
|
|
|
113 |
|
|
|
114 |
@Autowired
|
|
|
115 |
private RetailerBrandsLimitRepository retailerBrandsLimitRepository;
|
|
|
116 |
|
|
|
117 |
@Autowired
|
| 23494 |
ashik.ali |
118 |
private ShopRepository shopRepository;
|
| 24124 |
govind |
119 |
|
| 23494 |
ashik.ali |
120 |
@Autowired
|
| 28024 |
tejbeer |
121 |
private RetailerBlockBrandsRepository retailerBlockBrandsRepository;
|
|
|
122 |
|
|
|
123 |
@Autowired
|
| 24124 |
govind |
124 |
private FofoStoreRepository fofoStoreRepository;
|
|
|
125 |
|
|
|
126 |
@Autowired
|
| 23494 |
ashik.ali |
127 |
private DocumentRepository documentRepository;
|
| 24124 |
govind |
128 |
|
| 23494 |
ashik.ali |
129 |
@Autowired
|
| 25276 |
amit.gupta |
130 |
private CookiesProcessor cookiesProcessor;
|
|
|
131 |
|
|
|
132 |
@Autowired
|
| 24159 |
tejbeer |
133 |
@Qualifier("userUserRepository")
|
| 24123 |
tejbeer |
134 |
private UserRepository userRepository;
|
| 24124 |
govind |
135 |
|
| 24123 |
tejbeer |
136 |
@Autowired
|
| 27231 |
tejbeer |
137 |
private AuthRepository authRepository;
|
|
|
138 |
|
|
|
139 |
@Autowired
|
|
|
140 |
private CsService csService;
|
|
|
141 |
|
|
|
142 |
@Autowired
|
| 24123 |
tejbeer |
143 |
private LocationRepository locationRepository;
|
| 24124 |
govind |
144 |
|
| 24123 |
tejbeer |
145 |
@Autowired
|
| 23330 |
ashik.ali |
146 |
private ResponseSender<?> responseSender;
|
| 24124 |
govind |
147 |
|
| 24123 |
tejbeer |
148 |
@Autowired
|
|
|
149 |
private MVCResponseSender mvcResponseSender;
|
| 24124 |
govind |
150 |
|
| 24159 |
tejbeer |
151 |
@Autowired
|
|
|
152 |
private InventoryService inventoryService;
|
|
|
153 |
|
|
|
154 |
@Autowired
|
|
|
155 |
private PromoterRepository promoterRepository;
|
|
|
156 |
|
|
|
157 |
@Autowired
|
| 24349 |
amit.gupta |
158 |
private PartnerInvestmentService partnerInvestmentService;
|
|
|
159 |
|
|
|
160 |
@Autowired
|
| 24159 |
tejbeer |
161 |
private Mongo mongoClient;
|
|
|
162 |
|
| 27797 |
tejbeer |
163 |
@Autowired
|
|
|
164 |
private PartnerTypeChangeService partnerTypeChangeService;
|
|
|
165 |
|
|
|
166 |
@Autowired
|
|
|
167 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
|
|
168 |
|
| 28908 |
tejbeer |
169 |
@Autowired
|
|
|
170 |
PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
|
|
|
171 |
|
|
|
172 |
@Autowired
|
|
|
173 |
private StoreTimelineTatService storeTimelineTatService;
|
|
|
174 |
|
| 23784 |
ashik.ali |
175 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
| 24124 |
govind |
176 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
|
|
177 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
|
|
178 |
Model model) throws ProfitMandiBusinessException {
|
|
|
179 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
|
|
180 |
emailIdOrMobileNumber);
|
| 28071 |
tejbeer |
181 |
|
|
|
182 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
|
|
183 |
|
| 26771 |
amit.gupta |
184 |
model.addAllAttributes(map);
|
| 28071 |
tejbeer |
185 |
|
| 23955 |
govind |
186 |
model.addAttribute("counterSizes", CounterSize.values());
|
| 26209 |
tejbeer |
187 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 28825 |
tejbeer |
188 |
|
| 26209 |
tejbeer |
189 |
LOGGER.info("warehouseMap", warehouseMap);
|
|
|
190 |
model.addAttribute("warehouses", warehouseMap);
|
| 28825 |
tejbeer |
191 |
model.addAttribute("fofoTypes", FofoType.values());
|
| 26771 |
amit.gupta |
192 |
if (map.containsKey("retailer")) {
|
|
|
193 |
Retailer retailer = (Retailer) map.get("retailer");
|
|
|
194 |
User user = userRepository.selectById(retailer.getId());
|
|
|
195 |
if (user.getLocation() != null) {
|
|
|
196 |
Location location = locationRepository.selectById(user.getLocation());
|
|
|
197 |
model.addAttribute("locationdetail", location);
|
|
|
198 |
LOGGER.info("location" + location);
|
|
|
199 |
}
|
|
|
200 |
}
|
| 22981 |
ashik.ali |
201 |
return "retailer-details";
|
|
|
202 |
}
|
| 24124 |
govind |
203 |
|
| 23026 |
ashik.ali |
204 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
| 24124 |
govind |
205 |
public String updateRetailerDetails(HttpServletRequest request,
|
|
|
206 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
| 23026 |
ashik.ali |
207 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
|
|
208 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
| 28071 |
tejbeer |
209 |
|
| 23026 |
ashik.ali |
210 |
model.addAllAttributes(map);
|
| 23955 |
govind |
211 |
model.addAttribute("counterSizes", CounterSize.values());
|
| 26209 |
tejbeer |
212 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
|
|
213 |
LOGGER.info("warehouseMap", warehouseMap);
|
|
|
214 |
model.addAttribute("warehouses", warehouseMap);
|
| 28832 |
tejbeer |
215 |
model.addAttribute("fofoTypes", FofoType.values());
|
| 23026 |
ashik.ali |
216 |
return "retailer-details";
|
|
|
217 |
}
|
| 22981 |
ashik.ali |
218 |
|
|
|
219 |
@RequestMapping(value = "/retailerInfo", method = RequestMethod.GET)
|
| 24124 |
govind |
220 |
public String retailerInfo(HttpServletRequest request) throws Exception {
|
| 22981 |
ashik.ali |
221 |
return "retailer-info";
|
|
|
222 |
}
|
| 24124 |
govind |
223 |
|
| 23330 |
ashik.ali |
224 |
@RequestMapping(value = "/district/all/stateName", method = RequestMethod.GET)
|
| 24124 |
govind |
225 |
public ResponseEntity<?> getAllDistrict(@RequestParam(name = "stateName") String stateName) {
|
| 23330 |
ashik.ali |
226 |
return responseSender.ok(retailerService.getAllDistrictMaster(stateName));
|
|
|
227 |
}
|
| 24124 |
govind |
228 |
|
| 23494 |
ashik.ali |
229 |
@RequestMapping(value = "/retailerDocument/documentId", method = RequestMethod.GET)
|
| 24124 |
govind |
230 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
|
|
231 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId,
|
|
|
232 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
| 23494 |
ashik.ali |
233 |
Document document = documentRepository.selectById(documentId);
|
| 23499 |
ashik.ali |
234 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 24124 |
govind |
235 |
|
|
|
236 |
if (retailer.getDocumentId() == null) {
|
| 23494 |
ashik.ali |
237 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
|
|
238 |
}
|
| 24124 |
govind |
239 |
if (retailer.getDocumentId() != documentId) {
|
| 23494 |
ashik.ali |
240 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, documentId, "RTLR_1014");
|
|
|
241 |
}
|
|
|
242 |
return responseSender.ok(document);
|
|
|
243 |
}
|
| 24124 |
govind |
244 |
|
| 23494 |
ashik.ali |
245 |
@RequestMapping(value = "/retailerDocument/download", method = RequestMethod.GET)
|
| 24124 |
govind |
246 |
public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request,
|
|
|
247 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
|
|
248 |
throws ProfitMandiBusinessException {
|
|
|
249 |
|
| 23499 |
ashik.ali |
250 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 24124 |
govind |
251 |
|
|
|
252 |
if (retailer.getDocumentId() == null) {
|
| 23494 |
ashik.ali |
253 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
|
|
254 |
}
|
| 24124 |
govind |
255 |
|
| 23494 |
ashik.ali |
256 |
Document document = documentRepository.selectById(retailer.getDocumentId());
|
| 24124 |
govind |
257 |
|
| 23494 |
ashik.ali |
258 |
FileInputStream file = null;
|
|
|
259 |
try {
|
|
|
260 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
|
|
261 |
} catch (FileNotFoundException e) {
|
|
|
262 |
LOGGER.error("Retailer Document file not found : ", e);
|
|
|
263 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
|
|
264 |
}
|
| 24159 |
tejbeer |
265 |
// ByteArrayOutputStream byteArrayOutputStream = new
|
|
|
266 |
// ByteArrayOutputStream();
|
| 24124 |
govind |
267 |
// ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
|
|
268 |
|
|
|
269 |
final HttpHeaders headers = new HttpHeaders();
|
| 23494 |
ashik.ali |
270 |
String contentType = "";
|
| 24124 |
govind |
271 |
if (document.getContentType() == ContentType.JPEG) {
|
| 23494 |
ashik.ali |
272 |
contentType = "image/jpeg";
|
| 24124 |
govind |
273 |
} else if (document.getContentType() == ContentType.PNG) {
|
| 23494 |
ashik.ali |
274 |
contentType = "image/png";
|
| 24124 |
govind |
275 |
} else if (document.getContentType() == ContentType.PDF) {
|
| 23494 |
ashik.ali |
276 |
contentType = "application/pdf";
|
|
|
277 |
}
|
| 24124 |
govind |
278 |
headers.set("Content-Type", contentType);
|
|
|
279 |
headers.set("Content-disposition", "inline; filename=" + document.getName());
|
|
|
280 |
headers.setContentLength(document.getSize());
|
|
|
281 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
|
|
282 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
|
|
283 |
|
| 24159 |
tejbeer |
284 |
// return
|
|
|
285 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 23494 |
ashik.ali |
286 |
}
|
| 24124 |
govind |
287 |
|
| 23494 |
ashik.ali |
288 |
@RequestMapping(value = "/retailerShopDocument/shopId", method = RequestMethod.GET)
|
| 24124 |
govind |
289 |
public ResponseEntity<?> retailerShopDocumentById(HttpServletRequest request,
|
|
|
290 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
|
|
291 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
| 23494 |
ashik.ali |
292 |
Shop shop = shopRepository.selectById(shopId);
|
| 24124 |
govind |
293 |
|
|
|
294 |
if (shop.getRetailerId() != retailerId) {
|
| 23494 |
ashik.ali |
295 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
|
|
296 |
}
|
| 24124 |
govind |
297 |
|
|
|
298 |
if (shop.getDocumentId() == null) {
|
| 23494 |
ashik.ali |
299 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
|
|
300 |
}
|
| 24124 |
govind |
301 |
|
| 23494 |
ashik.ali |
302 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
|
|
303 |
return responseSender.ok(document);
|
|
|
304 |
}
|
| 24124 |
govind |
305 |
|
| 23494 |
ashik.ali |
306 |
@RequestMapping(value = "/retailerShopDocument/download", method = RequestMethod.GET)
|
| 24124 |
govind |
307 |
public ResponseEntity<?> downloadRetailerShopDocument(HttpServletRequest request,
|
|
|
308 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
|
|
309 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
|
|
310 |
throws ProfitMandiBusinessException {
|
|
|
311 |
|
| 23494 |
ashik.ali |
312 |
Shop shop = shopRepository.selectById(shopId);
|
| 24124 |
govind |
313 |
|
|
|
314 |
if (shop.getRetailerId() != retailerId) {
|
| 23494 |
ashik.ali |
315 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
|
|
316 |
}
|
| 24124 |
govind |
317 |
|
|
|
318 |
if (shop.getDocumentId() == null) {
|
| 23494 |
ashik.ali |
319 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
|
|
320 |
}
|
| 24124 |
govind |
321 |
|
| 23494 |
ashik.ali |
322 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
| 24124 |
govind |
323 |
|
| 23494 |
ashik.ali |
324 |
FileInputStream file = null;
|
|
|
325 |
try {
|
|
|
326 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
|
|
327 |
} catch (FileNotFoundException e) {
|
|
|
328 |
LOGGER.error("Retailer Document file not found : ", e);
|
|
|
329 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
|
|
330 |
}
|
| 24159 |
tejbeer |
331 |
// ByteArrayOutputStream byteArrayOutputStream = new
|
|
|
332 |
// ByteArrayOutputStream();
|
| 24124 |
govind |
333 |
// ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
|
|
334 |
|
|
|
335 |
final HttpHeaders headers = new HttpHeaders();
|
| 23494 |
ashik.ali |
336 |
String contentType = "";
|
| 24124 |
govind |
337 |
if (document.getContentType() == ContentType.JPEG) {
|
| 23494 |
ashik.ali |
338 |
contentType = "image/jpeg";
|
| 24124 |
govind |
339 |
} else if (document.getContentType() == ContentType.PNG) {
|
| 23494 |
ashik.ali |
340 |
contentType = "image/png";
|
| 24124 |
govind |
341 |
} else if (document.getContentType() == ContentType.PDF) {
|
| 23494 |
ashik.ali |
342 |
contentType = "application/pdf";
|
|
|
343 |
}
|
| 24124 |
govind |
344 |
headers.set("Content-Type", contentType);
|
|
|
345 |
headers.set("Content-disposition", "inline; filename=" + document.getName());
|
|
|
346 |
headers.setContentLength(document.getSize());
|
|
|
347 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
|
|
348 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
|
|
349 |
|
| 24159 |
tejbeer |
350 |
// return
|
|
|
351 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 23494 |
ashik.ali |
352 |
}
|
| 24124 |
govind |
353 |
|
|
|
354 |
@GetMapping(value = "/getAllStores")
|
|
|
355 |
public String getAllStores(HttpServletRequest request, Model model) {
|
|
|
356 |
|
| 25276 |
amit.gupta |
357 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
|
|
|
358 |
.collect(Collectors.toList());
|
| 24349 |
amit.gupta |
359 |
Map<Integer, Boolean> investments = new HashMap<>();
|
| 24124 |
govind |
360 |
|
| 24349 |
amit.gupta |
361 |
for (FofoStore fofoStore : fofoStores) {
|
|
|
362 |
boolean isOk = false;
|
|
|
363 |
if (fofoStore.getGraceDate() != null && fofoStore.getGraceDate().isAfter(LocalDate.now())) {
|
|
|
364 |
isOk = true;
|
|
|
365 |
} else {
|
|
|
366 |
try {
|
| 25276 |
amit.gupta |
367 |
isOk = partnerInvestmentService.isInvestmentOk(fofoStore.getId(), 10,
|
|
|
368 |
ProfitMandiConstants.CUTOFF_INVESTMENT);
|
|
|
369 |
if (fofoStore.getGraceCount() > 0) {
|
| 24349 |
amit.gupta |
370 |
fofoStore.setGraceDate(null);
|
|
|
371 |
fofoStore.setGraceCount(0);
|
|
|
372 |
fofoStoreRepository.persist(fofoStore);
|
|
|
373 |
}
|
|
|
374 |
} catch (ProfitMandiBusinessException e) {
|
|
|
375 |
}
|
|
|
376 |
}
|
|
|
377 |
investments.put(fofoStore.getId(), isOk);
|
|
|
378 |
}
|
| 24124 |
govind |
379 |
|
| 26963 |
amit.gupta |
380 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(false);
|
| 24124 |
govind |
381 |
model.addAttribute("fofoStores", fofoStores);
|
| 24349 |
amit.gupta |
382 |
model.addAttribute("investments", investments);
|
| 24124 |
govind |
383 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
384 |
|
|
|
385 |
return "store";
|
|
|
386 |
|
|
|
387 |
}
|
|
|
388 |
|
| 27797 |
tejbeer |
389 |
@GetMapping(value = "/getPartnerCategory")
|
|
|
390 |
public String getPartnerCategory(HttpServletRequest request, @RequestParam int fofoId, Model model) {
|
|
|
391 |
|
|
|
392 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, LocalDate.now());
|
|
|
393 |
List<PartnerType> partnerTypes = partnerType.nextPartnerTypes();
|
|
|
394 |
LOGGER.info("partnerType" + partnerTypes);
|
|
|
395 |
model.addAttribute("partnerTypes", partnerTypes);
|
|
|
396 |
model.addAttribute("fofoId", fofoId);
|
|
|
397 |
return "partner-category";
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
@PostMapping(value = "/updatePartnerCategory")
|
|
|
401 |
public String updatePartnerCategory(HttpServletRequest request, @RequestParam(name = "fofoId") int fofoId,
|
|
|
402 |
@RequestParam(name = "partnerType") PartnerType partnerType, Model model) throws Exception {
|
|
|
403 |
|
|
|
404 |
PartnerTypeChange ptc = new PartnerTypeChange();
|
|
|
405 |
ptc.setFofoId(fofoId);
|
|
|
406 |
ptc.setPartnerType(partnerType);
|
|
|
407 |
ptc.setCreateTimestamp(LocalDate.now().atStartOfDay().plusDays(1));
|
|
|
408 |
partnerTypeChangeRepository.persist(ptc);
|
|
|
409 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
410 |
|
|
|
411 |
return "response";
|
|
|
412 |
}
|
|
|
413 |
|
| 24349 |
amit.gupta |
414 |
@GetMapping(value = "/partners")
|
|
|
415 |
public String getStoreName(HttpServletRequest request, Model model, @RequestParam String query) throws Exception {
|
|
|
416 |
model.addAttribute("response", mvcResponseSender
|
| 26963 |
amit.gupta |
417 |
.createResponseString(retailerService.getFofoRetailers(false).values().stream().filter(x -> {
|
| 24349 |
amit.gupta |
418 |
return x.getDisplayName().toLowerCase().matches(".*?" + query.toLowerCase() + ".*?");
|
|
|
419 |
}).collect(Collectors.toList())));
|
|
|
420 |
return "response";
|
|
|
421 |
}
|
|
|
422 |
|
| 24124 |
govind |
423 |
@PostMapping(value = "/deactivateStore")
|
|
|
424 |
public String deActivateStore(HttpServletRequest request,
|
|
|
425 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
|
|
426 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 25276 |
amit.gupta |
427 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 27231 |
tejbeer |
428 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com")
|
| 26131 |
tejbeer |
429 |
.contains(loginDetails.getEmailId())) {
|
|
|
430 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
|
|
431 |
"You are not authorise to deactivate retailer");
|
| 25276 |
amit.gupta |
432 |
}
|
| 24843 |
govind |
433 |
fofoStore.setActive(false);
|
|
|
434 |
fofoStoreRepository.persist(fofoStore);
|
| 24124 |
govind |
435 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
|
|
436 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
437 |
return "response";
|
|
|
438 |
}
|
| 28825 |
tejbeer |
439 |
|
| 28710 |
amit.gupta |
440 |
@PostMapping(value = "/activateStoreForever")
|
|
|
441 |
public String activateStoreForever(HttpServletRequest request,
|
|
|
442 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
|
|
443 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
|
|
444 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 28825 |
tejbeer |
445 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
|
|
446 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 28710 |
amit.gupta |
447 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
|
|
448 |
"You are not authorise to activate retailer");
|
|
|
449 |
}
|
|
|
450 |
fofoStore.setActive(true);
|
|
|
451 |
fofoStoreRepository.persist(fofoStore);
|
|
|
452 |
LOGGER.info("inserted into ActiveFofoStore successfully");
|
|
|
453 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
454 |
return "response";
|
|
|
455 |
}
|
| 28825 |
tejbeer |
456 |
|
| 28710 |
amit.gupta |
457 |
@PostMapping(value = "/activateStoreTemporary")
|
|
|
458 |
public String activateStoreTemporary(HttpServletRequest request,
|
|
|
459 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
|
| 28825 |
tejbeer |
460 |
@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
|
|
|
461 |
|
| 28710 |
amit.gupta |
462 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
|
|
463 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 28825 |
tejbeer |
464 |
if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
|
|
465 |
"manish.tiwari@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 28710 |
amit.gupta |
466 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
|
|
467 |
"You are not authorise to deactivate retailer");
|
|
|
468 |
}
|
| 28825 |
tejbeer |
469 |
|
|
|
470 |
LocalDateTime currentDate = LocalDate.now().atStartOfDay();
|
|
|
471 |
|
| 28710 |
amit.gupta |
472 |
LocalDateTime EndDate = currentDate.plusDays(days);
|
|
|
473 |
fofoStore.setActiveTimeStamp(EndDate);
|
| 28825 |
tejbeer |
474 |
|
|
|
475 |
LOGGER.info("EndDate" + EndDate);
|
|
|
476 |
LOGGER.info("getActiveTimeStamp" + fofoStore.getActiveTimeStamp());
|
|
|
477 |
|
|
|
478 |
if (currentDate.isBefore(fofoStore.getActiveTimeStamp())) {
|
|
|
479 |
|
|
|
480 |
fofoStore.setActive(true);
|
|
|
481 |
fofoStoreRepository.persist(fofoStore);
|
|
|
482 |
LOGGER.info("inserted into InActiveFofoStore successfully");
|
|
|
483 |
|
| 28710 |
amit.gupta |
484 |
}
|
| 28825 |
tejbeer |
485 |
|
| 28710 |
amit.gupta |
486 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
487 |
return "response";
|
|
|
488 |
}
|
| 25276 |
amit.gupta |
489 |
|
|
|
490 |
@GetMapping(value = "/getAllInactiveStores")
|
|
|
491 |
public String getInactiveStores(HttpServletRequest request, Model model) {
|
|
|
492 |
List<FofoStore> inActiveFofoStores = fofoStoreRepository.selectInActiveStore();
|
|
|
493 |
Map<Integer, CustomRetailer> customRetailers = retailerService
|
|
|
494 |
.getFofoRetailers(inActiveFofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| 24680 |
govind |
495 |
model.addAttribute("inActiveFofoStores", inActiveFofoStores);
|
|
|
496 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
497 |
return "inactive-stores";
|
|
|
498 |
}
|
| 25276 |
amit.gupta |
499 |
|
|
|
500 |
// Extend billing for 2 days
|
| 24349 |
amit.gupta |
501 |
@PostMapping(value = "/extendBilling")
|
|
|
502 |
public String extendBilling(HttpServletRequest request,
|
|
|
503 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
|
|
504 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 25276 |
amit.gupta |
505 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 27231 |
tejbeer |
506 |
if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com",
|
|
|
507 |
"amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 25276 |
amit.gupta |
508 |
fofoStore.setGraceDate(LocalDate.now().plusDays(2));
|
|
|
509 |
fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
|
|
|
510 |
fofoStoreRepository.persist(fofoStore);
|
|
|
511 |
model.addAttribute("response", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
|
|
|
512 |
} else {
|
| 26131 |
tejbeer |
513 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
|
|
514 |
"You are not authorise to extend billing");
|
| 25276 |
amit.gupta |
515 |
}
|
| 24349 |
amit.gupta |
516 |
return "response";
|
| 25276 |
amit.gupta |
517 |
|
| 24124 |
govind |
518 |
}
|
|
|
519 |
|
| 24159 |
tejbeer |
520 |
@RequestMapping(value = "/getPromoterInfo", method = RequestMethod.GET)
|
|
|
521 |
public String getPromoterInfo(HttpServletRequest request,
|
|
|
522 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 27489 |
tejbeer |
523 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
524 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
|
|
525 |
throws Exception {
|
| 24159 |
tejbeer |
526 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
|
|
527 |
List<Promoter> promoterInfo = null;
|
|
|
528 |
|
|
|
529 |
long size = 0;
|
| 27489 |
tejbeer |
530 |
|
| 24159 |
tejbeer |
531 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
|
|
532 |
.collect(Collectors.toList());
|
|
|
533 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
|
|
534 |
String customRetailers = JSONObject.valueToString(customRetailersMap.values());
|
| 24986 |
tejbeer |
535 |
Set<String> brands = inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
|
|
536 |
brands.add("Airtel");
|
|
|
537 |
brands.add("Vodafone");
|
|
|
538 |
brands.add("Idea");
|
| 25276 |
amit.gupta |
539 |
LOGGER.info("brands" + brands);
|
| 24159 |
tejbeer |
540 |
model.addAttribute("customRetailers", customRetailers);
|
| 25276 |
amit.gupta |
541 |
model.addAttribute("brands", brands);
|
| 24159 |
tejbeer |
542 |
|
| 27489 |
tejbeer |
543 |
if (fofoId != 0) {
|
|
|
544 |
promoterInfo = promoterRepository.selectAllPromoterByFofoId(fofoId, offset, limit);
|
| 24159 |
tejbeer |
545 |
|
| 27489 |
tejbeer |
546 |
size = promoterRepository.selectPromoterCount(fofoId);
|
|
|
547 |
|
|
|
548 |
} else {
|
|
|
549 |
promoterInfo = promoterRepository.selectAllPromoter(offset, limit);
|
|
|
550 |
|
|
|
551 |
size = promoterRepository.selectAllCount();
|
|
|
552 |
|
|
|
553 |
}
|
| 24159 |
tejbeer |
554 |
if (!promoterInfo.isEmpty()) {
|
|
|
555 |
List<Integer> partnerIds = new ArrayList<>();
|
|
|
556 |
|
|
|
557 |
for (Promoter promoterdetail : promoterInfo) {
|
|
|
558 |
partnerIds.add(promoterdetail.getRetailerId());
|
|
|
559 |
}
|
|
|
560 |
Map<Integer, CustomRetailer> partnersMap = null;
|
| 24349 |
amit.gupta |
561 |
if (!partnerIds.equals(null)) {
|
| 24159 |
tejbeer |
562 |
LOGGER.info("partnerIds" + partnerIds);
|
| 24349 |
amit.gupta |
563 |
partnersMap = retailerService.getFofoRetailers(partnerIds);
|
| 24159 |
tejbeer |
564 |
}
|
| 24349 |
amit.gupta |
565 |
|
| 24159 |
tejbeer |
566 |
LOGGER.info("partnerIds" + partnersMap);
|
|
|
567 |
model.addAttribute("promoterInfo", promoterInfo);
|
|
|
568 |
model.addAttribute("partnersMap", partnersMap);
|
|
|
569 |
model.addAttribute("start", offset + 1);
|
|
|
570 |
model.addAttribute("size", size);
|
|
|
571 |
model.addAttribute("url", "/getPaginatedPromoterInfo");
|
|
|
572 |
|
|
|
573 |
if (promoterInfo.size() < limit) {
|
|
|
574 |
model.addAttribute("end", offset + promoterInfo.size());
|
|
|
575 |
} else {
|
|
|
576 |
model.addAttribute("end", offset + limit);
|
|
|
577 |
}
|
|
|
578 |
} else {
|
|
|
579 |
model.addAttribute("promoterInfo", promoterInfo);
|
|
|
580 |
model.addAttribute("size", size);
|
|
|
581 |
}
|
|
|
582 |
return "promoter-info";
|
|
|
583 |
|
|
|
584 |
}
|
| 24349 |
amit.gupta |
585 |
|
| 24159 |
tejbeer |
586 |
@RequestMapping(value = "/getPaginatedPromoterInfo", method = RequestMethod.GET)
|
|
|
587 |
public String getPaginatedPromoterInfo(HttpServletRequest request,
|
|
|
588 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 27489 |
tejbeer |
589 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
590 |
@RequestParam(name = "fofoId", required = false, defaultValue = "0") int fofoId, Model model)
|
| 24159 |
tejbeer |
591 |
throws ProfitMandiBusinessException {
|
|
|
592 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
|
|
593 |
List<Promoter> promoterInfo = null;
|
| 27489 |
tejbeer |
594 |
if (fofoId != 0) {
|
|
|
595 |
promoterInfo = promoterRepository.selectAllPromoterByFofoId(fofoId, offset, limit);
|
|
|
596 |
} else {
|
|
|
597 |
promoterInfo = promoterRepository.selectAllPromoter(offset, limit);
|
|
|
598 |
}
|
| 24159 |
tejbeer |
599 |
LOGGER.info("promoterInfo" + promoterInfo);
|
|
|
600 |
if (!promoterInfo.isEmpty()) {
|
|
|
601 |
List<Integer> partnerIds = new ArrayList<>();
|
|
|
602 |
|
|
|
603 |
for (Promoter promoterdetail : promoterInfo) {
|
|
|
604 |
partnerIds.add(promoterdetail.getRetailerId());
|
|
|
605 |
}
|
|
|
606 |
Map<Integer, CustomRetailer> partnersMap = null;
|
| 24349 |
amit.gupta |
607 |
if (!partnerIds.equals(null)) {
|
| 24159 |
tejbeer |
608 |
LOGGER.info("partnerIds" + partnerIds);
|
| 24349 |
amit.gupta |
609 |
partnersMap = retailerService.getFofoRetailers(partnerIds);
|
| 24159 |
tejbeer |
610 |
}
|
| 24349 |
amit.gupta |
611 |
|
| 24159 |
tejbeer |
612 |
LOGGER.info("partnerIds" + partnersMap);
|
|
|
613 |
model.addAttribute("promoterInfo", promoterInfo);
|
|
|
614 |
model.addAttribute("partnersMap", partnersMap);
|
|
|
615 |
model.addAttribute("url", "/getPaginatedPromoterInfo");
|
|
|
616 |
} else {
|
|
|
617 |
model.addAttribute("promoterInfo", promoterInfo);
|
|
|
618 |
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
return "promoter-info-paginated";
|
|
|
622 |
}
|
|
|
623 |
|
|
|
624 |
@RequestMapping(value = "/createPromoter", method = RequestMethod.POST)
|
|
|
625 |
public String createPromoter(HttpServletRequest request, @RequestBody PromoterDetailModel promoterdetailModel,
|
|
|
626 |
Model model) throws Exception {
|
|
|
627 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
|
|
628 |
LOGGER.info("requested url : " + promoterdetailModel);
|
| 26131 |
tejbeer |
629 |
Promoter promoter = promoterRepository.selectById(promoterdetailModel.getId());
|
|
|
630 |
if (promoter == null) {
|
|
|
631 |
promoter = new Promoter();
|
| 24159 |
tejbeer |
632 |
promoter.setBrand(promoterdetailModel.getBrand());
|
|
|
633 |
promoter.setRetailerId(promoterdetailModel.getRetailerId());
|
|
|
634 |
promoter.setCreatedTimestamp(LocalDateTime.now());
|
| 28996 |
amit.gupta |
635 |
promoter.setEmail(promoterdetailModel.getEmail());
|
|
|
636 |
promoter.setName(promoterdetailModel.getName());
|
|
|
637 |
promoter.setMobile(promoterdetailModel.getMobile());
|
|
|
638 |
promoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
|
|
|
639 |
promoter.setStatus(promoterdetailModel.isStatus());
|
| 28908 |
tejbeer |
640 |
promoterRepository.persist(promoter);
|
| 26131 |
tejbeer |
641 |
|
| 28908 |
tejbeer |
642 |
List<Promoter> promoters = promoterRepository.selectAllByRetailer(promoterdetailModel.getRetailerId());
|
|
|
643 |
if (!promoters.isEmpty()) {
|
| 28970 |
tejbeer |
644 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(promoterdetailModel.getRetailerId());
|
| 28908 |
tejbeer |
645 |
PartnerOnBoardingPanel pobp = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
|
|
|
646 |
if (pobp != null) {
|
|
|
647 |
storeTimelineTatService.promoterComplete(pobp.getId());
|
|
|
648 |
}
|
|
|
649 |
}
|
|
|
650 |
|
| 28996 |
amit.gupta |
651 |
} else {
|
|
|
652 |
promoter.setEmail(promoterdetailModel.getEmail());
|
|
|
653 |
promoter.setName(promoterdetailModel.getName());
|
|
|
654 |
promoter.setMobile(promoterdetailModel.getMobile());
|
|
|
655 |
promoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
|
|
|
656 |
promoter.setStatus(promoterdetailModel.isStatus());
|
| 24159 |
tejbeer |
657 |
}
|
| 27489 |
tejbeer |
658 |
LOGGER.info("sdport" + promoterdetailModel.isStatus());
|
| 24159 |
tejbeer |
659 |
|
|
|
660 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
661 |
|
|
|
662 |
return "response";
|
|
|
663 |
|
|
|
664 |
}
|
|
|
665 |
|
|
|
666 |
@RequestMapping(value = "/removePromoterfromPartnerStore", method = RequestMethod.POST)
|
|
|
667 |
public String removePromoterfromPartnerStore(HttpServletRequest request,
|
|
|
668 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
|
|
669 |
|
|
|
670 |
Promoter promoter = promoterRepository.selectById(id);
|
|
|
671 |
|
| 26131 |
tejbeer |
672 |
promoter.setStatus(false);
|
| 24159 |
tejbeer |
673 |
promoterRepository.persist(promoter);
|
|
|
674 |
|
|
|
675 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
676 |
|
|
|
677 |
return "response";
|
|
|
678 |
}
|
|
|
679 |
|
|
|
680 |
@RequestMapping(value = "/addLocation", method = RequestMethod.POST)
|
|
|
681 |
public String addLocation(HttpServletRequest request, @RequestBody AddLocationModel addLocationModel, Model model)
|
|
|
682 |
throws Exception {
|
|
|
683 |
|
|
|
684 |
Location location = new Location();
|
|
|
685 |
location.setName(addLocationModel.getName());
|
|
|
686 |
location.setLine1(addLocationModel.getLine1());
|
|
|
687 |
location.setLine2(addLocationModel.getLine2());
|
|
|
688 |
location.setCity(addLocationModel.getCity());
|
|
|
689 |
location.setState(addLocationModel.getState());
|
|
|
690 |
location.setPin(addLocationModel.getPin());
|
|
|
691 |
|
|
|
692 |
LOGGER.info("PostLocation" + location);
|
|
|
693 |
locationRepository.persist(location);
|
|
|
694 |
|
|
|
695 |
User user = userRepository.selectById(addLocationModel.getUserId());
|
|
|
696 |
user.setLocation(location.getId());
|
|
|
697 |
userRepository.persist(user);
|
|
|
698 |
|
|
|
699 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
700 |
return "response";
|
|
|
701 |
|
|
|
702 |
}
|
|
|
703 |
|
|
|
704 |
@RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
|
|
|
705 |
public String updateLocation(HttpServletRequest request, @RequestBody AddLocationModel addLocationModel,
|
|
|
706 |
Model model) throws Exception {
|
|
|
707 |
|
|
|
708 |
Location userlocation = locationRepository.selectById(addLocationModel.getUserId());
|
|
|
709 |
|
|
|
710 |
userlocation.setName(addLocationModel.getName());
|
|
|
711 |
userlocation.setCity(addLocationModel.getCity());
|
|
|
712 |
userlocation.setLine1(addLocationModel.getLine1());
|
|
|
713 |
userlocation.setLine2(addLocationModel.getLine2());
|
|
|
714 |
userlocation.setPin(addLocationModel.getPin());
|
|
|
715 |
userlocation.setState(addLocationModel.getState());
|
|
|
716 |
|
|
|
717 |
locationRepository.persist(userlocation);
|
|
|
718 |
|
|
|
719 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
720 |
return "response";
|
|
|
721 |
|
|
|
722 |
}
|
|
|
723 |
|
| 27231 |
tejbeer |
724 |
@RequestMapping(value = "/getPartnerReadonlyInfo")
|
|
|
725 |
public String getPartnerReadonlyInfo(HttpServletRequest request, Model model) throws Exception {
|
|
|
726 |
|
|
|
727 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
728 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
|
|
729 |
|
|
|
730 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
|
|
731 |
|
|
|
732 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
|
|
733 |
|
|
|
734 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
|
|
735 |
|
|
|
736 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 27243 |
tejbeer |
737 |
|
| 27231 |
tejbeer |
738 |
return "partner-readonly-info";
|
|
|
739 |
|
|
|
740 |
}
|
|
|
741 |
|
| 28071 |
tejbeer |
742 |
@RequestMapping(value = "/getBlockBrandMapping")
|
|
|
743 |
public String getBlockBrandMapping(HttpServletRequest request, Model model) throws Exception {
|
|
|
744 |
|
|
|
745 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
|
|
746 |
Set<String> brands = null;
|
|
|
747 |
|
|
|
748 |
brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
|
|
749 |
.collect(Collectors.toSet());
|
|
|
750 |
|
|
|
751 |
LOGGER.info("brands" + brands);
|
|
|
752 |
model.addAttribute("brands", brands);
|
|
|
753 |
|
|
|
754 |
return "block-brand-mapping";
|
|
|
755 |
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
@RequestMapping(value = "/getBlockBrand")
|
|
|
759 |
public String getBlockBrand(HttpServletRequest request,
|
|
|
760 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
|
|
761 |
throws Exception {
|
|
|
762 |
|
|
|
763 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
|
|
764 |
|
|
|
765 |
List<Integer> blockBrandPartners = retailerBlockBrands.stream().map(x -> x.getFofoId())
|
|
|
766 |
.collect(Collectors.toList());
|
|
|
767 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
| 28272 |
tejbeer |
768 |
|
| 28071 |
tejbeer |
769 |
LOGGER.info("retailerBlockBrands" + retailerBlockBrands);
|
|
|
770 |
model.addAttribute("blockBrandPartners", blockBrandPartners);
|
|
|
771 |
model.addAttribute("retailerBlockBrands", retailerBlockBrands);
|
|
|
772 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
773 |
|
|
|
774 |
return "retailer-block-brand";
|
|
|
775 |
|
|
|
776 |
}
|
|
|
777 |
|
|
|
778 |
@RequestMapping(value = "/getRetailerBlockBrandMappping", method = RequestMethod.POST)
|
|
|
779 |
public String getBlockBrandMappping(HttpServletRequest request,
|
|
|
780 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
|
|
781 |
@RequestParam(name = "fofoIds", required = true, defaultValue = "0") List<Integer> fofoIds, Model model)
|
|
|
782 |
throws Exception {
|
|
|
783 |
List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
|
|
|
784 |
if (!retailerBlockBrands.isEmpty()) {
|
|
|
785 |
retailerBlockBrandsRepository.deleteAllbyBrands(brand);
|
|
|
786 |
}
|
|
|
787 |
|
|
|
788 |
for (int id : fofoIds) {
|
|
|
789 |
RetailerBlockBrands retailerBlockBrand = new RetailerBlockBrands();
|
|
|
790 |
retailerBlockBrand.setFofoId(id);
|
|
|
791 |
retailerBlockBrand.setBlockBrands(brand);
|
|
|
792 |
retailerBlockBrandsRepository.persist(retailerBlockBrand);
|
|
|
793 |
|
|
|
794 |
}
|
|
|
795 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
796 |
|
|
|
797 |
return "response";
|
|
|
798 |
}
|
|
|
799 |
|
| 28272 |
tejbeer |
800 |
@RequestMapping(value = "/getBrandslimit", method = RequestMethod.GET)
|
|
|
801 |
public String getBrandslimit(HttpServletRequest request, Model model) throws Exception {
|
|
|
802 |
|
|
|
803 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
|
|
804 |
Set<String> brands = null;
|
|
|
805 |
|
|
|
806 |
brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
|
|
807 |
.collect(Collectors.toSet());
|
|
|
808 |
|
|
|
809 |
model.addAttribute("brands", brands);
|
|
|
810 |
|
|
|
811 |
return "brands-limit";
|
|
|
812 |
|
|
|
813 |
}
|
|
|
814 |
|
|
|
815 |
@RequestMapping(value = "/setUpdateLimit", method = RequestMethod.POST)
|
|
|
816 |
public String getUpdateLimit(HttpServletRequest request,
|
|
|
817 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
|
|
818 |
@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
|
|
|
819 |
@RequestParam(name = "limit", required = true, defaultValue = "0") float limit, Model model)
|
|
|
820 |
throws Exception {
|
|
|
821 |
|
|
|
822 |
CustomRetailer cr = retailerService.getFofoRetailer(fofoId);
|
| 28277 |
tejbeer |
823 |
|
|
|
824 |
Map.Entry<Integer, CustomRetailer> customRetailers = new AbstractMap.SimpleEntry(cr.getPartnerId(), cr);
|
|
|
825 |
|
|
|
826 |
// Map<Integer, CustomRetailer> customRetailers =
|
|
|
827 |
// retailerService.getFofoRetailers(true);
|
|
|
828 |
LOGGER.info("customRetailers" + customRetailers);
|
| 28272 |
tejbeer |
829 |
RetailerBrandsLimit retailerBrands = retailerBrandsLimitRepository.selectLimitByBrandAndFofoId(fofoId, brand);
|
| 28277 |
tejbeer |
830 |
|
| 28272 |
tejbeer |
831 |
if (retailerBrands == null) {
|
|
|
832 |
retailerBrands = new RetailerBrandsLimit();
|
|
|
833 |
retailerBrands.setBrandLimit(limit);
|
|
|
834 |
retailerBrands.setIsUpdate(1);
|
|
|
835 |
retailerBrands.setCreatedTimestamp(LocalDateTime.now());
|
|
|
836 |
retailerBrands.setPartnerId(fofoId);
|
|
|
837 |
retailerBrands.setBrandName(brand);
|
|
|
838 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
|
|
839 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
|
|
840 |
|
|
|
841 |
}
|
|
|
842 |
|
|
|
843 |
else {
|
|
|
844 |
retailerBrands.setBrandLimit(limit);
|
|
|
845 |
retailerBrands.setIsUpdate(1);
|
|
|
846 |
retailerBrands.setUpdatedTimestamp(LocalDateTime.now());
|
|
|
847 |
retailerBrandsLimitRepository.persist(retailerBrands);
|
|
|
848 |
|
|
|
849 |
}
|
|
|
850 |
retailerBrands = retailerBrandsLimitRepository.selectLimitByBrandAndFofoId(fofoId, brand);
|
|
|
851 |
|
|
|
852 |
Map<Integer, RetailerBrandsLimit> retailerBrandsLimitMap = new HashMap<>();
|
|
|
853 |
|
|
|
854 |
retailerBrandsLimitMap.put(retailerBrands.getPartnerId(), retailerBrands);
|
|
|
855 |
|
|
|
856 |
BrandLimit brandLimit = brandLimitRepository.setLimitByBrands(brand);
|
|
|
857 |
|
|
|
858 |
model.addAttribute("retailerBrandsLimitMap", retailerBrandsLimitMap);
|
|
|
859 |
model.addAttribute("brandLimit", brandLimit);
|
|
|
860 |
model.addAttribute("customRetailers", customRetailers);
|
| 28277 |
tejbeer |
861 |
|
|
|
862 |
model.addAttribute("brand", brand);
|
| 28272 |
tejbeer |
863 |
return "brands-limit-row-mapping";
|
|
|
864 |
|
|
|
865 |
}
|
|
|
866 |
|
|
|
867 |
@RequestMapping(value = "/getRetailerBrandslimitMapping", method = RequestMethod.GET)
|
|
|
868 |
public String getRetailerBrandslimit(HttpServletRequest request,
|
|
|
869 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
|
|
|
870 |
throws Exception {
|
|
|
871 |
|
|
|
872 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
| 28283 |
tejbeer |
873 |
List<RetailerBrandsLimit> retailerBrandsLimit = retailerBrandsLimitRepository.setAllLimitByBrands(brand);
|
|
|
874 |
Map<Integer, RetailerBrandsLimit> retailerBrandsLimitMap = retailerBrandsLimit.stream()
|
|
|
875 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 28272 |
tejbeer |
876 |
|
|
|
877 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
878 |
model.addAttribute("brand", brand);
|
| 28283 |
tejbeer |
879 |
model.addAttribute("retailerBrandsLimitMap", retailerBrandsLimitMap);
|
| 28272 |
tejbeer |
880 |
|
|
|
881 |
BrandLimit brandLimit = brandLimitRepository.setLimitByBrands(brand);
|
|
|
882 |
|
|
|
883 |
model.addAttribute("brandLimit", brandLimit);
|
|
|
884 |
|
|
|
885 |
return "brands-limit-mapping";
|
|
|
886 |
|
|
|
887 |
}
|
|
|
888 |
|
|
|
889 |
@RequestMapping(value = "/setBrandWiseLimit", method = RequestMethod.POST)
|
|
|
890 |
public String brandwiseLimit(HttpServletRequest request,
|
|
|
891 |
@RequestParam(name = "brands", required = true, defaultValue = "") String brands,
|
|
|
892 |
@RequestParam(name = "limit", required = true, defaultValue = "") float limit, Model model)
|
|
|
893 |
throws Exception {
|
|
|
894 |
|
|
|
895 |
LOGGER.info("limit" + limit);
|
|
|
896 |
|
|
|
897 |
BrandLimit brandLimit = brandLimitRepository.setLimitByBrands(brands);
|
|
|
898 |
|
|
|
899 |
List<RetailerBrandsLimit> retailerBrandsLimit = retailerBrandsLimitRepository.setAllLimitByBrands(brands);
|
|
|
900 |
|
|
|
901 |
Map<Integer, RetailerBrandsLimit> retailerBrandsLimitMap = retailerBrandsLimit.stream()
|
|
|
902 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
|
|
903 |
|
|
|
904 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
|
|
905 |
|
|
|
906 |
if (brandLimit == null) {
|
|
|
907 |
|
|
|
908 |
brandLimit = new BrandLimit();
|
|
|
909 |
brandLimit.setBrandLimit(limit);
|
|
|
910 |
brandLimit.setBrandName(brands);
|
|
|
911 |
brandLimit.setCreatedTimestamp(LocalDateTime.now());
|
|
|
912 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
|
|
913 |
brandLimitRepository.persist(brandLimit);
|
|
|
914 |
|
|
|
915 |
}
|
|
|
916 |
|
|
|
917 |
else {
|
|
|
918 |
brandLimit.setBrandLimit(limit);
|
|
|
919 |
|
|
|
920 |
brandLimit.setUpdatedTimestamp(LocalDateTime.now());
|
|
|
921 |
brandLimitRepository.persist(brandLimit);
|
|
|
922 |
|
|
|
923 |
}
|
|
|
924 |
brandLimit = brandLimitRepository.setLimitByBrands(brands);
|
|
|
925 |
|
|
|
926 |
LOGGER.info("brandLimit" + brandLimit);
|
| 28277 |
tejbeer |
927 |
model.addAttribute("brand", brands);
|
| 28272 |
tejbeer |
928 |
model.addAttribute("brandLimit", brandLimit);
|
|
|
929 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
930 |
model.addAttribute("retailerBrandsLimitMap", retailerBrandsLimitMap);
|
|
|
931 |
return "brands-limit-mapping";
|
|
|
932 |
|
|
|
933 |
}
|
| 28825 |
tejbeer |
934 |
|
| 28381 |
tejbeer |
935 |
@RequestMapping(value = "/setPartnerPincode", method = RequestMethod.POST)
|
|
|
936 |
public String setPartnerPincode(HttpServletRequest request,
|
|
|
937 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode,
|
| 28825 |
tejbeer |
938 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
|
|
939 |
throws Exception {
|
| 28272 |
tejbeer |
940 |
|
| 28825 |
tejbeer |
941 |
if (!pincode.equals("")) {
|
|
|
942 |
PincodePartner pinPartner = new PincodePartner();
|
|
|
943 |
pinPartner.setFofoId(fofoId);
|
|
|
944 |
pinPartner.setPincode(pincode);
|
|
|
945 |
PincodePartnerRepository.perist(pinPartner);
|
| 28381 |
tejbeer |
946 |
}
|
|
|
947 |
|
| 28825 |
tejbeer |
948 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
|
|
949 |
|
|
|
950 |
LOGGER.info("partnerPincodeList" + partnerPincodeList);
|
|
|
951 |
|
|
|
952 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 28381 |
tejbeer |
953 |
return "pincode-partner-index";
|
|
|
954 |
|
|
|
955 |
}
|
| 28825 |
tejbeer |
956 |
|
| 28381 |
tejbeer |
957 |
@RequestMapping(value = "/removePartnerPincode", method = RequestMethod.POST)
|
| 28825 |
tejbeer |
958 |
public String removePartnerPincode(HttpServletRequest request, @RequestParam int id,
|
|
|
959 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
|
|
960 |
throws Exception {
|
| 28381 |
tejbeer |
961 |
|
| 28825 |
tejbeer |
962 |
PincodePartnerRepository.delete(id);
|
| 28381 |
tejbeer |
963 |
|
| 28825 |
tejbeer |
964 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(fofoId);
|
|
|
965 |
|
|
|
966 |
LOGGER.info("partnerPincodeList" + partnerPincodeList);
|
|
|
967 |
|
|
|
968 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
|
|
969 |
|
| 28381 |
tejbeer |
970 |
return "pincode-partner-index";
|
|
|
971 |
|
|
|
972 |
}
|
| 28825 |
tejbeer |
973 |
|
| 28381 |
tejbeer |
974 |
@RequestMapping(value = "/removeSearchPincode", method = RequestMethod.POST)
|
| 28825 |
tejbeer |
975 |
public String removeSearchPincode(HttpServletRequest request, @RequestParam int id,
|
| 28381 |
tejbeer |
976 |
@RequestParam(name = "pin", required = true, defaultValue = "") String pin,
|
| 28825 |
tejbeer |
977 |
@RequestParam(name = "fofoId", required = true, defaultValue = "") int fofoId, Model model)
|
|
|
978 |
throws Exception {
|
| 28381 |
tejbeer |
979 |
|
| 28825 |
tejbeer |
980 |
PincodePartnerRepository.delete(id);
|
| 28381 |
tejbeer |
981 |
|
| 28825 |
tejbeer |
982 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pin);
|
| 28381 |
tejbeer |
983 |
|
| 28825 |
tejbeer |
984 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
|
|
985 |
|
|
|
986 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
|
|
987 |
|
|
|
988 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
|
|
989 |
|
| 28381 |
tejbeer |
990 |
return "search-pincode-partner";
|
|
|
991 |
|
|
|
992 |
}
|
| 28825 |
tejbeer |
993 |
|
| 28381 |
tejbeer |
994 |
@RequestMapping(value = "/searchPincodePartner", method = RequestMethod.GET)
|
|
|
995 |
public String searchPincodePartner(HttpServletRequest request,
|
| 28825 |
tejbeer |
996 |
@RequestParam(name = "pincode", required = true, defaultValue = "") String pincode, Model model)
|
|
|
997 |
throws Exception {
|
| 28381 |
tejbeer |
998 |
|
| 28825 |
tejbeer |
999 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectPartnersByPincode(pincode);
|
|
|
1000 |
|
| 28381 |
tejbeer |
1001 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
|
|
1002 |
|
|
|
1003 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 28825 |
tejbeer |
1004 |
|
| 28381 |
tejbeer |
1005 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 28825 |
tejbeer |
1006 |
|
| 28381 |
tejbeer |
1007 |
return "search-pincode-partner";
|
| 28825 |
tejbeer |
1008 |
|
| 28381 |
tejbeer |
1009 |
}
|
| 28825 |
tejbeer |
1010 |
|
| 28381 |
tejbeer |
1011 |
@RequestMapping(value = "/showPartnerPincode", method = RequestMethod.GET)
|
|
|
1012 |
public String showPartnerPincode(HttpServletRequest request,
|
| 28825 |
tejbeer |
1013 |
@RequestParam(name = "partnerId", required = true, defaultValue = "") int partnerId, Model model)
|
|
|
1014 |
throws Exception {
|
| 28381 |
tejbeer |
1015 |
|
| 28825 |
tejbeer |
1016 |
List<PincodePartner> partnerPincodeList = PincodePartnerRepository.selectByPartnerId(partnerId);
|
|
|
1017 |
|
| 28381 |
tejbeer |
1018 |
model.addAttribute("partnerPincodeList", partnerPincodeList);
|
| 28825 |
tejbeer |
1019 |
|
| 28381 |
tejbeer |
1020 |
return "pincode-partner-index";
|
| 28825 |
tejbeer |
1021 |
|
| 28381 |
tejbeer |
1022 |
}
|
| 28825 |
tejbeer |
1023 |
|
| 28381 |
tejbeer |
1024 |
@RequestMapping(value = "/getAllPartnerPincode", method = RequestMethod.GET)
|
| 28825 |
tejbeer |
1025 |
public String getAllPartnerPincode(HttpServletRequest request, Model model) throws Exception {
|
| 28381 |
tejbeer |
1026 |
|
|
|
1027 |
return "add-partner-pincode";
|
| 28825 |
tejbeer |
1028 |
|
| 28381 |
tejbeer |
1029 |
}
|
| 28272 |
tejbeer |
1030 |
}
|