| 21577 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 22486 |
ashik.ali |
3 |
import java.io.ByteArrayInputStream;
|
|
|
4 |
import java.io.ByteArrayOutputStream;
|
| 24917 |
tejbeer |
5 |
import java.io.IOException;
|
| 22486 |
ashik.ali |
6 |
import java.io.InputStream;
|
| 23886 |
amit.gupta |
7 |
import java.time.LocalDateTime;
|
| 24465 |
tejbeer |
8 |
import java.util.ArrayList;
|
| 24917 |
tejbeer |
9 |
import java.util.HashMap;
|
| 24465 |
tejbeer |
10 |
import java.util.HashSet;
|
| 24917 |
tejbeer |
11 |
import java.util.Iterator;
|
| 21577 |
ashik.ali |
12 |
import java.util.List;
|
| 21654 |
ashik.ali |
13 |
import java.util.Map;
|
| 24917 |
tejbeer |
14 |
import java.util.Optional;
|
| 24465 |
tejbeer |
15 |
import java.util.Set;
|
|
|
16 |
import java.util.stream.Collectors;
|
| 21577 |
ashik.ali |
17 |
|
| 24917 |
tejbeer |
18 |
import javax.mail.MessagingException;
|
|
|
19 |
import javax.mail.internet.InternetAddress;
|
|
|
20 |
import javax.mail.internet.MimeMessage;
|
| 21577 |
ashik.ali |
21 |
import javax.servlet.http.HttpServletRequest;
|
| 21987 |
kshitij.so |
22 |
import javax.servlet.http.HttpServletResponse;
|
| 21577 |
ashik.ali |
23 |
|
| 23886 |
amit.gupta |
24 |
import org.apache.logging.log4j.LogManager;
|
| 23568 |
govind |
25 |
import org.apache.logging.log4j.Logger;
|
| 24739 |
tejbeer |
26 |
import org.apache.thrift.TException;
|
| 24465 |
tejbeer |
27 |
import org.json.JSONObject;
|
| 21577 |
ashik.ali |
28 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23784 |
ashik.ali |
29 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 21987 |
kshitij.so |
30 |
import org.springframework.beans.factory.annotation.Value;
|
| 22486 |
ashik.ali |
31 |
import org.springframework.core.io.InputStreamResource;
|
|
|
32 |
import org.springframework.http.HttpHeaders;
|
|
|
33 |
import org.springframework.http.HttpStatus;
|
| 25140 |
amit.gupta |
34 |
import org.springframework.http.MediaType;
|
| 22472 |
ashik.ali |
35 |
import org.springframework.http.ResponseEntity;
|
| 24917 |
tejbeer |
36 |
import org.springframework.mail.javamail.JavaMailSender;
|
|
|
37 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| 21577 |
ashik.ali |
38 |
import org.springframework.stereotype.Controller;
|
| 21654 |
ashik.ali |
39 |
import org.springframework.transaction.annotation.Transactional;
|
| 21577 |
ashik.ali |
40 |
import org.springframework.ui.Model;
|
| 22472 |
ashik.ali |
41 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 21577 |
ashik.ali |
42 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 22472 |
ashik.ali |
43 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 21577 |
ashik.ali |
44 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
45 |
|
| 21987 |
kshitij.so |
46 |
import com.google.gson.Gson;
|
| 21577 |
ashik.ali |
47 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 21612 |
ashik.ali |
48 |
import com.spice.profitmandi.common.model.CustomCurrentInventorySnapshot;
|
| 24106 |
tejbeer |
49 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 22472 |
ashik.ali |
50 |
import com.spice.profitmandi.common.model.InventoryItemAgingModel;
|
| 24106 |
tejbeer |
51 |
import com.spice.profitmandi.common.model.ItemFeatureDataModel;
|
| 24917 |
tejbeer |
52 |
import com.spice.profitmandi.common.model.NotifyItemIdModel;
|
|
|
53 |
import com.spice.profitmandi.common.model.NotifyOrderIdModel;
|
|
|
54 |
import com.spice.profitmandi.common.model.NotifyOrderModel;
|
| 25140 |
amit.gupta |
55 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 21577 |
ashik.ali |
56 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 22472 |
ashik.ali |
57 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 25140 |
amit.gupta |
58 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 21987 |
kshitij.so |
59 |
import com.spice.profitmandi.common.util.Utils;
|
| 24123 |
tejbeer |
60 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 24950 |
tejbeer |
61 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 24106 |
tejbeer |
62 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
| 25371 |
tejbeer |
63 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
|
|
64 |
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
|
|
|
65 |
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
|
| 25140 |
amit.gupta |
66 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 24917 |
tejbeer |
67 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 24465 |
tejbeer |
68 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
|
|
69 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 24917 |
tejbeer |
70 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
| 25066 |
tejbeer |
71 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
| 24917 |
tejbeer |
72 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
| 24739 |
tejbeer |
73 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 25371 |
tejbeer |
74 |
import com.spice.profitmandi.dao.entity.user.Device;
|
|
|
75 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
|
|
76 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
|
|
77 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
| 24123 |
tejbeer |
78 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 24950 |
tejbeer |
79 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 24106 |
tejbeer |
80 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
| 24465 |
tejbeer |
81 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 24917 |
tejbeer |
82 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 25371 |
tejbeer |
83 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
|
|
84 |
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
|
| 24917 |
tejbeer |
85 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 25371 |
tejbeer |
86 |
import com.spice.profitmandi.dao.repository.dtr.UserCampaignRepository;
|
| 24203 |
amit.gupta |
87 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 24465 |
tejbeer |
88 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
|
|
89 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
| 24917 |
tejbeer |
90 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
|
|
91 |
import com.spice.profitmandi.dao.repository.transaction.NotifyColorChangeRepository;
|
|
|
92 |
import com.spice.profitmandi.dao.repository.transaction.NotifyItemRepository;
|
| 25066 |
tejbeer |
93 |
import com.spice.profitmandi.dao.repository.transaction.NotifyMessageRepository;
|
| 24917 |
tejbeer |
94 |
import com.spice.profitmandi.dao.repository.transaction.NotifyOrderRespository;
|
| 24658 |
tejbeer |
95 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 24739 |
tejbeer |
96 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 22927 |
ashik.ali |
97 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 24465 |
tejbeer |
98 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 22139 |
amit.gupta |
99 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 22069 |
ashik.ali |
100 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 24106 |
tejbeer |
101 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 21577 |
ashik.ali |
102 |
|
| 24658 |
tejbeer |
103 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 24739 |
tejbeer |
104 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 24658 |
tejbeer |
105 |
|
| 21577 |
ashik.ali |
106 |
@Controller
|
| 24123 |
tejbeer |
107 |
@Transactional(rollbackFor = Throwable.class)
|
| 21577 |
ashik.ali |
108 |
public class InventoryController {
|
| 21987 |
kshitij.so |
109 |
|
| 23568 |
govind |
110 |
private static final Logger LOGGER = LogManager.getLogger(InventoryController.class);
|
| 21987 |
kshitij.so |
111 |
|
| 21577 |
ashik.ali |
112 |
@Autowired
|
| 22927 |
ashik.ali |
113 |
private CookiesProcessor cookiesProcessor;
|
| 24123 |
tejbeer |
114 |
|
| 22354 |
ashik.ali |
115 |
@Autowired
|
| 23784 |
ashik.ali |
116 |
@Qualifier("fofoInventoryService")
|
| 22927 |
ashik.ali |
117 |
private InventoryService inventoryService;
|
| 24465 |
tejbeer |
118 |
|
| 24203 |
amit.gupta |
119 |
@Autowired
|
| 24950 |
tejbeer |
120 |
TagListingRepository tagListingRepository;
|
|
|
121 |
|
|
|
122 |
@Autowired
|
| 24203 |
amit.gupta |
123 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 24123 |
tejbeer |
124 |
|
| 24106 |
tejbeer |
125 |
@Autowired
|
|
|
126 |
private TagRankingRepository tagRankingRepository;
|
| 24123 |
tejbeer |
127 |
|
| 24106 |
tejbeer |
128 |
@Autowired
|
| 24465 |
tejbeer |
129 |
private InventoryItemRepository inventoryItemRepository;
|
|
|
130 |
|
|
|
131 |
@Autowired
|
|
|
132 |
private LiveDemoBillingRespository liveDemoBillingRespository;
|
|
|
133 |
|
|
|
134 |
@Autowired
|
| 24123 |
tejbeer |
135 |
private ItemRepository itemRepository;
|
|
|
136 |
|
|
|
137 |
@Autowired
|
| 24917 |
tejbeer |
138 |
private NotifyItemRepository notifyItemRespository;
|
|
|
139 |
|
|
|
140 |
@Autowired
|
| 24465 |
tejbeer |
141 |
private RetailerService retailerService;
|
|
|
142 |
|
|
|
143 |
@Autowired
|
| 24106 |
tejbeer |
144 |
private MVCResponseSender mvcResponseSender;
|
| 24123 |
tejbeer |
145 |
|
| 24465 |
tejbeer |
146 |
@Autowired
|
|
|
147 |
FofoStoreRepository fofoStoreRepository;
|
|
|
148 |
|
| 24658 |
tejbeer |
149 |
@Autowired
|
|
|
150 |
private OrderRepository orderRepository;
|
|
|
151 |
|
| 24739 |
tejbeer |
152 |
@Autowired
|
| 25037 |
amit.gupta |
153 |
private UserRepository saholicUserRepository;
|
| 24917 |
tejbeer |
154 |
@Autowired
|
|
|
155 |
private NotifyItemRepository notifyItemRepository;
|
| 24739 |
tejbeer |
156 |
|
| 24917 |
tejbeer |
157 |
@Autowired
|
|
|
158 |
private NotifyColorChangeRepository notifyColorChangeRepository;
|
|
|
159 |
|
|
|
160 |
@Autowired
|
|
|
161 |
private NotifyOrderRespository notifyOrderRespository;
|
|
|
162 |
|
|
|
163 |
@Autowired
|
| 25066 |
tejbeer |
164 |
private NotifyMessageRepository notifyMessageRepository;
|
|
|
165 |
|
|
|
166 |
@Autowired
|
| 24917 |
tejbeer |
167 |
private UserAccountRepository userAccountRepository;
|
|
|
168 |
|
| 21987 |
kshitij.so |
169 |
@Value("${saholic.api.host}")
|
|
|
170 |
private String host;
|
| 23786 |
amit.gupta |
171 |
|
| 21987 |
kshitij.so |
172 |
@Value("${saholic.api.port}")
|
|
|
173 |
private int port;
|
| 23786 |
amit.gupta |
174 |
|
| 21987 |
kshitij.so |
175 |
@Value("${saholic.api.webapp}")
|
|
|
176 |
private String webapp;
|
|
|
177 |
|
| 24917 |
tejbeer |
178 |
@Autowired
|
|
|
179 |
JavaMailSender mailSender;
|
|
|
180 |
|
|
|
181 |
@Autowired
|
| 25371 |
tejbeer |
182 |
private NotificationCampaignRepository notificationCampaignRepository;
|
|
|
183 |
|
|
|
184 |
@Autowired
|
|
|
185 |
private DeviceRepository deviceRepository;
|
|
|
186 |
|
|
|
187 |
@Autowired
|
| 24917 |
tejbeer |
188 |
private Mongo mongoClient;
|
|
|
189 |
|
| 25371 |
tejbeer |
190 |
@Autowired
|
|
|
191 |
private PushNotificationRepository pushNotificationRepository;
|
|
|
192 |
|
|
|
193 |
@Autowired
|
|
|
194 |
private UserCampaignRepository userCampaignRepository;
|
|
|
195 |
|
|
|
196 |
@Autowired
|
|
|
197 |
private Gson gson;
|
|
|
198 |
|
| 23786 |
amit.gupta |
199 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
|
|
200 |
public String getCurrentAvailability(HttpServletRequest request,
|
|
|
201 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
202 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 24123 |
tejbeer |
203 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| 23786 |
amit.gupta |
204 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
205 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
206 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit,
|
|
|
207 |
searchTerm);
|
| 22927 |
ashik.ali |
208 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
209 |
return "inventory-snapshot";
|
| 21612 |
ashik.ali |
210 |
}
|
| 21987 |
kshitij.so |
211 |
|
| 23786 |
amit.gupta |
212 |
@RequestMapping(value = "/getBadInventorySnapshot")
|
|
|
213 |
public String getBadAvailability(HttpServletRequest request,
|
|
|
214 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
215 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
216 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
|
|
217 |
throws ProfitMandiBusinessException {
|
| 24123 |
tejbeer |
218 |
if (searchTerm == null) {
|
|
|
219 |
searchTerm = "";
|
| 24052 |
amit.gupta |
220 |
}
|
| 22927 |
ashik.ali |
221 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
222 |
Map<String, Object> map = inventoryService.getBadInventorySnapshot(loginDetails.getFofoId(), offset, limit,
|
|
|
223 |
searchTerm);
|
| 22927 |
ashik.ali |
224 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
225 |
return "bad-inventory-snapshot";
|
|
|
226 |
}
|
|
|
227 |
|
| 23786 |
amit.gupta |
228 |
@RequestMapping(value = "/getPaginatedCurrentInventorySnapshot")
|
|
|
229 |
public String getPaginatedCurrentInventorySnapshot(HttpServletRequest request,
|
|
|
230 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
231 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
232 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
|
|
233 |
throws ProfitMandiBusinessException {
|
| 24123 |
tejbeer |
234 |
if (searchTerm == null) {
|
|
|
235 |
searchTerm = "";
|
| 24052 |
amit.gupta |
236 |
}
|
| 22927 |
ashik.ali |
237 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
238 |
Map<String, Object> map = inventoryService.getPaginatedCurrentInventorySnapshot(loginDetails.getFofoId(),
|
|
|
239 |
offset, limit, searchTerm);
|
| 22927 |
ashik.ali |
240 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
241 |
return "inventory-snapshot-paginated";
|
|
|
242 |
}
|
| 23786 |
amit.gupta |
243 |
|
|
|
244 |
@RequestMapping(value = "/getCatalog")
|
|
|
245 |
public String getCatalog(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
246 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
247 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
|
|
248 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
249 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24123 |
tejbeer |
250 |
if (searchTerm == null) {
|
|
|
251 |
searchTerm = "";
|
| 24052 |
amit.gupta |
252 |
}
|
| 24739 |
tejbeer |
253 |
|
| 22927 |
ashik.ali |
254 |
Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
|
|
|
255 |
model.addAllAttributes(map);
|
| 24203 |
amit.gupta |
256 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
| 24658 |
tejbeer |
257 |
|
| 21987 |
kshitij.so |
258 |
return "catalog";
|
|
|
259 |
}
|
| 23786 |
amit.gupta |
260 |
|
| 24465 |
tejbeer |
261 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
| 24203 |
amit.gupta |
262 |
private boolean hasGift(int fofoId) {
|
|
|
263 |
try {
|
| 24465 |
tejbeer |
264 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
|
|
|
265 |
.getAvailability() > 0;
|
| 24203 |
amit.gupta |
266 |
} catch (ProfitMandiBusinessException e) {
|
|
|
267 |
return false;
|
|
|
268 |
}
|
|
|
269 |
}
|
|
|
270 |
|
| 23786 |
amit.gupta |
271 |
@RequestMapping(value = "/getPaginatedCatalog")
|
|
|
272 |
public String getCatalogPaginated(HttpServletRequest request,
|
|
|
273 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
274 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
275 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
|
|
276 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
277 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24123 |
tejbeer |
278 |
if (searchTerm == null) {
|
|
|
279 |
searchTerm = "";
|
| 24052 |
amit.gupta |
280 |
}
|
| 23786 |
amit.gupta |
281 |
Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit,
|
|
|
282 |
searchTerm);
|
| 22927 |
ashik.ali |
283 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
284 |
return "catalog-paginated";
|
|
|
285 |
}
|
|
|
286 |
|
| 23786 |
amit.gupta |
287 |
@RequestMapping(value = "/checkItemAvailability")
|
|
|
288 |
public String getItemAvailability(HttpServletRequest request,
|
|
|
289 |
@RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model)
|
|
|
290 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
291 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
292 |
CustomCurrentInventorySnapshot customCurrentInventorySnapshot = inventoryService.checkItemAvailability(itemId,
|
|
|
293 |
loginDetails.getFofoId());
|
|
|
294 |
customCurrentInventorySnapshot
|
|
|
295 |
.setIconUrl(Utils.getIconUrl(customCurrentInventorySnapshot.getCatalogItemId(), host, port, webapp));
|
| 22927 |
ashik.ali |
296 |
model.addAttribute("currentInventorySnapshot", new Gson().toJson(customCurrentInventorySnapshot));
|
|
|
297 |
return "current-item-availability";
|
| 23786 |
amit.gupta |
298 |
|
| 21577 |
ashik.ali |
299 |
}
|
| 23786 |
amit.gupta |
300 |
|
| 23192 |
ashik.ali |
301 |
@RequestMapping(value = "/cart", method = RequestMethod.POST)
|
| 23786 |
amit.gupta |
302 |
public String addToCart(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model)
|
|
|
303 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
304 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
305 |
|
| 22927 |
ashik.ali |
306 |
Map<String, Object> map = inventoryService.addToCart(cartData, loginDetails.getFofoId());
|
|
|
307 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
308 |
return "cart";
|
|
|
309 |
}
|
| 23786 |
amit.gupta |
310 |
|
| 23192 |
ashik.ali |
311 |
@RequestMapping(value = "/validate-cart", method = RequestMethod.POST)
|
| 23786 |
amit.gupta |
312 |
public String validateCart(HttpServletRequest request, HttpServletResponse response,
|
|
|
313 |
@RequestParam(name = "cartData") String cartData, Model model) throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
314 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
315 |
|
| 22927 |
ashik.ali |
316 |
Map<String, Object> map = inventoryService.validateCart(cartData, loginDetails.getFofoId());
|
|
|
317 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
318 |
return "validate-cart";
|
|
|
319 |
}
|
|
|
320 |
|
| 23786 |
amit.gupta |
321 |
@RequestMapping(value = "/grnHistory")
|
| 24123 |
tejbeer |
322 |
public String getGrnHistory(HttpServletRequest request, @RequestParam(required = false) LocalDateTime startTime,
|
| 23886 |
amit.gupta |
323 |
@RequestParam(required = false) LocalDateTime endTime,
|
| 23786 |
amit.gupta |
324 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
325 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
326 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
|
|
327 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
|
|
328 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
329 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24123 |
tejbeer |
330 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTime, endTime, offset,
|
|
|
331 |
limit, purchaseReference, searchType);
|
| 22927 |
ashik.ali |
332 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
333 |
return "grn-history";
|
| 21636 |
ashik.ali |
334 |
}
|
| 21987 |
kshitij.so |
335 |
|
| 25140 |
amit.gupta |
336 |
@RequestMapping(value = "/downloadPurchaseInvoices")
|
|
|
337 |
public ResponseEntity<?> downloadPurchaseInvoices(HttpServletRequest request,
|
|
|
338 |
@RequestParam(required = false) LocalDateTime startTime,
|
|
|
339 |
@RequestParam(required = false) LocalDateTime endTime,
|
|
|
340 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
341 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
342 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
|
|
343 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
|
|
344 |
throws ProfitMandiBusinessException {
|
|
|
345 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
346 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTime, endTime, offset,
|
|
|
347 |
limit, purchaseReference, searchType);
|
|
|
348 |
|
|
|
349 |
List<FofoOrder> fofoOrders = (List<FofoOrder>) map.get("saleHistories");
|
|
|
350 |
|
|
|
351 |
if (fofoOrders.size() == 0) {
|
|
|
352 |
throw new ProfitMandiBusinessException("Search criteria", "", "No orders found for criteria");
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
final HttpHeaders headers = new HttpHeaders();
|
|
|
356 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
|
|
357 |
headers.set("Content-disposition", "inline; filename=invoices.pdf");
|
|
|
358 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
359 |
List<PdfModel> pdfModels = new ArrayList<>();
|
| 25371 |
tejbeer |
360 |
/*
|
|
|
361 |
* for (FofoOrder fofoOrder : fofoOrders) { try {
|
|
|
362 |
* pdfModels.add(orderService.getInvoicePdfModel(fofoOrder.getId())); } catch
|
|
|
363 |
* (Exception e) {
|
|
|
364 |
* LOGGER.info("could not create invoice for {}, invoice number {}",
|
|
|
365 |
* fofoOrder.getId(), fofoOrder.getInvoiceNumber()); } }
|
|
|
366 |
*/
|
| 25140 |
amit.gupta |
367 |
PdfUtils.generateAndWrite(pdfModels, byteArrayOutputStream);
|
|
|
368 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
|
|
369 |
final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
|
|
370 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
|
|
371 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
|
|
372 |
}
|
|
|
373 |
|
| 23786 |
amit.gupta |
374 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
|
|
375 |
public String getPaginatedGrnHistory(HttpServletRequest request,
|
| 23886 |
amit.gupta |
376 |
@RequestParam(required = false) LocalDateTime startTime,
|
|
|
377 |
@RequestParam(required = false) LocalDateTime endTime,
|
| 23786 |
amit.gupta |
378 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
379 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
|
|
380 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
|
|
381 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
|
|
382 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
383 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24123 |
tejbeer |
384 |
Map<String, Object> map = inventoryService.getPaginatedGrnHistory(loginDetails.getFofoId(), startTime, endTime,
|
|
|
385 |
offset, limit);
|
| 22927 |
ashik.ali |
386 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
387 |
return "grn-history-paginated";
|
|
|
388 |
}
|
|
|
389 |
|
| 23786 |
amit.gupta |
390 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|
|
|
391 |
public String grnHistoryByPurchaseId(HttpServletRequest request,
|
|
|
392 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_ID) int purchaseId, Model model)
|
|
|
393 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
394 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
395 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseId, host, port,
|
|
|
396 |
webapp);
|
| 22927 |
ashik.ali |
397 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
398 |
return "grn-details";
|
| 21636 |
ashik.ali |
399 |
}
|
| 21987 |
kshitij.so |
400 |
|
| 23786 |
amit.gupta |
401 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseReference")
|
|
|
402 |
public String grnHistoryByPurchaseReference(HttpServletRequest request,
|
|
|
403 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE) String purchaseReference, Model model)
|
|
|
404 |
throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
405 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
406 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseReference,
|
|
|
407 |
host, port, webapp);
|
| 22927 |
ashik.ali |
408 |
model.addAllAttributes(map);
|
| 21987 |
kshitij.so |
409 |
return "grn-details";
|
| 21654 |
ashik.ali |
410 |
}
|
| 23786 |
amit.gupta |
411 |
|
| 22472 |
ashik.ali |
412 |
@RequestMapping(value = "/getInventoryItemAgingByInterval", method = RequestMethod.POST)
|
| 23786 |
amit.gupta |
413 |
public String getInventoryItemAgingByInterval(HttpServletRequest request, @RequestBody List<Integer> intervals,
|
|
|
414 |
Model model, @RequestParam(name = "searchContent", defaultValue = "") String searchContent,
|
|
|
415 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
416 |
@RequestParam(name = "limit", defaultValue = "10") int limit) throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
417 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
418 |
Map<String, Object> map = inventoryService.getPaginatedItemAgingByInterval(loginDetails.getFofoId(), intervals,
|
|
|
419 |
searchContent, offset, limit);
|
| 22927 |
ashik.ali |
420 |
model.addAllAttributes(map);
|
| 22523 |
ashik.ali |
421 |
return "item-aging";
|
|
|
422 |
}
|
| 23786 |
amit.gupta |
423 |
|
| 22523 |
ashik.ali |
424 |
@RequestMapping(value = "/downloadInventoryItemAgingByInterval", method = RequestMethod.POST)
|
| 23786 |
amit.gupta |
425 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
|
|
426 |
@RequestBody List<Integer> intervals, Model model) throws ProfitMandiBusinessException {
|
| 22927 |
ashik.ali |
427 |
LOGGER.info("Request received at url{} with body {}", request.getRequestURI(), intervals);
|
|
|
428 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 23786 |
amit.gupta |
429 |
|
|
|
430 |
List<InventoryItemAgingModel> inventoryItemAgingModels = inventoryService
|
|
|
431 |
.getItemAgingByInterval(fofoDetails.getFofoId(), intervals);
|
|
|
432 |
|
| 22486 |
ashik.ali |
433 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
434 |
ExcelUtils.writeInventoryItemAgingModels(inventoryItemAgingModels, intervals, byteArrayOutputStream);
|
| 23786 |
amit.gupta |
435 |
|
|
|
436 |
final HttpHeaders headers = new HttpHeaders();
|
|
|
437 |
// private static final String CONTENT_TYPE_XLSX =
|
|
|
438 |
// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
439 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
440 |
// headers.set("Content-Type", "application/vnd.ms-excel");
|
| 22486 |
ashik.ali |
441 |
headers.set("Content-disposition", "inline; filename=InventoryItemAging.xlsx");
|
| 23786 |
amit.gupta |
442 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
|
|
443 |
final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
|
|
444 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
|
|
445 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
|
|
446 |
|
| 24123 |
tejbeer |
447 |
// return
|
|
|
448 |
// responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 22472 |
ashik.ali |
449 |
}
|
| 24123 |
tejbeer |
450 |
|
| 24106 |
tejbeer |
451 |
@RequestMapping(value = "/featurePanel", method = RequestMethod.GET)
|
| 25371 |
tejbeer |
452 |
public String FeaturePanel(HttpServletRequest request, Model model) throws Exception {
|
| 21987 |
kshitij.so |
453 |
|
| 24106 |
tejbeer |
454 |
List<TagRanking> tagRanking = null;
|
| 25362 |
tejbeer |
455 |
tagRanking = tagRankingRepository.getAllTagRanking();
|
| 24106 |
tejbeer |
456 |
LOGGER.info("tagRanking" + tagRanking);
|
|
|
457 |
if (!tagRanking.isEmpty()) {
|
| 25371 |
tejbeer |
458 |
Set<Integer> catalogIds = tagRanking.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
|
| 24798 |
tejbeer |
459 |
List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
|
|
|
460 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
|
|
461 |
x -> x.getItemDescription(), (description1, description2) -> description1));
|
|
|
462 |
|
|
|
463 |
LOGGER.info("catalogDescription" + catalogDescription);
|
| 24465 |
tejbeer |
464 |
model.addAttribute("tagRanking", tagRanking);
|
| 24798 |
tejbeer |
465 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 24106 |
tejbeer |
466 |
|
|
|
467 |
} else {
|
|
|
468 |
model.addAttribute("tagRanking", tagRanking);
|
| 25362 |
tejbeer |
469 |
|
| 24106 |
tejbeer |
470 |
}
|
|
|
471 |
|
|
|
472 |
return "feature";
|
|
|
473 |
|
|
|
474 |
}
|
| 24123 |
tejbeer |
475 |
|
| 24798 |
tejbeer |
476 |
/*
|
| 24917 |
tejbeer |
477 |
* @RequestMapping(value = "/getPaginatedfeature", method = RequestMethod.GET)
|
|
|
478 |
* public String getPaginatedFeaturePanel(HttpServletRequest request,
|
| 24798 |
tejbeer |
479 |
*
|
|
|
480 |
* @RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
481 |
*
|
| 24917 |
tejbeer |
482 |
* @RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
483 |
* throws ProfitMandiBusinessException {
|
| 24798 |
tejbeer |
484 |
* LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
|
|
485 |
* List<TagRanking> tagRanking = null;
|
|
|
486 |
*
|
|
|
487 |
*
|
| 24917 |
tejbeer |
488 |
* long size = 0; tagRanking = tagRankingRepository.selectAllTagRanking(offset,
|
|
|
489 |
* limit); if (!tagRanking.isEmpty()) {
|
| 24798 |
tejbeer |
490 |
*
|
|
|
491 |
* model.addAttribute("tagRanking", tagRanking); model.addAttribute("start",
|
|
|
492 |
* offset + 1); model.addAttribute("size", size); model.addAttribute("url",
|
|
|
493 |
* "/getPaginatedfeature");
|
|
|
494 |
*
|
|
|
495 |
* } else { model.addAttribute("tagRanking", tagRanking); } return
|
|
|
496 |
* "feature-paginated"; }
|
|
|
497 |
*/
|
| 24106 |
tejbeer |
498 |
@RequestMapping(value = "/itemfeature", method = RequestMethod.POST)
|
| 24123 |
tejbeer |
499 |
public String Itemfeature(HttpServletRequest request, @RequestBody ItemFeatureDataModel itemFeatureDatatModel,
|
|
|
500 |
Model model) throws Exception {
|
| 25371 |
tejbeer |
501 |
TagRanking tagRanking = tagRankingRepository.selectBycatalogItemId(itemFeatureDatatModel.getCatalogItemId());
|
|
|
502 |
LOGGER.info("tagRanking" + tagRanking);
|
|
|
503 |
if (tagRanking == null) {
|
|
|
504 |
tagRanking = new TagRanking();
|
|
|
505 |
tagRanking.setCatalogItemId(itemFeatureDatatModel.getCatalogItemId());
|
| 25363 |
tejbeer |
506 |
}
|
| 24106 |
tejbeer |
507 |
tagRanking.setFeature(itemFeatureDatatModel.getFeature());
|
| 25363 |
tejbeer |
508 |
tagRanking.setRankPoints(itemFeatureDatatModel.getRankPoints());
|
| 25371 |
tejbeer |
509 |
|
| 24123 |
tejbeer |
510 |
tagRankingRepository.persist(tagRanking);
|
| 24106 |
tejbeer |
511 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
512 |
return "response";
|
|
|
513 |
}
|
|
|
514 |
|
| 24798 |
tejbeer |
515 |
@RequestMapping(value = "/removeFeature", method = RequestMethod.DELETE)
|
|
|
516 |
public String removeTagRankingEnteries(HttpServletRequest request,
|
|
|
517 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 24917 |
tejbeer |
518 |
|
| 24798 |
tejbeer |
519 |
tagRankingRepository.deleteById(id);
|
|
|
520 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
521 |
return "response";
|
|
|
522 |
}
|
|
|
523 |
|
| 24465 |
tejbeer |
524 |
@RequestMapping(value = "/getDemolistbyfofoId", method = RequestMethod.GET)
|
|
|
525 |
public String DemoListbyFofoId(HttpServletRequest request,
|
|
|
526 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
|
|
527 |
|
|
|
528 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
|
|
529 |
.collect(Collectors.toList());
|
|
|
530 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
|
|
531 |
String customRetailers = JSONObject.valueToString(customRetailersMap.values());
|
|
|
532 |
List<String> serailNumberList = liveDemoBillingRespository.selectAllSerialNumber();
|
|
|
533 |
LOGGER.info("serailNumberList" + serailNumberList);
|
|
|
534 |
List<InventoryItem> inventoryItem = null;
|
|
|
535 |
List<InventoryItem> inventoryItem1 = new ArrayList<>();
|
|
|
536 |
if (fofoId > 0) {
|
|
|
537 |
List<Item> items = itemRepository.selectAllByBrand("Live Demo");
|
|
|
538 |
Set<Integer> itemIds = new HashSet<>();
|
|
|
539 |
for (Item Item : items) {
|
|
|
540 |
itemIds.add(Item.getId());
|
|
|
541 |
}
|
|
|
542 |
inventoryItem = inventoryItemRepository.selectByFofoIdItemIds(fofoId, itemIds);
|
|
|
543 |
|
|
|
544 |
Set<String> serial = new HashSet<>();
|
|
|
545 |
for (InventoryItem invItem : inventoryItem) {
|
| 24658 |
tejbeer |
546 |
if (!serailNumberList.contains(invItem.getSerialNumber())) {
|
| 24465 |
tejbeer |
547 |
inventoryItem1.add(invItem);
|
| 25371 |
tejbeer |
548 |
|
| 24465 |
tejbeer |
549 |
}
|
|
|
550 |
|
|
|
551 |
}
|
|
|
552 |
|
|
|
553 |
LOGGER.info("inventoyItem" + inventoryItem1);
|
|
|
554 |
model.addAttribute("customRetailers", customRetailers);
|
| 25371 |
tejbeer |
555 |
|
| 24465 |
tejbeer |
556 |
model.addAttribute("liveDemo", inventoryItem1);
|
|
|
557 |
CustomRetailer fofoIdsAndRetailerName = retailerService.getFofoRetailer(fofoId);
|
|
|
558 |
|
|
|
559 |
model.addAttribute("fofoIdsAndRetailerName", fofoIdsAndRetailerName);
|
|
|
560 |
|
|
|
561 |
}
|
|
|
562 |
|
|
|
563 |
else {
|
|
|
564 |
model.addAttribute("customRetailers", customRetailers);
|
|
|
565 |
model.addAttribute("liveDemo", inventoryItem1);
|
|
|
566 |
}
|
|
|
567 |
|
|
|
568 |
return "live_demo_billing";
|
|
|
569 |
|
|
|
570 |
}
|
|
|
571 |
|
|
|
572 |
@RequestMapping(value = "/enableliveDemoSerailNumber", method = RequestMethod.POST)
|
|
|
573 |
public String EnableliveDemoSerailNumber(HttpServletRequest request, @RequestParam String serial_number,
|
|
|
574 |
Model model) throws Exception {
|
|
|
575 |
|
|
|
576 |
LiveDemoSerialNumber liveDemoSerialNumber = new LiveDemoSerialNumber();
|
|
|
577 |
liveDemoSerialNumber.setSerialNumber(serial_number);
|
|
|
578 |
|
|
|
579 |
liveDemoBillingRespository.persist(liveDemoSerialNumber);
|
|
|
580 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
581 |
return "response";
|
|
|
582 |
}
|
|
|
583 |
|
| 24739 |
tejbeer |
584 |
@RequestMapping(value = "/getInProcessOrder", method = RequestMethod.GET)
|
|
|
585 |
public String getInProcessOrder(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
|
|
586 |
|
|
|
587 |
List<com.spice.profitmandi.dao.entity.transaction.Order> inProcessorder = orderRepository
|
| 25067 |
tejbeer |
588 |
.selectAllOrder(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| 24917 |
tejbeer |
589 |
List<Integer> retailerIds = new ArrayList<>();
|
|
|
590 |
List<Integer> orderIds = new ArrayList<>();
|
|
|
591 |
if (!inProcessorder.isEmpty()) {
|
|
|
592 |
for (com.spice.profitmandi.dao.entity.transaction.Order order : inProcessorder) {
|
|
|
593 |
retailerIds.add(order.getRetailerId());
|
|
|
594 |
orderIds.add(order.getId());
|
| 24739 |
tejbeer |
595 |
|
| 24917 |
tejbeer |
596 |
}
|
| 24739 |
tejbeer |
597 |
|
| 25449 |
tejbeer |
598 |
|
|
|
599 |
List<NotifyOrder> notify = notifyOrderRespository.selectByorderIds(orderIds);
|
|
|
600 |
for (NotifyOrder notifyOrder : notify) {
|
|
|
601 |
|
|
|
602 |
Order orderdetail = orderRepository.selectById(notifyOrder.getOrderId());
|
|
|
603 |
if (!orderdetail.getStatus().equals(OrderStatus.SUBMITTED_FOR_PROCESSING)) {
|
|
|
604 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
|
|
605 |
}
|
|
|
606 |
}
|
|
|
607 |
/* for (NotifyOrder notifyOrder : notify) { List<NotifyItem> notifyItems =
|
| 25383 |
tejbeer |
608 |
* notifyItemRepository.selectByNotifyId(notifyOrder.getNotifyId());
|
|
|
609 |
* Iterator<NotifyItem> notifyItemsIterator = notifyItems.iterator();
|
|
|
610 |
*
|
|
|
611 |
* while (notifyItemsIterator.hasNext()) { NotifyItem notifyItem =
|
|
|
612 |
* notifyItemsIterator.next(); if
|
|
|
613 |
* (LocalDateTime.now().isAfter(notifyItem.getResponseTime())) {
|
|
|
614 |
* notifyItemsIterator.remove(); } } if (notifyItems.size() == 0) { if
|
|
|
615 |
* (NotifyStatus.pending == notifyOrder.getStatus()) {
|
|
|
616 |
* notifyOrder.setStatus(NotifyStatus.rejected); } }
|
|
|
617 |
*
|
|
|
618 |
* }
|
|
|
619 |
*/
|
| 24950 |
tejbeer |
620 |
|
| 24917 |
tejbeer |
621 |
Map<Integer, Optional<NotifyOrder>> notifyOrders = notifyOrderRespository.selectByorderIds(orderIds)
|
|
|
622 |
.stream().collect(Collectors.groupingBy(NotifyOrder::getOrderId,
|
|
|
623 |
Collectors.maxBy((x1, x2) -> x1.getId() - x2.getId())));
|
| 24950 |
tejbeer |
624 |
|
| 24917 |
tejbeer |
625 |
Map<Integer, String> storeIdAndFofoIdMap = fofoStoreRepository.selectByRetailerIds(retailerIds).stream()
|
|
|
626 |
.collect(Collectors.toMap(FofoStore::getId, FofoStore::getCode));
|
|
|
627 |
List<com.spice.profitmandi.dao.entity.transaction.Order> pendingPaymentorder = orderRepository
|
|
|
628 |
.selectAllOrderDatesBetweenByStatus(LocalDateTime.now().minusDays(30), LocalDateTime.now(),
|
|
|
629 |
OrderStatus.PAYMENT_PENDING);
|
|
|
630 |
List<com.spice.profitmandi.dao.entity.transaction.Order> failedPaymentorder = orderRepository
|
|
|
631 |
.selectAllOrderDatesBetweenByStatus(LocalDateTime.now().minusDays(30), LocalDateTime.now(),
|
|
|
632 |
OrderStatus.PAYMENT_FAILED);
|
|
|
633 |
pendingPaymentorder.addAll(failedPaymentorder);
|
|
|
634 |
|
|
|
635 |
model.addAttribute("inProcessorder", inProcessorder);
|
|
|
636 |
model.addAttribute("storeIdAndFofoIdMap", storeIdAndFofoIdMap);
|
|
|
637 |
model.addAttribute("pendingPaymentorder", pendingPaymentorder);
|
|
|
638 |
model.addAttribute("latestNotifyOrders", notifyOrders);
|
|
|
639 |
} else {
|
|
|
640 |
model.addAttribute("inProcessorder", inProcessorder);
|
|
|
641 |
}
|
| 24739 |
tejbeer |
642 |
return "review_order";
|
|
|
643 |
}
|
|
|
644 |
|
|
|
645 |
@RequestMapping(value = "/getKeepInTabOrder", method = RequestMethod.GET)
|
|
|
646 |
public String getKeepInTabOrder(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
|
|
647 |
|
|
|
648 |
List<com.spice.profitmandi.dao.entity.transaction.Order> keepatab = orderRepository
|
|
|
649 |
.selectAllOrder(OrderStatus.KEEP_A_TAB);
|
|
|
650 |
|
|
|
651 |
model.addAttribute("keepatab", keepatab);
|
|
|
652 |
|
|
|
653 |
return "keep-a-tab";
|
|
|
654 |
}
|
|
|
655 |
|
|
|
656 |
@RequestMapping(value = "/closeOrder", method = RequestMethod.POST)
|
|
|
657 |
public String closeOrder(HttpServletRequest request, @RequestParam int orderId, Model model) throws Exception {
|
| 24798 |
tejbeer |
658 |
|
| 24739 |
tejbeer |
659 |
Order order = orderRepository.selectById(orderId);
|
| 24798 |
tejbeer |
660 |
if (order != null) {
|
| 24739 |
tejbeer |
661 |
order.setStatus(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
|
| 24798 |
tejbeer |
662 |
|
| 24739 |
tejbeer |
663 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
664 |
|
| 24798 |
tejbeer |
665 |
} else {
|
| 24739 |
tejbeer |
666 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
|
|
667 |
|
|
|
668 |
}
|
|
|
669 |
return "response";
|
| 24658 |
tejbeer |
670 |
}
|
|
|
671 |
|
| 24739 |
tejbeer |
672 |
@RequestMapping(value = "/cancelOrder", method = RequestMethod.POST)
|
|
|
673 |
public String cancelOrder(HttpServletRequest request, @RequestParam int orderId, @RequestParam String reason,
|
|
|
674 |
@RequestParam OrderStatus orderStatus, Model model) throws Exception {
|
|
|
675 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 25140 |
amit.gupta |
676 |
// User userInfo = saholicUserRepository.selectById(loginDetails.getFofoId());
|
| 24739 |
tejbeer |
677 |
LOGGER.info("status" + orderStatus);
|
|
|
678 |
try {
|
| 25039 |
amit.gupta |
679 |
Order order = orderRepository.selectById(orderId);
|
| 25037 |
amit.gupta |
680 |
orderRepository.refundOrder(orderId, loginDetails.getEmailId(), reason, orderStatus);
|
| 25449 |
tejbeer |
681 |
List<NotifyOrder> notifyOrders = notifyOrderRespository.selectByOrder(orderId);
|
|
|
682 |
for (NotifyOrder notifyOrder : notifyOrders) {
|
|
|
683 |
if (notifyOrder.getStatus() == NotifyStatus.pending) {
|
|
|
684 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
|
|
685 |
}
|
|
|
686 |
}
|
| 25039 |
amit.gupta |
687 |
sendCancellationNotificationToPartner(order, reason);
|
| 24739 |
tejbeer |
688 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
689 |
|
|
|
690 |
} catch (TransactionServiceException | TException e) {
|
|
|
691 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
|
|
692 |
|
|
|
693 |
}
|
|
|
694 |
return "response";
|
|
|
695 |
}
|
|
|
696 |
|
| 25039 |
amit.gupta |
697 |
private void sendCancellationNotificationToPartner(Order order, String reason) throws Exception {
|
|
|
698 |
Item item = itemRepository.selectById(order.getLineItem().getItemId());
|
| 25383 |
tejbeer |
699 |
|
| 25371 |
tejbeer |
700 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
|
|
701 |
scp.setTitle(String.format("Order %s %d(Pcs) cancelled", item.getItemDescription(),
|
| 25140 |
amit.gupta |
702 |
order.getLineItem().getQuantity()));
|
| 25371 |
tejbeer |
703 |
scp.setMessage(reason);
|
|
|
704 |
scp.setType("url");
|
| 25453 |
tejbeer |
705 |
scp.setUrl("/pages/home/orderDetails");
|
| 25371 |
tejbeer |
706 |
scp.setExpireTimestamp(LocalDateTime.now().plusDays(2));
|
|
|
707 |
SimpleCampaign sc = new SimpleCampaign(scp);
|
|
|
708 |
sc.setSimpleCampaignParams(scp);
|
| 25140 |
amit.gupta |
709 |
|
| 25371 |
tejbeer |
710 |
NotificationCampaign nc = new NotificationCampaign();
|
|
|
711 |
nc.setName("Order Cancellation");
|
|
|
712 |
nc.setImplementationType("SimpleCampaign");
|
|
|
713 |
nc.setImplementationParams(gson.toJson(scp));
|
|
|
714 |
nc.setCreatedTimestamp(LocalDateTime.now());
|
|
|
715 |
notificationCampaignRepository.persist(nc);
|
| 25039 |
amit.gupta |
716 |
|
| 25371 |
tejbeer |
717 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
|
|
718 |
UserCampaign uc = new UserCampaign();
|
|
|
719 |
uc.setCampaignId(nc.getId());
|
|
|
720 |
uc.setUserId(userId);
|
|
|
721 |
uc.setPushTimestamp(LocalDateTime.now());
|
|
|
722 |
userCampaignRepository.persist(uc);
|
|
|
723 |
List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
|
|
|
724 |
LocalDateTime.now().minusMonths(3), LocalDateTime.now());
|
|
|
725 |
pushNotification(nc.getId(), devices);
|
| 25140 |
amit.gupta |
726 |
|
| 25039 |
amit.gupta |
727 |
}
|
|
|
728 |
|
| 24917 |
tejbeer |
729 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
|
|
730 |
public String getNotifyItemColor(HttpServletRequest request, @RequestParam int catalogItemId,
|
|
|
731 |
@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
|
|
|
732 |
|
| 24950 |
tejbeer |
733 |
List<Item> availableColorItems = itemRepository.selectAllByCatalogItemId(catalogItemId);
|
|
|
734 |
Iterator<Item> itemsIterator = availableColorItems.iterator();
|
| 24917 |
tejbeer |
735 |
|
| 24950 |
tejbeer |
736 |
while (itemsIterator.hasNext()) {
|
|
|
737 |
Item item = itemsIterator.next();
|
|
|
738 |
TagListing itemTagListing = tagListingRepository.selectByItemId(item.getId());
|
|
|
739 |
|
|
|
740 |
if (itemTagListing == null) {
|
|
|
741 |
itemsIterator.remove();
|
|
|
742 |
|
|
|
743 |
}
|
|
|
744 |
|
|
|
745 |
else if (!itemTagListing.isActive()) {
|
|
|
746 |
itemsIterator.remove();
|
|
|
747 |
|
|
|
748 |
}
|
|
|
749 |
}
|
|
|
750 |
|
| 24917 |
tejbeer |
751 |
List<Order> inProcessselectedOrder = orderRepository.selectByItemIdOrderStatus(itemId,
|
|
|
752 |
OrderStatus.SUBMITTED_FOR_PROCESSING);
|
|
|
753 |
List<Integer> retailerIds = new ArrayList<>();
|
|
|
754 |
|
|
|
755 |
for (com.spice.profitmandi.dao.entity.transaction.Order order : inProcessselectedOrder) {
|
|
|
756 |
retailerIds.add(order.getRetailerId());
|
|
|
757 |
|
|
|
758 |
}
|
|
|
759 |
|
|
|
760 |
Map<Integer, String> storeIdAndFofoIdMap = fofoStoreRepository.selectByRetailerIds(retailerIds).stream()
|
|
|
761 |
.collect(Collectors.toMap(FofoStore::getId, FofoStore::getCode));
|
| 24950 |
tejbeer |
762 |
LOGGER.info("item" + availableColorItems);
|
|
|
763 |
model.addAttribute("item", availableColorItems);
|
| 24917 |
tejbeer |
764 |
model.addAttribute("inProcessselectedOrder", inProcessselectedOrder);
|
|
|
765 |
model.addAttribute("storeIdAndFofoIdMap", storeIdAndFofoIdMap);
|
|
|
766 |
|
|
|
767 |
return "notify-order-modal";
|
|
|
768 |
}
|
|
|
769 |
|
|
|
770 |
@RequestMapping(value = "/notifyOrder", method = RequestMethod.POST)
|
|
|
771 |
public String NotifyOrder(HttpServletRequest request, @RequestBody NotifyOrderModel notifyOrderModel, Model model)
|
|
|
772 |
throws Exception {
|
|
|
773 |
|
|
|
774 |
com.spice.profitmandi.dao.entity.transaction.NotifyItem notifyItem = null;
|
|
|
775 |
List<Integer> orderIds = new ArrayList<>();
|
|
|
776 |
|
|
|
777 |
NotifyColorChange notifytimestamp = new NotifyColorChange();
|
|
|
778 |
notifytimestamp.setCreated(LocalDateTime.now());
|
|
|
779 |
notifyColorChangeRepository.persist(notifytimestamp);
|
| 25066 |
tejbeer |
780 |
NotifyMessage notifyMessage = new NotifyMessage();
|
|
|
781 |
notifyMessage.setNotifyId(notifytimestamp.getId());
|
|
|
782 |
notifyMessage.setNotifyMessages(notifyOrderModel.getMessage());
|
| 25140 |
amit.gupta |
783 |
notifyMessageRepository.persist(notifyMessage);
|
| 24917 |
tejbeer |
784 |
for (NotifyItemIdModel itemid : notifyOrderModel.getItemIds()) {
|
|
|
785 |
|
|
|
786 |
notifyItem = new com.spice.profitmandi.dao.entity.transaction.NotifyItem();
|
|
|
787 |
notifyItem.setItemId(itemid.getItemId());
|
|
|
788 |
notifyItem.setResponseTime(itemid.getResponseTime());
|
|
|
789 |
notifyItem.setProcuredDate(itemid.getProcuredTime());
|
|
|
790 |
notifyItem.setNotifyColorchangeId(notifytimestamp.getId());
|
|
|
791 |
notifyItemRepository.persist(notifyItem);
|
|
|
792 |
LOGGER.info("notifyItem" + notifyItem);
|
|
|
793 |
}
|
|
|
794 |
for (NotifyOrderIdModel st : notifyOrderModel.getOrderIds()) {
|
|
|
795 |
List<NotifyOrder> existingOrder = notifyOrderRespository.selectByOrder(st.getOrderId());
|
| 24950 |
tejbeer |
796 |
if (!existingOrder.isEmpty()) {
|
| 24917 |
tejbeer |
797 |
LOGGER.info("existingOrder" + existingOrder);
|
| 24950 |
tejbeer |
798 |
for (NotifyOrder notifyOrder : existingOrder) {
|
|
|
799 |
if (NotifyStatus.pending == notifyOrder.getStatus()) {
|
|
|
800 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
|
|
801 |
}
|
| 24917 |
tejbeer |
802 |
}
|
|
|
803 |
}
|
|
|
804 |
NotifyOrder orderStatus = new NotifyOrder();
|
|
|
805 |
orderStatus.setOrderId(st.getOrderId());
|
|
|
806 |
orderStatus.setNotifyId(notifytimestamp.getId());
|
|
|
807 |
orderStatus.setItemId(st.getOlditemId());
|
|
|
808 |
Order id = orderRepository.selectById(st.getOrderId());
|
|
|
809 |
orderStatus.setFofoId(id.getRetailerId());
|
|
|
810 |
orderStatus.setStatus(NotifyStatus.pending);
|
|
|
811 |
notifyOrderRespository.persist(orderStatus);
|
|
|
812 |
|
|
|
813 |
LOGGER.info("itemStatus" + orderStatus);
|
|
|
814 |
orderIds.add(st.getOrderId());
|
|
|
815 |
}
|
|
|
816 |
|
|
|
817 |
LOGGER.info("orderIds" + orderIds);
|
|
|
818 |
List<Order> orders = orderRepository.selectByOrderIds(orderIds);
|
|
|
819 |
for (Order order : orders) {
|
|
|
820 |
LOGGER.info("order" + order.getId());
|
|
|
821 |
|
| 25140 |
amit.gupta |
822 |
NotifyMessage message = notifyMessageRepository.selectByNotifyId(notifytimestamp.getId());
|
|
|
823 |
|
| 25371 |
tejbeer |
824 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
|
|
825 |
scp.setMessage(message.getNotifyMessages());
|
| 25377 |
tejbeer |
826 |
scp.setTitle("Alert");
|
| 25371 |
tejbeer |
827 |
scp.setType("url");
|
| 25453 |
tejbeer |
828 |
scp.setUrl("/pages/home/notifyOrder");
|
| 25371 |
tejbeer |
829 |
scp.setExpireTimestamp(LocalDateTime.now().plusDays(2));
|
|
|
830 |
SimpleCampaign sc = new SimpleCampaign(scp);
|
|
|
831 |
sc.setSimpleCampaignParams(scp);
|
| 25140 |
amit.gupta |
832 |
|
| 25371 |
tejbeer |
833 |
NotificationCampaign nc = new NotificationCampaign();
|
|
|
834 |
nc.setName("Notify Partner");
|
|
|
835 |
nc.setImplementationType("SimpleCampaign");
|
|
|
836 |
nc.setImplementationParams(gson.toJson(scp));
|
|
|
837 |
nc.setCreatedTimestamp(LocalDateTime.now());
|
|
|
838 |
notificationCampaignRepository.persist(nc);
|
| 24950 |
tejbeer |
839 |
|
| 25371 |
tejbeer |
840 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
|
|
841 |
UserCampaign uc = new UserCampaign();
|
|
|
842 |
uc.setCampaignId(nc.getId());
|
|
|
843 |
uc.setUserId(userId);
|
|
|
844 |
uc.setPushTimestamp(LocalDateTime.now());
|
|
|
845 |
userCampaignRepository.persist(uc);
|
|
|
846 |
List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
|
|
|
847 |
LocalDateTime.now().minusMonths(3), LocalDateTime.now());
|
|
|
848 |
pushNotification(nc.getId(), devices);
|
| 25383 |
tejbeer |
849 |
|
| 24917 |
tejbeer |
850 |
}
|
|
|
851 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
852 |
return "response";
|
|
|
853 |
}
|
|
|
854 |
|
| 25371 |
tejbeer |
855 |
public void pushNotification(int cid, List<Device> devices) {
|
|
|
856 |
for (Device device : devices) {
|
|
|
857 |
PushNotifications pn = new PushNotifications();
|
|
|
858 |
pn.setNotificationCampaignid(cid);
|
|
|
859 |
pn.setDeviceId(device.getId());
|
|
|
860 |
pn.setUserId(device.getUser_id());
|
|
|
861 |
pushNotificationRepository.persist(pn);
|
|
|
862 |
}
|
|
|
863 |
|
|
|
864 |
}
|
|
|
865 |
|
| 24917 |
tejbeer |
866 |
private void sendMailOfHtmlFomat(String email, String messageText, String subject)
|
|
|
867 |
throws MessagingException, ProfitMandiBusinessException, IOException {
|
|
|
868 |
MimeMessage message = mailSender.createMimeMessage();
|
|
|
869 |
MimeMessageHelper helper = new MimeMessageHelper(message);
|
|
|
870 |
helper.setSubject(subject);
|
|
|
871 |
helper.setText(messageText, true);
|
|
|
872 |
helper.setTo(email);
|
|
|
873 |
|
|
|
874 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smart Dukaan");
|
|
|
875 |
helper.setFrom(senderAddress);
|
|
|
876 |
mailSender.send(message);
|
|
|
877 |
}
|
|
|
878 |
|
|
|
879 |
/*
|
|
|
880 |
* private String getMessage(List<NotifyOrderModel> notifyOrderModels, Order
|
|
|
881 |
* order) throws ProfitMandiBusinessException {
|
|
|
882 |
*
|
|
|
883 |
* StringBuilder sb = new StringBuilder(); sb.
|
|
|
884 |
* append("<html><body><p>Notify Partner</p><p>Which have order out stock following model:-</p>"
|
|
|
885 |
* + "<div>" + order.getLineItem().getItem().getItemDescription() +
|
|
|
886 |
* "</div> <div>choose the model from following:- </div><br/><table style='border:1px solid black ;padding: 5px';>"
|
|
|
887 |
* ); sb.append("<tbody>\n" + " <tr>\n" +
|
|
|
888 |
* " <th style='border:1px solid black;padding: 5px'>Color</th>\n"
|
|
|
889 |
* +
|
|
|
890 |
* " <th style='border:1px solid black;padding: 5px'>Procured Time</th>\n"
|
|
|
891 |
* +
|
|
|
892 |
* " <th style='border:1px solid black;padding: 5px'>Response Time</th>\n"
|
|
|
893 |
* + " </tr>"); for (NotifyOrderModel notifyOrderModel :
|
|
|
894 |
* notifyOrderModels) { Item item =
|
|
|
895 |
* itemRepository.selectById(notifyOrderModel.getItemId()); sb.append("<tr>");
|
|
|
896 |
* sb.append("<td style='border:1px solid black;padding: 5px'>" +
|
|
|
897 |
* item.getColor() + "</td>");
|
|
|
898 |
*
|
|
|
899 |
* sb.append("<td style='border:1px solid black;padding: 5px'>" +
|
|
|
900 |
* notifyOrderModel.getFormattedProcuredTime() + "</td>");
|
|
|
901 |
*
|
|
|
902 |
* sb.append("<td style='border:1px solid black;padding: 5px'>" +
|
|
|
903 |
* notifyOrderModel.getFormattedResponseTime() + "</td>");
|
|
|
904 |
*
|
|
|
905 |
* sb.append("</tr>"); }
|
|
|
906 |
*
|
|
|
907 |
* sb.append("</tbody></table></body></html>"); return sb.toString(); }
|
|
|
908 |
*/
|
|
|
909 |
|
|
|
910 |
@RequestMapping(value = "/getAllNotifyOrder", method = RequestMethod.GET)
|
|
|
911 |
public String getAllNotifyOrder(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 24950 |
tejbeer |
912 |
List<NotifyOrder> notifyOrders = null;
|
| 24917 |
tejbeer |
913 |
List<com.spice.profitmandi.dao.entity.transaction.Order> inProcessorder = orderRepository
|
| 25067 |
tejbeer |
914 |
.selectAllOrder(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| 24950 |
tejbeer |
915 |
|
| 24917 |
tejbeer |
916 |
List<Integer> orderIds = new ArrayList<>();
|
| 24950 |
tejbeer |
917 |
if (!inProcessorder.isEmpty()) {
|
| 24917 |
tejbeer |
918 |
for (com.spice.profitmandi.dao.entity.transaction.Order order : inProcessorder) {
|
| 24950 |
tejbeer |
919 |
|
| 24917 |
tejbeer |
920 |
orderIds.add(order.getId());
|
|
|
921 |
|
| 24950 |
tejbeer |
922 |
}
|
|
|
923 |
notifyOrders = notifyOrderRespository.selectByorderIds(orderIds);
|
|
|
924 |
Set<Integer> oldItemIds = new HashSet<>();
|
|
|
925 |
List<Integer> fofoIds = new ArrayList<>();
|
|
|
926 |
List<Integer> notifyIds = new ArrayList<>();
|
|
|
927 |
if (!notifyOrders.isEmpty()) {
|
|
|
928 |
for (NotifyOrder notifyOrder : notifyOrders) {
|
|
|
929 |
oldItemIds.add(notifyOrder.getItemId());
|
|
|
930 |
fofoIds.add(notifyOrder.getFofoId());
|
|
|
931 |
notifyIds.add(notifyOrder.getNotifyId());
|
| 24917 |
tejbeer |
932 |
}
|
|
|
933 |
|
| 24950 |
tejbeer |
934 |
List<NotifyColorChange> notifyColorChanges = notifyColorChangeRepository.selectByNotifyId(notifyIds);
|
|
|
935 |
Map<Integer, NotifyColorChange> notifyIdNotifyColorMap = this
|
|
|
936 |
.notifyOrdersToNotifyId(notifyColorChanges);
|
|
|
937 |
Map<Integer, CustomRetailer> fofoIdsAndRetailerName = retailerService.getFofoRetailers(fofoIds);
|
|
|
938 |
Map<Integer, String> itemdescription = inventoryService.getItemIdDescriptionMap(oldItemIds);
|
| 24917 |
tejbeer |
939 |
|
| 24950 |
tejbeer |
940 |
model.addAttribute("notifyOrders", notifyOrders);
|
|
|
941 |
model.addAttribute("notifyIdNotifyColorMap", notifyIdNotifyColorMap);
|
|
|
942 |
model.addAttribute("itemdescription", itemdescription);
|
|
|
943 |
model.addAttribute("fofoIdsAndRetailerName", fofoIdsAndRetailerName);
|
| 24917 |
tejbeer |
944 |
|
| 24950 |
tejbeer |
945 |
} else {
|
|
|
946 |
model.addAttribute("notifyOrders", notifyOrders);
|
|
|
947 |
}
|
| 24917 |
tejbeer |
948 |
} else {
|
|
|
949 |
model.addAttribute("notifyOrders", notifyOrders);
|
| 24950 |
tejbeer |
950 |
}
|
| 24917 |
tejbeer |
951 |
return "notify_order";
|
|
|
952 |
}
|
|
|
953 |
|
|
|
954 |
private Map<Integer, NotifyColorChange> notifyOrdersToNotifyId(List<NotifyColorChange> notifyColorChanges) {
|
|
|
955 |
Map<Integer, NotifyColorChange> notifyIdNotifyColorMap = new HashMap<>();
|
|
|
956 |
for (NotifyColorChange notifyColorChange : notifyColorChanges) {
|
|
|
957 |
notifyIdNotifyColorMap.put(notifyColorChange.getId(), notifyColorChange);
|
|
|
958 |
}
|
|
|
959 |
return notifyIdNotifyColorMap;
|
|
|
960 |
}
|
|
|
961 |
|
|
|
962 |
}
|