| 23405 |
amit.gupta |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 24824 |
govind |
3 |
import java.io.Serializable;
|
| 23785 |
amit.gupta |
4 |
import java.util.ArrayList;
|
| 23405 |
amit.gupta |
5 |
import java.util.Arrays;
|
| 23796 |
amit.gupta |
6 |
import java.util.Collections;
|
|
|
7 |
import java.util.Comparator;
|
| 23785 |
amit.gupta |
8 |
import java.util.DoubleSummaryStatistics;
|
| 23796 |
amit.gupta |
9 |
import java.util.HashMap;
|
| 24406 |
amit.gupta |
10 |
import java.util.HashSet;
|
| 23785 |
amit.gupta |
11 |
import java.util.Iterator;
|
| 23405 |
amit.gupta |
12 |
import java.util.List;
|
|
|
13 |
import java.util.Map;
|
| 24231 |
amit.gupta |
14 |
import java.util.Optional;
|
| 23785 |
amit.gupta |
15 |
import java.util.Set;
|
| 23405 |
amit.gupta |
16 |
import java.util.stream.Collectors;
|
|
|
17 |
|
|
|
18 |
import javax.servlet.http.HttpServletRequest;
|
|
|
19 |
|
| 24231 |
amit.gupta |
20 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 23717 |
amit.gupta |
21 |
import org.apache.logging.log4j.LogManager;
|
| 23568 |
govind |
22 |
import org.apache.logging.log4j.Logger;
|
| 23796 |
amit.gupta |
23 |
import org.apache.thrift.TException;
|
| 24349 |
amit.gupta |
24 |
import org.json.JSONArray;
|
| 23779 |
amit.gupta |
25 |
import org.json.JSONObject;
|
| 23405 |
amit.gupta |
26 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24231 |
amit.gupta |
27 |
import org.springframework.core.io.ByteArrayResource;
|
|
|
28 |
import org.springframework.http.HttpHeaders;
|
|
|
29 |
import org.springframework.http.HttpStatus;
|
|
|
30 |
import org.springframework.http.ResponseEntity;
|
| 23405 |
amit.gupta |
31 |
import org.springframework.stereotype.Controller;
|
|
|
32 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
33 |
import org.springframework.ui.Model;
|
|
|
34 |
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
35 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
36 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 23779 |
amit.gupta |
37 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 23405 |
amit.gupta |
38 |
|
| 23785 |
amit.gupta |
39 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 23405 |
amit.gupta |
40 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 23785 |
amit.gupta |
41 |
import com.spice.profitmandi.common.model.BrandPerformance;
|
| 24231 |
amit.gupta |
42 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
| 23785 |
amit.gupta |
43 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 23786 |
amit.gupta |
44 |
import com.spice.profitmandi.common.model.ItemIdAvailability;
|
| 23779 |
amit.gupta |
45 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
| 24231 |
amit.gupta |
46 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 23785 |
amit.gupta |
47 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 23405 |
amit.gupta |
48 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 23785 |
amit.gupta |
49 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 23796 |
amit.gupta |
50 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
|
|
51 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 23405 |
amit.gupta |
52 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
|
|
53 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 23779 |
amit.gupta |
54 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23405 |
amit.gupta |
55 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 23796 |
amit.gupta |
56 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
|
|
57 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
|
|
58 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
|
|
59 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 23798 |
amit.gupta |
60 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 23779 |
amit.gupta |
61 |
import com.spice.profitmandi.service.inventory.StockAllocationService;
|
|
|
62 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 25547 |
amit.gupta |
63 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 23796 |
amit.gupta |
64 |
import com.spice.profitmandi.thrift.clients.PaymentClient;
|
|
|
65 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
|
|
66 |
import com.spice.profitmandi.thrift.clients.UserClient;
|
| 23405 |
amit.gupta |
67 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
68 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
|
|
69 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
|
|
70 |
|
| 23796 |
amit.gupta |
71 |
import in.shop2020.logistics.PickUpType;
|
|
|
72 |
import in.shop2020.model.v1.order.LineItem;
|
|
|
73 |
import in.shop2020.model.v1.order.OrderSource;
|
|
|
74 |
import in.shop2020.model.v1.order.OrderStatus;
|
|
|
75 |
import in.shop2020.model.v1.order.OrderType;
|
|
|
76 |
import in.shop2020.model.v1.order.Transaction;
|
|
|
77 |
import in.shop2020.model.v1.order.TransactionService;
|
|
|
78 |
import in.shop2020.model.v1.order.TransactionStatus;
|
|
|
79 |
import in.shop2020.model.v1.user.ItemPriceQuantity;
|
|
|
80 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
|
|
81 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
|
|
82 |
import in.shop2020.payments.Attribute;
|
|
|
83 |
import in.shop2020.payments.PaymentException;
|
|
|
84 |
import in.shop2020.payments.PaymentStatus;
|
|
|
85 |
|
| 23405 |
amit.gupta |
86 |
@Controller
|
|
|
87 |
@Transactional(rollbackFor = Throwable.class)
|
|
|
88 |
public class IndentController {
|
|
|
89 |
|
| 23568 |
govind |
90 |
private static final Logger LOGGER = LogManager.getLogger(IndentController.class);
|
| 23796 |
amit.gupta |
91 |
private static final int WALLET_GATEWAY_ID = 8;
|
| 24406 |
amit.gupta |
92 |
private static final Set<Integer> defaultTags = new HashSet<Integer>(Arrays.asList(4));
|
| 23405 |
amit.gupta |
93 |
|
| 23796 |
amit.gupta |
94 |
private final List<OrderStatus> validOrderStatusList = Arrays.asList(OrderStatus.ACCEPTED,
|
|
|
95 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
|
|
96 |
OrderStatus.DELIVERY_SUCCESS, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
|
|
97 |
OrderStatus.REACHED_DESTINATION_CITY);
|
|
|
98 |
|
| 24231 |
amit.gupta |
99 |
private final List<OrderStatus> partnerPendingOrderList = Arrays.asList(OrderStatus.ACCEPTED,
|
|
|
100 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
|
|
101 |
OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
|
|
102 |
OrderStatus.REACHED_DESTINATION_CITY);
|
| 25547 |
amit.gupta |
103 |
|
|
|
104 |
@Autowired
|
|
|
105 |
WalletService walletService;
|
| 24231 |
amit.gupta |
106 |
|
| 23405 |
amit.gupta |
107 |
@Autowired
|
|
|
108 |
private CookiesProcessor cookiesProcessor;
|
| 24231 |
amit.gupta |
109 |
|
| 23796 |
amit.gupta |
110 |
@Autowired
|
|
|
111 |
private UserWalletRepository userWalletRepository;
|
| 23785 |
amit.gupta |
112 |
|
| 23779 |
amit.gupta |
113 |
@Autowired
|
| 23796 |
amit.gupta |
114 |
private UserRepository userRepository;
|
|
|
115 |
|
|
|
116 |
@Autowired
|
| 23779 |
amit.gupta |
117 |
FofoStoreRepository fofoStoreRepository;
|
| 23405 |
amit.gupta |
118 |
|
|
|
119 |
@Autowired
|
| 23796 |
amit.gupta |
120 |
private OrderRepository orderRepository;
|
|
|
121 |
|
|
|
122 |
@Autowired
|
| 23405 |
amit.gupta |
123 |
private ItemRepository itemRepository;
|
|
|
124 |
|
|
|
125 |
@Autowired
|
| 23779 |
amit.gupta |
126 |
private StockAllocationService stockAllocationService;
|
|
|
127 |
|
|
|
128 |
@Autowired
|
|
|
129 |
private RetailerService retailerService;
|
| 23405 |
amit.gupta |
130 |
|
|
|
131 |
@Autowired
|
|
|
132 |
private TagListingRepository tagListingRepository;
|
|
|
133 |
|
|
|
134 |
@Autowired
|
|
|
135 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
|
|
136 |
|
|
|
137 |
@Autowired
|
| 23796 |
amit.gupta |
138 |
private PurchaseRepository purchaseRepository;
|
|
|
139 |
|
|
|
140 |
@Autowired
|
| 23405 |
amit.gupta |
141 |
private MVCResponseSender mvcResponseSender;
|
|
|
142 |
|
| 23785 |
amit.gupta |
143 |
@Autowired
|
|
|
144 |
RoleManager roleManager;
|
| 23405 |
amit.gupta |
145 |
|
| 23779 |
amit.gupta |
146 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 23785 |
amit.gupta |
147 |
public String saveOpenIndent(HttpServletRequest request, Model model,
|
| 23786 |
amit.gupta |
148 |
@RequestBody List<StockAllocationModel> stockAllocationModelList, @RequestParam int fofoId,
|
|
|
149 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 23405 |
amit.gupta |
150 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23779 |
amit.gupta |
151 |
boolean response = false;
|
| 23785 |
amit.gupta |
152 |
if (fofoId > 0) {
|
|
|
153 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 23786 |
amit.gupta |
154 |
stockAllocationModelList.forEach(x -> {
|
|
|
155 |
x.setFofoId(fofoId);
|
|
|
156 |
x.setCounterSize(fs.getCounterSize());
|
|
|
157 |
});
|
|
|
158 |
} else {
|
|
|
159 |
stockAllocationModelList.forEach(x -> {
|
|
|
160 |
x.setFofoId(fofoId);
|
|
|
161 |
x.setCounterSize(counterSize);
|
|
|
162 |
});
|
| 23785 |
amit.gupta |
163 |
}
|
|
|
164 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
|
|
165 |
response = stockAllocationService.addToAllocation(stockAllocationModelList);
|
|
|
166 |
model.addAttribute("response", mvcResponseSender.createResponseString(response));
|
|
|
167 |
}
|
| 23405 |
amit.gupta |
168 |
return "response";
|
|
|
169 |
}
|
|
|
170 |
|
| 24231 |
amit.gupta |
171 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
|
|
172 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
|
|
173 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
|
|
174 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 25702 |
amit.gupta |
175 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
176 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 24231 |
amit.gupta |
177 |
LOGGER.info("Counter size is {}", counterSize);
|
|
|
178 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 25702 |
amit.gupta |
179 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId()==fofoId) {
|
| 24231 |
amit.gupta |
180 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
|
|
181 |
.collect(Collectors.toList());
|
|
|
182 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
| 23415 |
amit.gupta |
183 |
|
| 24232 |
amit.gupta |
184 |
List<StockAllocationModel> stockAllocationList = stockAllocationService.getStockAllocation(counterSize,
|
|
|
185 |
true);
|
|
|
186 |
Map<Integer, Integer> modelStockAllocationMap = stockAllocationList.stream()
|
|
|
187 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| 23405 |
amit.gupta |
188 |
|
| 24232 |
amit.gupta |
189 |
Map<String, Integer> catalogUserQtyMap = new HashMap<>();
|
| 25702 |
amit.gupta |
190 |
currentInventorySnapshotRepository.selectByFofoId(fofoId).stream().forEach(x -> {
|
| 24232 |
amit.gupta |
191 |
int retailerId = x.getFofoId();
|
|
|
192 |
int catalogId;
|
|
|
193 |
try {
|
|
|
194 |
catalogId = itemRepository.selectById(x.getItemId()).getCatalogItemId();
|
|
|
195 |
String key = catalogId + "-" + retailerId;
|
|
|
196 |
if (!catalogUserQtyMap.containsKey(key)) {
|
|
|
197 |
catalogUserQtyMap.put(key, 0);
|
|
|
198 |
}
|
|
|
199 |
catalogUserQtyMap.put(key, catalogUserQtyMap.get(key) + x.getAvailability());
|
|
|
200 |
} catch (ProfitMandiBusinessException e) {
|
|
|
201 |
// TODO Auto-generated catch block
|
|
|
202 |
throw new RuntimeException(e);
|
| 24231 |
amit.gupta |
203 |
}
|
|
|
204 |
});
|
| 23779 |
amit.gupta |
205 |
|
| 24231 |
amit.gupta |
206 |
List<Order> inTransitOrders = orderRepository.selectOrders(fofoIds, partnerPendingOrderList);
|
| 24232 |
amit.gupta |
207 |
Map<String, Integer> catalogUserInTransit = inTransitOrders.stream().collect(Collectors.groupingBy(x -> {
|
|
|
208 |
try {
|
|
|
209 |
return itemRepository.selectById(x.getLineItem().getItemId()).getCatalogItemId() + "-"
|
|
|
210 |
+ x.getRetailerId();
|
|
|
211 |
} catch (ProfitMandiBusinessException e) {
|
|
|
212 |
// TODO Auto-generated catch block
|
|
|
213 |
return "";
|
|
|
214 |
}
|
|
|
215 |
}, Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
| 23779 |
amit.gupta |
216 |
|
| 24232 |
amit.gupta |
217 |
Map<String, CatalogListingModel> catalogListingMap = new HashMap<>();
|
|
|
218 |
|
|
|
219 |
List<TagListing> tagListings = tagListingRepository.selectAll(true);
|
|
|
220 |
Iterator<TagListing> iterator = tagListings.iterator();
|
| 24231 |
amit.gupta |
221 |
while (iterator.hasNext()) {
|
|
|
222 |
TagListing tagListing = iterator.next();
|
|
|
223 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
| 24232 |
amit.gupta |
224 |
int catalogId = item.getCatalogItemId();
|
| 24231 |
amit.gupta |
225 |
if (item.getCategoryId() != 10006) {
|
|
|
226 |
continue;
|
|
|
227 |
}
|
| 23779 |
amit.gupta |
228 |
|
| 24232 |
amit.gupta |
229 |
int catalogStockAllocationQuantity = modelStockAllocationMap.containsKey(catalogId)
|
|
|
230 |
? modelStockAllocationMap.get(catalogId)
|
|
|
231 |
: 0;
|
|
|
232 |
for (int retailerId : fofoIds) {
|
|
|
233 |
String key = catalogId + "-" + retailerId;
|
|
|
234 |
if (catalogListingMap.containsKey(key)) {
|
|
|
235 |
continue;
|
| 24231 |
amit.gupta |
236 |
}
|
| 24232 |
amit.gupta |
237 |
int catalogInTransit = catalogUserInTransit.containsKey(key) ? catalogUserInTransit.get(key) : 0;
|
|
|
238 |
int catalogInStock = catalogUserQtyMap.containsKey(key) ? catalogUserQtyMap.get(key) : 0;
|
|
|
239 |
if (catalogInTransit + catalogInStock == 0 && catalogStockAllocationQuantity == 0) {
|
|
|
240 |
continue;
|
|
|
241 |
}
|
|
|
242 |
CatalogListingModel catalogListingModel = new CatalogListingModel();
|
|
|
243 |
catalogListingModel.setFofoId(retailerId);
|
|
|
244 |
catalogListingModel.setModelName(item.getModelName());
|
|
|
245 |
catalogListingModel.setModelNumber(item.getModelNumber());
|
|
|
246 |
catalogListingModel.setCatalogId(catalogId);
|
|
|
247 |
catalogListingModel.setDp(tagListing.getSellingPrice());
|
|
|
248 |
catalogListingModel.setMop(tagListing.getMop());
|
|
|
249 |
catalogListingModel.setItemDescription(item.getItemDescriptionNoColor());
|
|
|
250 |
catalogListingModel.setAllocatedQuantity(catalogStockAllocationQuantity);
|
|
|
251 |
catalogListingModel.setInTransitQuantity(catalogInTransit);
|
|
|
252 |
catalogListingModel
|
|
|
253 |
.setToBeOrdered(catalogStockAllocationQuantity - catalogInTransit - catalogInStock);
|
| 24233 |
amit.gupta |
254 |
catalogListingModel.setStockInHand(catalogInStock);
|
| 24232 |
amit.gupta |
255 |
catalogListingModel.setBrand(item.getBrand());
|
|
|
256 |
catalogListingModel.setModelName(item.getModelName());
|
|
|
257 |
catalogListingModel.setModelNumber(item.getModelNumber());
|
|
|
258 |
catalogListingModel.setCategoryId(item.getCategoryId());
|
|
|
259 |
catalogListingMap.put(key, catalogListingModel);
|
| 23405 |
amit.gupta |
260 |
}
|
|
|
261 |
}
|
| 24824 |
govind |
262 |
List<List<? extends Serializable>> listOfRows = new ArrayList<>();
|
| 24231 |
amit.gupta |
263 |
for (CatalogListingModel clm : catalogListingMap.values()) {
|
|
|
264 |
CustomRetailer cr = customRetailersMap.get(clm.getFofoId());
|
| 24349 |
amit.gupta |
265 |
listOfRows.add(Arrays.asList(cr.getPartnerId(), cr.getBusinessName(), clm.getCatalogId(),
|
|
|
266 |
clm.getBrand(), clm.getModelName(), clm.getModelNumber(), clm.getDp(), clm.getMop(),
|
|
|
267 |
clm.getAllocatedQuantity(), clm.getInTransitQuantity(), clm.getStockInHand(),
|
|
|
268 |
clm.getToBeOrdered()));
|
| 24231 |
amit.gupta |
269 |
}
|
| 24349 |
amit.gupta |
270 |
ByteArrayOutputStream baos = FileUtil
|
|
|
271 |
.getCSVByteStream(
|
|
|
272 |
Arrays.asList("StoreId", "StoreName", "Catalog Id", "Brand", "Model Name", "Model Number",
|
|
|
273 |
"DP", "MOP", "Allocated Quantity", "In Transit", "Stock In hand", "Shortage"),
|
|
|
274 |
listOfRows);
|
| 24231 |
amit.gupta |
275 |
HttpHeaders headers = new HttpHeaders();
|
|
|
276 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
277 |
headers.set("Content-disposition", "inline; filename=retailer-allocation.csv");
|
| 24232 |
amit.gupta |
278 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(baos.toByteArray()), headers,
|
|
|
279 |
HttpStatus.OK);
|
| 23405 |
amit.gupta |
280 |
}
|
| 24231 |
amit.gupta |
281 |
return null;
|
| 24232 |
amit.gupta |
282 |
|
| 23405 |
amit.gupta |
283 |
}
|
|
|
284 |
|
| 24349 |
amit.gupta |
285 |
@RequestMapping(value = "/itemsByCatalogId")
|
|
|
286 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| 24410 |
amit.gupta |
287 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 25378 |
tejbeer |
288 |
throws ProfitMandiBusinessException {
|
| 24410 |
amit.gupta |
289 |
if (catalogId == 0) {
|
|
|
290 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
|
|
291 |
}
|
| 24349 |
amit.gupta |
292 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| 24414 |
amit.gupta |
293 |
LOGGER.info("Items {}", items);
|
| 25378 |
tejbeer |
294 |
Map<Integer, String> itemsColorMap = items.stream().filter(x -> x.getColorNatural().startsWith("f_"))
|
|
|
295 |
.collect(Collectors.toMap(Item::getId, Item::getColor));
|
| 24413 |
amit.gupta |
296 |
Map<Integer, TagListing> tagsMap = tagListingRepository
|
|
|
297 |
.selectByItemIdsAndTagIds(items.stream().map(x -> x.getId()).collect(Collectors.toSet()), defaultTags)
|
| 25378 |
tejbeer |
298 |
.stream().collect(Collectors.toMap(TagListing::getItemId, x -> x));
|
| 24414 |
amit.gupta |
299 |
LOGGER.info("Items color map {}", itemsColorMap);
|
| 24349 |
amit.gupta |
300 |
JSONArray response = new JSONArray();
|
| 24413 |
amit.gupta |
301 |
itemsColorMap.keySet().stream().forEach(x -> {
|
| 25378 |
tejbeer |
302 |
response.put(new JSONObject().put("color", itemsColorMap.get(x)).put("id", x).put("active",
|
|
|
303 |
tagsMap.get(x) == null ? false : tagsMap.get(x).isActive()));
|
| 24349 |
amit.gupta |
304 |
});
|
|
|
305 |
model.addAttribute("response", response.toString());
|
|
|
306 |
return "response";
|
| 24410 |
amit.gupta |
307 |
|
| 24349 |
amit.gupta |
308 |
}
|
|
|
309 |
|
| 23405 |
amit.gupta |
310 |
@RequestMapping(value = "/indent/loadIndent")
|
| 23785 |
amit.gupta |
311 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
|
|
312 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 23786 |
amit.gupta |
313 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws ProfitMandiBusinessException {
|
| 25702 |
amit.gupta |
314 |
|
|
|
315 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
316 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 23785 |
amit.gupta |
317 |
LOGGER.info("Counter size is {}", counterSize);
|
|
|
318 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 25702 |
amit.gupta |
319 |
boolean isAdmin = !roleManager.isAdmin(roleIds);
|
| 23786 |
amit.gupta |
320 |
Map<Integer, ItemIdAvailability> itemCisMap = null;
|
| 25702 |
amit.gupta |
321 |
if (!isAdmin && fofoId==0) {
|
| 23786 |
amit.gupta |
322 |
fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
|
| 23796 |
amit.gupta |
323 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
|
|
324 |
.selectItemsStock(fofoId);
|
|
|
325 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
|
|
326 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 23786 |
amit.gupta |
327 |
} else {
|
|
|
328 |
if (fofoId == 0) {
|
| 23796 |
amit.gupta |
329 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
|
|
330 |
.selectItemsStock();
|
|
|
331 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
|
|
332 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 23779 |
amit.gupta |
333 |
} else {
|
| 23796 |
amit.gupta |
334 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
|
|
335 |
.selectItemsStock(fofoId);
|
|
|
336 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
|
|
337 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 23405 |
amit.gupta |
338 |
}
|
| 23786 |
amit.gupta |
339 |
}
|
| 25702 |
amit.gupta |
340 |
|
| 23786 |
amit.gupta |
341 |
List<StockAllocationModel> stockAllocationList;
|
|
|
342 |
if (fofoId > 0) {
|
|
|
343 |
stockAllocationList = stockAllocationService.getStockAllocation(fofoId, true);
|
|
|
344 |
} else {
|
|
|
345 |
stockAllocationList = stockAllocationService.getStockAllocation(counterSize, true);
|
|
|
346 |
}
|
|
|
347 |
LOGGER.info("Stock Allocation list is {}", stockAllocationList);
|
| 23405 |
amit.gupta |
348 |
|
| 23786 |
amit.gupta |
349 |
Map<Integer, StockAllocationModel> itemStockAllocationMap = stockAllocationList.stream()
|
| 24231 |
amit.gupta |
350 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| 23796 |
amit.gupta |
351 |
Map<Integer, Integer> itemsInTransit = null;
|
| 23786 |
amit.gupta |
352 |
LOGGER.info("Item Stock Allocation Model Map {}", itemStockAllocationMap);
|
| 23855 |
amit.gupta |
353 |
List<TagListing> tagListings = tagListingRepository.selectAll(true);
|
| 25702 |
amit.gupta |
354 |
if (!isAdmin) {
|
| 23786 |
amit.gupta |
355 |
tagListings = new ArrayList<>(tagListings);
|
| 23796 |
amit.gupta |
356 |
List<Order> inTransitOrders = orderRepository.selectOrders(fofoId, validOrderStatusList);
|
|
|
357 |
inTransitOrders = this.filterValidOrders(inTransitOrders);
|
|
|
358 |
itemsInTransit = inTransitOrders.stream().collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
|
|
|
359 |
Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
|
|
360 |
} else {
|
|
|
361 |
itemsInTransit = new HashMap<>();
|
| 23786 |
amit.gupta |
362 |
}
|
|
|
363 |
Iterator<TagListing> iterator = tagListings.iterator();
|
| 23796 |
amit.gupta |
364 |
int totalPcs = 0;
|
|
|
365 |
int toBeOrdered = 0;
|
|
|
366 |
float totalAmount = 0;
|
| 24231 |
amit.gupta |
367 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| 25702 |
amit.gupta |
368 |
|
|
|
369 |
Map<Integer, Item> items = itemRepository.selectByIds(tagListings.stream().map(x->x.getItemId()).collect(Collectors.toSet())).stream().
|
|
|
370 |
collect(Collectors.toMap(x->x.getId(), x->x));
|
| 23786 |
amit.gupta |
371 |
while (iterator.hasNext()) {
|
|
|
372 |
TagListing tagListing = iterator.next();
|
| 24231 |
amit.gupta |
373 |
|
| 25702 |
amit.gupta |
374 |
Item item = items.get(tagListing.getItemId());
|
| 24231 |
amit.gupta |
375 |
// itemRepository.select
|
|
|
376 |
// catalogTagListingMap
|
| 25702 |
amit.gupta |
377 |
if (isAdmin) {
|
| 24231 |
amit.gupta |
378 |
if (item.getBrand() == null || item.getCategoryId() != 10006) {
|
| 23785 |
amit.gupta |
379 |
iterator.remove();
|
|
|
380 |
continue;
|
|
|
381 |
}
|
| 23786 |
amit.gupta |
382 |
} else {
|
| 24231 |
amit.gupta |
383 |
if (!(itemCisMap.containsKey(tagListing.getItemId())
|
| 24232 |
amit.gupta |
384 |
|| itemStockAllocationMap.containsKey(tagListing.getItemId()))) {
|
| 23786 |
amit.gupta |
385 |
iterator.remove();
|
|
|
386 |
continue;
|
| 23779 |
amit.gupta |
387 |
}
|
|
|
388 |
}
|
| 24231 |
amit.gupta |
389 |
int catalogId = item.getCatalogItemId();
|
|
|
390 |
|
|
|
391 |
CatalogListingModel catalogListingModel = catalogListingMap.get(catalogId);
|
|
|
392 |
if (!catalogListingMap.containsKey(catalogId)) {
|
|
|
393 |
catalogListingModel = new CatalogListingModel();
|
|
|
394 |
catalogListingModel.setCatalogId(catalogId);
|
|
|
395 |
catalogListingModel.setDp(tagListing.getSellingPrice());
|
|
|
396 |
catalogListingModel.setMop(tagListing.getMop());
|
|
|
397 |
catalogListingModel.setItemDescription(item.getItemDescriptionNoColor());
|
|
|
398 |
StockAllocationModel stockAllocationModel = itemStockAllocationMap.get(item.getCatalogItemId());
|
|
|
399 |
int stockAllocationQuantity = stockAllocationModel == null ? 0 : stockAllocationModel.getQuantity();
|
|
|
400 |
catalogListingModel.setAllocatedQuantity(stockAllocationQuantity);
|
|
|
401 |
catalogListingModel.setToBeOrdered(stockAllocationQuantity);
|
|
|
402 |
catalogListingModel.setBrand(item.getBrand());
|
|
|
403 |
if (item.getCategoryId() == 10006) {
|
|
|
404 |
catalogListingModel.setCategoryId(item.getCategoryId());
|
|
|
405 |
}
|
|
|
406 |
catalogListingMap.put(catalogId, catalogListingModel);
|
|
|
407 |
}
|
|
|
408 |
|
| 23796 |
amit.gupta |
409 |
ItemIdAvailability itemIdAvailability = itemCisMap.get(tagListing.getItemId());
|
| 24231 |
amit.gupta |
410 |
int itemAvailability = itemIdAvailability == null ? 0 : itemIdAvailability.getAvailability();
|
|
|
411 |
catalogListingModel.setStockInHand(catalogListingModel.getStockInHand() + itemAvailability);
|
| 23796 |
amit.gupta |
412 |
|
| 24231 |
amit.gupta |
413 |
Integer inTransitQuantity = itemsInTransit.get(item.getId());
|
|
|
414 |
int inTransitQty = (inTransitQuantity == null ? 0 : inTransitQuantity);
|
|
|
415 |
catalogListingModel.setInTransitQuantity(catalogListingModel.getInTransitQuantity() + inTransitQty);
|
|
|
416 |
|
|
|
417 |
if (catalogListingModel.getAllocatedQuantity() > 0) {
|
|
|
418 |
toBeOrdered = Math.max(catalogListingModel.getToBeOrdered() - inTransitQty - itemAvailability, 0);
|
|
|
419 |
catalogListingModel.setToBeOrdered(toBeOrdered);
|
| 23796 |
amit.gupta |
420 |
}
|
| 23786 |
amit.gupta |
421 |
}
|
| 25702 |
amit.gupta |
422 |
|
|
|
423 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers();
|
| 23786 |
amit.gupta |
424 |
if (fofoId > 0) {
|
|
|
425 |
CustomRetailer customRetailer = customRetailersMap.get(fofoId);
|
|
|
426 |
model.addAttribute("retailerName",
|
|
|
427 |
customRetailer.getBusinessName() + "-" + customRetailer.getAddress().getCity());
|
|
|
428 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
|
|
429 |
model.addAttribute("retailerId", customRetailer.getPartnerId());
|
|
|
430 |
model.addAttribute("counterSize", fs.getCounterSize().toString());
|
| 23779 |
amit.gupta |
431 |
} else {
|
| 23786 |
amit.gupta |
432 |
model.addAttribute("counterSize", counterSize.toString());
|
| 23405 |
amit.gupta |
433 |
}
|
| 23786 |
amit.gupta |
434 |
String customRetailers = JSONObject.valueToString(customRetailersMap.values());
|
| 25702 |
amit.gupta |
435 |
|
|
|
436 |
List<CatalogListingModel> catalogModelList = new ArrayList<>(catalogListingMap.values());
|
|
|
437 |
|
| 24231 |
amit.gupta |
438 |
Comparator<CatalogListingModel> firstCmp = Comparator.comparing(CatalogListingModel::getToBeOrdered,
|
|
|
439 |
Comparator.reverseOrder());
|
|
|
440 |
model.addAttribute("catalogTagListings",
|
|
|
441 |
catalogModelList.stream().sorted(firstCmp).collect(Collectors.toList()));
|
| 25702 |
amit.gupta |
442 |
model.addAttribute("isAdmin", roleManager.isAdmin(roleIds));
|
| 23786 |
amit.gupta |
443 |
model.addAttribute("customRetailers", customRetailers);
|
| 23796 |
amit.gupta |
444 |
model.addAttribute("totalAmount", totalAmount);
|
|
|
445 |
model.addAttribute("totalPcs", totalPcs);
|
| 23786 |
amit.gupta |
446 |
return "open-indent";
|
| 23405 |
amit.gupta |
447 |
}
|
| 23796 |
amit.gupta |
448 |
|
|
|
449 |
private List<Order> filterValidOrders(List<Order> lastOrdersList) {
|
|
|
450 |
Iterator<Order> orderIterator = lastOrdersList.iterator();
|
|
|
451 |
while (orderIterator.hasNext()) {
|
|
|
452 |
Order o = orderIterator.next();
|
|
|
453 |
if (o.getInvoiceNumber() != null) {
|
|
|
454 |
try {
|
|
|
455 |
purchaseRepository.selectByPurchaseReferenceAndFofoId(o.getInvoiceNumber(), o.getRetailerId());
|
|
|
456 |
orderIterator.remove();
|
|
|
457 |
continue;
|
|
|
458 |
} catch (Exception e) {
|
|
|
459 |
|
|
|
460 |
}
|
|
|
461 |
}
|
|
|
462 |
}
|
|
|
463 |
return lastOrdersList;
|
|
|
464 |
}
|
|
|
465 |
|
| 24406 |
amit.gupta |
466 |
@RequestMapping(value = "/indent/confirm-pause", method = RequestMethod.POST)
|
| 24410 |
amit.gupta |
467 |
public String raisePO(HttpServletRequest request, Model model, @RequestBody String jsonArrayString)
|
|
|
468 |
throws Exception {
|
| 24406 |
amit.gupta |
469 |
JSONArray jsonArray = new JSONArray(jsonArrayString);
|
| 24410 |
amit.gupta |
470 |
for (int i = 0; i < jsonArray.length(); i++) {
|
| 24406 |
amit.gupta |
471 |
JSONObject obj = jsonArray.getJSONObject(i);
|
| 25378 |
tejbeer |
472 |
|
| 24406 |
amit.gupta |
473 |
TagListing tl = tagListingRepository.selectByItemId(obj.getInt("id"));
|
| 25378 |
tejbeer |
474 |
if (tl == null) {
|
|
|
475 |
continue;
|
|
|
476 |
} else {
|
|
|
477 |
tl.setActive(obj.getBoolean("active"));
|
|
|
478 |
tagListingRepository.persist(tl);
|
|
|
479 |
}
|
| 24406 |
amit.gupta |
480 |
}
|
| 24410 |
amit.gupta |
481 |
model.addAttribute("response", true);
|
| 23855 |
amit.gupta |
482 |
return "response";
|
|
|
483 |
}
|
| 24231 |
amit.gupta |
484 |
|
|
|
485 |
@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
|
| 23796 |
amit.gupta |
486 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|
|
|
487 |
boolean success = false;
|
|
|
488 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
489 |
int fofoId = loginDetails.getFofoId();
|
|
|
490 |
List<ItemPriceQuantity> itemQuantities = this.getItemQuantities(fofoId);
|
|
|
491 |
CustomRetailer customRetailer = retailerService.getFofoRetailers(Arrays.asList(fofoId)).get(fofoId);
|
|
|
492 |
Client userClient = new UserClient().getClient();
|
| 24231 |
amit.gupta |
493 |
double totalAmount = itemQuantities.stream().mapToDouble(x -> x.getQty() * x.getPrice()).sum();
|
| 23796 |
amit.gupta |
494 |
|
| 24231 |
amit.gupta |
495 |
if (totalAmount > 0) {
|
| 23796 |
amit.gupta |
496 |
userClient.addItemPricingToCart(customRetailer.getCartId(), itemQuantities);
|
|
|
497 |
User user = userRepository.selectById(loginDetails.getFofoId());
|
|
|
498 |
userClient = new UserClient().getClient();
|
|
|
499 |
LOGGER.info("Setting wallet amount in cart");
|
| 24231 |
amit.gupta |
500 |
long transactionId = userClient.createOrders(user.getActiveCartId(), "", 0, "", 0, loginDetails.getFofoId(),
|
|
|
501 |
7890, OrderSource.WEBSITE.getValue(), true);
|
| 23796 |
amit.gupta |
502 |
LOGGER.info("Creating wallet payment for transactionId - {}", transactionId);
|
|
|
503 |
createPayment(user, totalAmount, transactionId);
|
| 24231 |
amit.gupta |
504 |
TransactionService.Client transactionClient = new TransactionClient().getClient();
|
| 23796 |
amit.gupta |
505 |
transactionClient.changeTransactionStatus(transactionId, TransactionStatus.AUTHORIZED,
|
| 24231 |
amit.gupta |
506 |
"Payment received for the order", PickUpType.RUNNER.getValue(), OrderType.B2B, OrderSource.WEBSITE);
|
| 23796 |
amit.gupta |
507 |
transactionClient.changeTransactionStatus(Long.valueOf(transactionId), TransactionStatus.IN_PROCESS,
|
| 24231 |
amit.gupta |
508 |
"Paid fully through wallet", PickUpType.RUNNER.getValue(), OrderType.B2B, OrderSource.WEBSITE);
|
| 23796 |
amit.gupta |
509 |
LOGGER.info("Successfully created transaction: " + transactionId + " for amount: " + totalAmount);
|
|
|
510 |
transactionClient = new TransactionClient().getClient();
|
|
|
511 |
transactionClient.markOrderForRegisteredGstInvoice(Collections.singletonList(Long.valueOf(transactionId)));
|
|
|
512 |
try {
|
|
|
513 |
transactionClient.enqueueTransactionInfoEmail(transactionId);
|
|
|
514 |
} catch (Exception e1) {
|
|
|
515 |
e1.printStackTrace();
|
|
|
516 |
LOGGER.error("Unable to update status of transaction. Thrift Exception:", e1);
|
|
|
517 |
}
|
|
|
518 |
resetCart(transactionClient.getTransaction(transactionId));
|
|
|
519 |
}
|
|
|
520 |
model.addAttribute("response", mvcResponseSender.createResponseString(success));
|
|
|
521 |
return "response";
|
|
|
522 |
}
|
| 24231 |
amit.gupta |
523 |
|
|
|
524 |
private void createPayment(User user, double totalAmount, long transactionId)
|
|
|
525 |
throws NumberFormatException, PaymentException, TException {
|
| 23796 |
amit.gupta |
526 |
List<Attribute> paymentAttributes = new ArrayList<Attribute>();
|
|
|
527 |
in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
|
|
|
528 |
paymentAttributes.add(new Attribute("payMethod", "7890"));
|
| 24231 |
amit.gupta |
529 |
long paymentId = paymentClient.createPayment(user.getId(), totalAmount, WALLET_GATEWAY_ID, transactionId,
|
|
|
530 |
false);
|
|
|
531 |
paymentClient.updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null,
|
|
|
532 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
| 23796 |
amit.gupta |
533 |
}
|
| 24231 |
amit.gupta |
534 |
|
| 23796 |
amit.gupta |
535 |
private List<ItemPriceQuantity> getItemQuantities(int fofoId) throws ProfitMandiBusinessException {
|
|
|
536 |
List<ItemPriceQuantity> itemQuantities = new ArrayList<>();
|
| 24231 |
amit.gupta |
537 |
/*
|
|
|
538 |
* Map<Integer, ItemIdAvailability> itemCisMap = null; List<ItemIdAvailability>
|
|
|
539 |
* currentInventorySnapshots = currentInventorySnapshotRepository
|
|
|
540 |
* .selectItemsStock(fofoId); itemCisMap =
|
|
|
541 |
* currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
|
|
542 |
* .collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
|
|
543 |
* List<StockAllocationModel> stockAllocationList =
|
|
|
544 |
* stockAllocationService.getStockAllocation(fofoId, true);
|
|
|
545 |
*
|
|
|
546 |
* Map<Integer, StockAllocationModel> itemStockAllocationMap =
|
|
|
547 |
* stockAllocationList.stream() .collect(Collectors.toMap(x -> x.catalogId(), x
|
|
|
548 |
* -> x)); Map<Integer, Integer> itemsInTransit = null;
|
|
|
549 |
* LOGGER.info("Item Stock Allocation Model Map {}", itemStockAllocationMap);
|
|
|
550 |
* List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
|
|
551 |
* List<Order> inTransitOrders = orderRepository.selectOrders(fofoId,
|
|
|
552 |
* validOrderStatusList); inTransitOrders =
|
|
|
553 |
* this.filterValidOrders(inTransitOrders); itemsInTransit =
|
|
|
554 |
* inTransitOrders.stream().collect(Collectors.groupingBy(x ->
|
|
|
555 |
* x.getLineItem().getItemId(), Collectors.summingInt(x ->
|
|
|
556 |
* x.getLineItem().getQuantity())));
|
|
|
557 |
*
|
|
|
558 |
* Iterator<TagListing> iterator = tagListings.iterator();
|
|
|
559 |
*
|
|
|
560 |
* int toBeOrdered = 0; while (iterator.hasNext()) { TagListing tagListing =
|
|
|
561 |
* iterator.next(); LOGGER.info(" tagListing.setAllocatedQuantity {}",
|
|
|
562 |
* tagListing.getAllocatedQuantity()); if
|
|
|
563 |
* (!itemCisMap.containsKey(tagListing.getItemId()) &&
|
|
|
564 |
* !itemStockAllocationMap.containsKey(tagListing.getItemId())) {
|
|
|
565 |
* iterator.remove(); continue; } ItemIdAvailability itemIdAvailability =
|
|
|
566 |
* itemCisMap.get(tagListing.getItemId());
|
|
|
567 |
* tagListing.setStockInHand(itemIdAvailability == null ? 0 :
|
|
|
568 |
* itemIdAvailability.getAvailability()); StockAllocationModel
|
|
|
569 |
* stockAllocationModel = itemStockAllocationMap.get(tagListing.getItemId());
|
|
|
570 |
*
|
|
|
571 |
* if (itemsInTransit.containsKey(tagListing.getItemId())) {
|
|
|
572 |
* tagListing.setInTransitQuantity(itemsInTransit.get(tagListing.getItemId()));
|
|
|
573 |
* } else { tagListing.setInTransitQuantity(0); } if (stockAllocationModel !=
|
|
|
574 |
* null) { tagListing.setAllocatedQuantity(stockAllocationModel.getQuantity());
|
|
|
575 |
* toBeOrdered = Math.max(tagListing.getAllocatedQuantity() -
|
|
|
576 |
* tagListing.getInTransitQuantity() - tagListing.getStockInHand(), 0); if
|
|
|
577 |
* (toBeOrdered > 0) { ItemPriceQuantity ipq = new ItemPriceQuantity();
|
|
|
578 |
* ipq.setItemId(tagListing.getItemId()); ipq.setQty((long) toBeOrdered);
|
|
|
579 |
* ipq.setPrice(tagListing.getSellingPrice()); itemQuantities.add(ipq); } } }
|
|
|
580 |
*/
|
| 23796 |
amit.gupta |
581 |
return itemQuantities;
|
|
|
582 |
|
|
|
583 |
}
|
| 24231 |
amit.gupta |
584 |
|
| 23796 |
amit.gupta |
585 |
private long resetCart(Transaction transaction) {
|
|
|
586 |
long sum = 0;
|
|
|
587 |
Map<Long, Double> items = new HashMap<Long, Double>();
|
|
|
588 |
for (in.shop2020.model.v1.order.Order order : transaction.getOrders()) {
|
|
|
589 |
sum += order.getGvAmount();
|
|
|
590 |
for (LineItem lineitem : order.getLineitems()) {
|
|
|
591 |
Long itemId = lineitem.getItem_id();
|
|
|
592 |
Double quantity = items.get(itemId);
|
|
|
593 |
if (quantity == null) {
|
|
|
594 |
quantity = lineitem.getQuantity();
|
|
|
595 |
} else {
|
|
|
596 |
quantity = quantity + lineitem.getQuantity();
|
|
|
597 |
}
|
|
|
598 |
items.put(itemId, quantity);
|
|
|
599 |
}
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
LOGGER.debug("Items to reset in cart are: " + items);
|
|
|
603 |
|
|
|
604 |
try {
|
|
|
605 |
Client userClient = new UserClient().getClient();
|
|
|
606 |
userClient.resetCart(transaction.getShoppingCartid(), items);
|
|
|
607 |
} catch (TException e) {
|
|
|
608 |
LOGGER.error("Error while updating information in payment database.", e);
|
|
|
609 |
} catch (ShoppingCartException e) {
|
|
|
610 |
LOGGER.error("Error while reseting the cart in cart database.", e);
|
|
|
611 |
} catch (Exception e) {
|
|
|
612 |
LOGGER.error("Unexpected exception", e);
|
|
|
613 |
}
|
|
|
614 |
return sum;
|
|
|
615 |
}
|
|
|
616 |
|
| 23405 |
amit.gupta |
617 |
}
|