| Line 4... |
Line 4... |
| 4 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.LocalTime;
|
5 |
import java.time.LocalTime;
|
| 6 |
import java.time.format.DateTimeFormatter;
|
6 |
import java.time.format.DateTimeFormatter;
|
| 7 |
import java.util.ArrayList;
|
7 |
import java.util.ArrayList;
|
| 8 |
import java.util.Arrays;
|
8 |
import java.util.Arrays;
|
| 9 |
import java.util.Comparator;
|
- |
|
| 10 |
import java.util.HashMap;
|
9 |
import java.util.HashMap;
|
| 11 |
import java.util.HashSet;
|
10 |
import java.util.HashSet;
|
| 12 |
import java.util.List;
|
11 |
import java.util.List;
|
| 13 |
import java.util.Map;
|
12 |
import java.util.Map;
|
| 14 |
import java.util.Optional;
|
13 |
import java.util.Optional;
|
| Line 44... |
Line 43... |
| 44 |
import org.springframework.web.bind.annotation.RequestMethod;
|
43 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 45 |
import org.springframework.web.bind.annotation.RequestParam;
|
44 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 46 |
|
45 |
|
| 47 |
import com.eclipsesource.json.JsonObject;
|
46 |
import com.eclipsesource.json.JsonObject;
|
| 48 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
47 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
| 49 |
import com.google.common.collect.Ordering;
|
- |
|
| 50 |
import com.google.gson.Gson;
|
48 |
import com.google.gson.Gson;
|
| 51 |
import com.google.gson.reflect.TypeToken;
|
49 |
import com.google.gson.reflect.TypeToken;
|
| 52 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
50 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 53 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
51 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 54 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
52 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
| Line 75... |
Line 73... |
| 75 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
73 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
| 76 |
import com.spice.profitmandi.dao.model.CartResponse;
|
74 |
import com.spice.profitmandi.dao.model.CartResponse;
|
| 77 |
import com.spice.profitmandi.dao.model.CustomerOrderDetail;
|
75 |
import com.spice.profitmandi.dao.model.CustomerOrderDetail;
|
| 78 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
76 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 79 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
77 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| - |
|
78 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 80 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
79 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 81 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
80 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 82 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
81 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
82 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
83 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| Line 206... |
Line 205... |
| 206 |
private VelocityEngine velocityEngine;
|
205 |
private VelocityEngine velocityEngine;
|
| 207 |
|
206 |
|
| 208 |
@Autowired
|
207 |
@Autowired
|
| 209 |
JavaMailSender mailSender;
|
208 |
JavaMailSender mailSender;
|
| 210 |
|
209 |
|
| - |
|
210 |
@Autowired
|
| - |
|
211 |
CsService csService;
|
| 211 |
List<String> filterableParams = Arrays.asList("brand");
|
212 |
List<String> filterableParams = Arrays.asList("brand");
|
| 212 |
|
213 |
|
| 213 |
|
- |
|
| 214 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
214 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 215 |
@ApiImplicitParams({
|
215 |
@ApiImplicitParams({
|
| 216 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
216 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 217 |
@ApiOperation(value = "Get unit deal object")
|
217 |
@ApiOperation(value = "Get unit deal object")
|
| 218 |
public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
218 |
public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
| Line 728... |
Line 728... |
| 728 |
context.put("pendingOrder", pendingOrder);
|
728 |
context.put("pendingOrder", pendingOrder);
|
| 729 |
context.put("date", dateTimeFormatter);
|
729 |
context.put("date", dateTimeFormatter);
|
| 730 |
StringWriter writer = new StringWriter();
|
730 |
StringWriter writer = new StringWriter();
|
| 731 |
t.merge(context, writer);
|
731 |
t.merge(context, writer);
|
| 732 |
|
732 |
|
| - |
|
733 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(pendingOrder.getFofoId());
|
| - |
|
734 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
| - |
|
735 |
String[] customerEmail = { customer.getEmailId() };
|
| - |
|
736 |
|
| - |
|
737 |
String[] retailerEmail = { customRetailer.getEmail() };
|
| - |
|
738 |
|
| - |
|
739 |
List<String> sendTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| - |
|
740 |
"hemant.kaura@smartdukaan.com", "niranjan.kala@smartdukaan.com", "sm@smartdukaan.com",
|
| - |
|
741 |
"tejbeer.kaur@shop2020.in");
|
| - |
|
742 |
List<String> authUserEmails = csService.getAuthUserByPartnerId(customRetailer.getPartnerId());
|
| - |
|
743 |
this.sendMailWithAttachments("Order Confirmation", writer.toString(), customerEmail);
|
| - |
|
744 |
|
| 733 |
this.sendMailWithAttachments("Order Confirmation", writer.toString(), pendingOrder);
|
745 |
this.sendMailWithAttachments("Order Confirmation", writer.toString(), retailerEmail);
|
| - |
|
746 |
this.sendMailWithAttachments("Order Confirmation", writer.toString(),
|
| - |
|
747 |
sendTo.toArray(new String[sendTo.size()]));
|
| - |
|
748 |
|
| - |
|
749 |
this.sendMailWithAttachments("Order Confirmation", writer.toString(),
|
| - |
|
750 |
authUserEmails.toArray(new String[sendTo.size()]));
|
| - |
|
751 |
|
| 734 |
return responseSender.ok(pendingOrder);
|
752 |
return responseSender.ok(pendingOrder);
|
| 735 |
}
|
753 |
}
|
| 736 |
|
754 |
|
| 737 |
private void sendMailWithAttachments(String subject, String messageText, PendingOrder pendingOrder)
|
755 |
private void sendMailWithAttachments(String subject, String messageText, String[] email) throws Exception {
|
| 738 |
throws Exception {
|
- |
|
| 739 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(pendingOrder.getFofoId());
|
- |
|
| 740 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
- |
|
| 741 |
MimeMessage message = mailSender.createMimeMessage();
|
756 |
MimeMessage message = mailSender.createMimeMessage();
|
| 742 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
757 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
| 743 |
if (!customer.getEmailId().equals(null)) {
|
- |
|
| 744 |
String[] email = { customer.getEmailId() };
|
- |
|
| 745 |
helper.setTo(email);
|
758 |
helper.setTo(email);
|
| 746 |
}
|
- |
|
| 747 |
String[] bccemail = { customRetailer.getEmail(), "tejbeer.kaur@shop2020.in", "tarun.verma@smartdukaan.com" };
|
- |
|
| 748 |
helper.setSubject(subject);
|
759 |
helper.setSubject(subject);
|
| 749 |
helper.setBcc(bccemail);
|
- |
|
| 750 |
helper.setText(messageText, true);
|
760 |
helper.setText(messageText, true);
|
| 751 |
|
761 |
|
| 752 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
762 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
| 753 |
helper.setFrom(senderAddress);
|
763 |
helper.setFrom(senderAddress);
|
| 754 |
mailSender.send(message);
|
764 |
mailSender.send(message);
|