| Line 5... |
Line 5... |
| 5 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
5 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 6 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
6 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 8 |
import com.spice.profitmandi.common.model.*;
|
8 |
import com.spice.profitmandi.common.model.*;
|
| 9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
10 |
import com.spice.profitmandi.dao.entity.ContactUs;
|
| 10 |
import com.spice.profitmandi.dao.entity.StoreSalesTarget;
|
11 |
import com.spice.profitmandi.dao.entity.StoreSalesTarget;
|
| 11 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
12 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 12 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
13 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 13 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
14 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 14 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
15 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| Line 26... |
Line 27... |
| 26 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
27 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
| 27 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
28 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 28 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
29 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
| 29 |
import com.spice.profitmandi.dao.model.*;
|
30 |
import com.spice.profitmandi.dao.model.*;
|
| 30 |
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
|
31 |
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
|
| - |
|
32 |
import com.spice.profitmandi.dao.repository.ContactUsRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
33 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
34 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 33 |
import com.spice.profitmandi.dao.repository.cs.*;
|
35 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 34 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
36 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 35 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
37 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| Line 191... |
Line 193... |
| 191 |
|
193 |
|
| 192 |
@Autowired
|
194 |
@Autowired
|
| 193 |
private MVCResponseSender mvcResponseSender;
|
195 |
private MVCResponseSender mvcResponseSender;
|
| 194 |
|
196 |
|
| 195 |
@Autowired
|
197 |
@Autowired
|
| - |
|
198 |
private ContactUsRepository contactUsRepository;
|
| - |
|
199 |
|
| - |
|
200 |
@Autowired
|
| 196 |
private ReporticoCacheTableRepository reporticoCacheTableRepository;
|
201 |
private ReporticoCacheTableRepository reporticoCacheTableRepository;
|
| 197 |
|
202 |
|
| 198 |
@Autowired
|
203 |
@Autowired
|
| 199 |
private TransactionService transactionService;
|
204 |
private TransactionService transactionService;
|
| 200 |
|
205 |
|
| Line 1784... |
Line 1789... |
| 1784 |
model.addAttribute("branditemSales", branditemSales);
|
1789 |
model.addAttribute("branditemSales", branditemSales);
|
| 1785 |
model.addAttribute("warehouseMap", warehouseMap);
|
1790 |
model.addAttribute("warehouseMap", warehouseMap);
|
| 1786 |
return "warehouse_accessories_itemwsie_sale";
|
1791 |
return "warehouse_accessories_itemwsie_sale";
|
| 1787 |
}
|
1792 |
}
|
| 1788 |
|
1793 |
|
| - |
|
1794 |
// Users allowed to add / edit / delete contact-us entries.
|
| - |
|
1795 |
private static final Set<String> CONTACT_US_EDITORS = new HashSet<>(Arrays.asList(
|
| - |
|
1796 |
"kangan.monga@smartdukaan.com",
|
| - |
|
1797 |
"neha.sharma@smartdukaan.com",
|
| - |
|
1798 |
"gaurav.mathur1@smartdukaan.com"));
|
| - |
|
1799 |
|
| - |
|
1800 |
private boolean isContactUsEditor(LoginDetails loginDetails) {
|
| - |
|
1801 |
return loginDetails != null && loginDetails.getEmailId() != null
|
| - |
|
1802 |
&& CONTACT_US_EDITORS.contains(loginDetails.getEmailId().trim().toLowerCase());
|
| - |
|
1803 |
}
|
| - |
|
1804 |
|
| 1789 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
1805 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
| 1790 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable {
|
1806 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable {
|
| - |
|
1807 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1791 |
model.addAttribute("appContextPath", request.getContextPath());
|
1808 |
model.addAttribute("appContextPath", request.getContextPath());
|
| - |
|
1809 |
model.addAttribute("mainContacts", contactUsRepository.findActiveBySection(ContactUs.SECTION_MAIN));
|
| - |
|
1810 |
model.addAttribute("escalationContacts", contactUsRepository.findActiveBySection(ContactUs.SECTION_ESCALATION));
|
| - |
|
1811 |
model.addAttribute("contactUsEditor", isContactUsEditor(loginDetails));
|
| 1792 |
return "contact-us";
|
1812 |
return "contact-us";
|
| 1793 |
}
|
1813 |
}
|
| 1794 |
|
1814 |
|
| - |
|
1815 |
@RequestMapping(value = "/contactUs/save", method = RequestMethod.POST)
|
| - |
|
1816 |
@ResponseBody
|
| - |
|
1817 |
public Map<String, Object> saveContactUs(HttpServletRequest request,
|
| - |
|
1818 |
@RequestParam(name = "id", defaultValue = "0") int id,
|
| - |
|
1819 |
@RequestParam(name = "section") String section,
|
| - |
|
1820 |
@RequestParam(name = "area", defaultValue = "") String area,
|
| - |
|
1821 |
@RequestParam(name = "baseArea", defaultValue = "") String baseArea,
|
| - |
|
1822 |
@RequestParam(name = "name", defaultValue = "") String name,
|
| - |
|
1823 |
@RequestParam(name = "designation", defaultValue = "") String designation,
|
| - |
|
1824 |
@RequestParam(name = "mobile", defaultValue = "") String mobile,
|
| - |
|
1825 |
@RequestParam(name = "email", defaultValue = "") String email) throws Exception {
|
| - |
|
1826 |
Map<String, Object> response = new HashMap<>();
|
| - |
|
1827 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1828 |
if (!isContactUsEditor(loginDetails)) {
|
| - |
|
1829 |
response.put("success", false);
|
| - |
|
1830 |
response.put("message", "You are not authorised to edit contacts.");
|
| - |
|
1831 |
return response;
|
| - |
|
1832 |
}
|
| - |
|
1833 |
|
| - |
|
1834 |
if (!ContactUs.SECTION_MAIN.equals(section) && !ContactUs.SECTION_ESCALATION.equals(section)) {
|
| - |
|
1835 |
response.put("success", false);
|
| - |
|
1836 |
response.put("message", "Invalid section.");
|
| - |
|
1837 |
return response;
|
| - |
|
1838 |
}
|
| - |
|
1839 |
if (name == null || name.trim().isEmpty()) {
|
| - |
|
1840 |
response.put("success", false);
|
| - |
|
1841 |
response.put("message", "Name is required.");
|
| - |
|
1842 |
return response;
|
| - |
|
1843 |
}
|
| - |
|
1844 |
|
| - |
|
1845 |
ContactUs contact;
|
| - |
|
1846 |
if (id > 0) {
|
| - |
|
1847 |
contact = contactUsRepository.selectById(id);
|
| - |
|
1848 |
if (contact == null || !contact.isActive()) {
|
| - |
|
1849 |
response.put("success", false);
|
| - |
|
1850 |
response.put("message", "Contact not found.");
|
| - |
|
1851 |
return response;
|
| - |
|
1852 |
}
|
| - |
|
1853 |
} else {
|
| - |
|
1854 |
contact = new ContactUs();
|
| - |
|
1855 |
contact.setSection(section);
|
| - |
|
1856 |
contact.setSortOrder(contactUsRepository.maxSortOrder(section) + 10);
|
| - |
|
1857 |
}
|
| - |
|
1858 |
contact.setArea(area == null ? "" : area.trim());
|
| - |
|
1859 |
contact.setBaseArea(baseArea == null ? "" : baseArea.trim());
|
| - |
|
1860 |
contact.setName(name.trim());
|
| - |
|
1861 |
contact.setDesignation(designation == null ? "" : designation.trim());
|
| - |
|
1862 |
contact.setMobile(mobile == null || mobile.trim().isEmpty() ? "-" : mobile.trim());
|
| - |
|
1863 |
contact.setEmail(email == null ? "" : email.trim());
|
| - |
|
1864 |
contactUsRepository.persist(contact);
|
| - |
|
1865 |
|
| - |
|
1866 |
response.put("success", true);
|
| - |
|
1867 |
return response;
|
| - |
|
1868 |
}
|
| - |
|
1869 |
|
| - |
|
1870 |
@RequestMapping(value = "/contactUs/delete", method = RequestMethod.POST)
|
| - |
|
1871 |
@ResponseBody
|
| - |
|
1872 |
public Map<String, Object> deleteContactUs(HttpServletRequest request,
|
| - |
|
1873 |
@RequestParam(name = "id") int id) throws Exception {
|
| - |
|
1874 |
Map<String, Object> response = new HashMap<>();
|
| - |
|
1875 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1876 |
if (!isContactUsEditor(loginDetails)) {
|
| - |
|
1877 |
response.put("success", false);
|
| - |
|
1878 |
response.put("message", "You are not authorised to edit contacts.");
|
| - |
|
1879 |
return response;
|
| - |
|
1880 |
}
|
| - |
|
1881 |
ContactUs contact = contactUsRepository.selectById(id);
|
| - |
|
1882 |
if (contact == null) {
|
| - |
|
1883 |
response.put("success", false);
|
| - |
|
1884 |
response.put("message", "Contact not found.");
|
| - |
|
1885 |
return response;
|
| - |
|
1886 |
}
|
| - |
|
1887 |
contact.setActive(false);
|
| - |
|
1888 |
contactUsRepository.persist(contact);
|
| - |
|
1889 |
response.put("success", true);
|
| - |
|
1890 |
return response;
|
| - |
|
1891 |
}
|
| - |
|
1892 |
|
| 1795 |
@RequestMapping(value = "/notifications", method = RequestMethod.GET)
|
1893 |
@RequestMapping(value = "/notifications", method = RequestMethod.GET)
|
| 1796 |
public String getNotificationsWithType(HttpServletRequest request, @RequestParam(required = false) MessageType
|
1894 |
public String getNotificationsWithType(HttpServletRequest request, @RequestParam(required = false) MessageType
|
| 1797 |
messageType, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
1895 |
messageType, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1798 |
@RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
|
1896 |
@RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
|
| 1799 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1897 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|