| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.ByteArrayInputStream;
|
3 |
import java.io.ByteArrayInputStream;
|
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.InputStream;
|
5 |
import java.io.InputStream;
|
| - |
|
6 |
import java.lang.ProcessBuilder.Redirect;
|
| 6 |
import java.util.ArrayList;
|
7 |
import java.util.ArrayList;
|
| 7 |
import java.util.Collection;
|
8 |
import java.util.Collection;
|
| 8 |
import java.util.HashMap;
|
9 |
import java.util.HashMap;
|
| 9 |
import java.util.HashSet;
|
10 |
import java.util.HashSet;
|
| 10 |
import java.util.Iterator;
|
11 |
import java.util.Iterator;
|
| Line 152... |
Line 153... |
| 152 |
@Autowired
|
153 |
@Autowired
|
| 153 |
CookiesProcessor cookiesProcessor;
|
154 |
CookiesProcessor cookiesProcessor;
|
| 154 |
|
155 |
|
| 155 |
@Autowired
|
156 |
@Autowired
|
| 156 |
PricingService pricingService;
|
157 |
PricingService pricingService;
|
| - |
|
158 |
|
| - |
|
159 |
|
| - |
|
160 |
|
| 157 |
|
161 |
|
| 158 |
@RequestMapping(value = "/order")
|
162 |
@RequestMapping(value = "/order")
|
| 159 |
public String orderIndex(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
163 |
public String orderIndex(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
| 160 |
try {
|
164 |
try {
|
| 161 |
cookiesProcessor.getCookiesObject(request);
|
165 |
cookiesProcessor.getCookiesObject(request);
|
| Line 506... |
Line 510... |
| 506 |
inventoryItemsToBill.put(i.getId(), inventoryItemsNonSerializedUsed);
|
510 |
inventoryItemsToBill.put(i.getId(), inventoryItemsNonSerializedUsed);
|
| 507 |
}
|
511 |
}
|
| 508 |
}
|
512 |
}
|
| 509 |
|
513 |
|
| 510 |
// mop price validation
|
514 |
// mop price validation
|
| - |
|
515 |
//TODO: Amit Gupta need to be commented out
|
| 511 |
Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
|
516 |
/*Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
|
| 512 |
Map<Integer, Float> itemIdPrinceMap = pricingService.getPrice(itemIds, fofoDetails.getFofoId());
|
517 |
Map<Integer, Float> itemIdPrinceMap = pricingService.getPrice(itemIds, fofoDetails.getFofoId());
|
| 513 |
for(Map.Entry<Integer, Float> entry : itemIdPrinceMap.entrySet()){
|
518 |
for(Map.Entry<Integer, Float> entry : itemIdPrinceMap.entrySet()){
|
| 514 |
CustomFofoLineItem customFofoLineItem = customFofoLineItemMap.get(entry.getKey());
|
519 |
CustomFofoLineItem customFofoLineItem = customFofoLineItemMap.get(entry.getKey());
|
| 515 |
if(customFofoLineItem.getSellingPrice() < entry.getValue()){
|
520 |
if(customFofoLineItem.getSellingPrice() < entry.getValue()){
|
| 516 |
invalidMopItemIdPriceMap.put(entry.getKey(), customFofoLineItem.getSellingPrice());
|
521 |
invalidMopItemIdPriceMap.put(entry.getKey(), customFofoLineItem.getSellingPrice());
|
| Line 518... |
Line 523... |
| 518 |
}
|
523 |
}
|
| 519 |
|
524 |
|
| 520 |
if(invalidMopItemIdPriceMap.isEmpty()){
|
525 |
if(invalidMopItemIdPriceMap.isEmpty()){
|
| 521 |
LOGGER.error("Invalid itemIds mop prices should be greater than mop prices {}", invalidMopItemIdPriceMap);
|
526 |
LOGGER.error("Invalid itemIds mop prices should be greater than mop prices {}", invalidMopItemIdPriceMap);
|
| 522 |
return "error";
|
527 |
return "error";
|
| 523 |
}
|
528 |
}*/
|
| 524 |
|
529 |
|
| 525 |
InvoiceNumberGenerationSequence invoiceNumberGenerationSequence = null;
|
530 |
InvoiceNumberGenerationSequence invoiceNumberGenerationSequence = null;
|
| 526 |
try{
|
531 |
try{
|
| 527 |
invoiceNumberGenerationSequence = invoiceNumberGenerationSequenceRepository.selectByFofoId(fofoDetails.getFofoId());
|
532 |
invoiceNumberGenerationSequence = invoiceNumberGenerationSequenceRepository.selectByFofoId(fofoDetails.getFofoId());
|
| 528 |
invoiceNumberGenerationSequence.setSequence(invoiceNumberGenerationSequence.getSequence() + 1);
|
533 |
invoiceNumberGenerationSequence.setSequence(invoiceNumberGenerationSequence.getSequence() + 1);
|
| Line 646... |
Line 651... |
| 646 |
scanRecord.setQuantity(inventoryItemQuantityUsed.get(inventoryItem.getId()));
|
651 |
scanRecord.setQuantity(inventoryItemQuantityUsed.get(inventoryItem.getId()));
|
| 647 |
scanRecord.setType(ScanType.SALE);
|
652 |
scanRecord.setType(ScanType.SALE);
|
| 648 |
scanRecordRepository.persist(scanRecord);
|
653 |
scanRecordRepository.persist(scanRecord);
|
| 649 |
}
|
654 |
}
|
| 650 |
}
|
655 |
}
|
| 651 |
return null;
|
656 |
return "redirect:/get-order/?orderId="+fofoOrder.getId();
|
| 652 |
}
|
657 |
}
|
| 653 |
|
658 |
|
| 654 |
private CustomerAddress createCustomerAddress(CustomAddress customAddress){
|
659 |
private CustomerAddress createCustomerAddress(CustomAddress customAddress){
|
| 655 |
CustomerAddress customerAddress = new CustomerAddress();
|
660 |
CustomerAddress customerAddress = new CustomerAddress();
|
| 656 |
customerAddress.setName(customAddress.getName());
|
661 |
customerAddress.setName(customAddress.getName());
|