Subversion Repositories SmartDukaan

Rev

Rev 25366 | Rev 25483 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.controller;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import com.google.gson.Gson;
import com.spice.profitmandi.common.ResponseCodeHolder;
import com.spice.profitmandi.common.enumuration.SchemeType;
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.common.model.CustomRetailer;
import com.spice.profitmandi.common.model.GoogleLoginRequest;
import com.spice.profitmandi.common.model.ProfitMandiConstants;
import com.spice.profitmandi.common.model.RegisteredUserInfo;
import com.spice.profitmandi.common.model.UserInfo;
import com.spice.profitmandi.common.util.JWTUtil;
import com.spice.profitmandi.common.web.client.RestClient;
import com.spice.profitmandi.common.web.util.ResponseSender;
import com.spice.profitmandi.dao.entity.auth.AuthUser;
import com.spice.profitmandi.dao.entity.dtr.Retailer;
import com.spice.profitmandi.dao.entity.dtr.Role;
import com.spice.profitmandi.dao.entity.dtr.User;
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
import com.spice.profitmandi.dao.entity.dtr.UserRole;
import com.spice.profitmandi.dao.entity.user.Address;
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
import com.spice.profitmandi.dao.model.UserCart;
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
import com.spice.profitmandi.dao.repository.user.AddressRepository;
import com.spice.profitmandi.service.AuthService;
import com.spice.profitmandi.service.authentication.RoleManager;
import com.spice.profitmandi.service.user.RetailerService;
import com.spice.profitmandi.service.user.UserService;
import com.spice.profitmandi.web.enumuration.UserStatus;
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
import com.spice.profitmandi.web.req.UserRequest;
import com.spice.profitmandi.web.res.Notification;
import com.spice.profitmandi.web.res.Partner;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

/**
 * @author ashikali
 *
 */
@Controller
@Transactional(rollbackFor = Throwable.class)
public class UserController {

        @Autowired
        private ResponseSender<?> responseSender;

        private static final Logger LOGGER = LogManager.getLogger(UserController.class);

        @Value("${notifications.api.host}")
        private String nodeHost;

        @Value("${notifications.api.port}")
        private int nodePort;

        @Value("${admin.token}")
        private String validAdminToken;

        @Autowired
        private UserRepository userRepository;

        @Autowired
        private com.spice.profitmandi.dao.repository.user.UserRepository userUserRepository;

        @Autowired
        private RetailerRepository retailerRepository;

        @Autowired
        private UserRoleRepository userRoleRepository;

        @Autowired
        private UserAccountRepository userAccountRepository;

        @Autowired
        private AuthService authService;

        @Autowired
        private AddressRepository addressRepository;

        @Autowired
        private GoogleLoginProcessor googleLoginProcessor;

        @Autowired
        private UserService userService;

        @Autowired
        private RestClient restClient;

        @Autowired
        private RoleManager roleManager;

        @Autowired
        private RoleRepository roleRepository;

        @Autowired
        private AuthRepository authRepository;

        @Autowired
        private RetailerService retailerService;

        @RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, method = RequestMethod.POST)
        public ResponseEntity<?> googleLogin(HttpServletRequest request, @RequestBody GoogleLoginRequest googleLoginRequest)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                Map<String, Object> resultMap = googleLoginProcessor.process(googleLoginRequest);
                LOGGER.info("Response sent is {}", resultMap);
                return responseSender.ok(googleLoginProcessor.process(googleLoginRequest));
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method = RequestMethod.GET)
        public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                return responseSender.ok(JWTUtil.isExpired(token));
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_DETAIL_BY_TOKEN, method = RequestMethod.GET)
        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        public ResponseEntity<?> tokenInfo(HttpServletRequest request) throws Throwable {
                Map<String, Object> responseMap = new HashMap<>();
                UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
                User user = null;
                if (userInfo.getUserId() > -1) {
                        user = userRepository.selectById(userInfo.getUserId());
                        if (!(userInfo.getEmail() == null || user.getEmailId().equalsIgnoreCase(userInfo.getEmail()))) {
                                String userName = null;
                                if (user.getSecondryEmailId() != null && user.getSecondryEmailId().equals(userInfo.getEmail())) {
                                        userName = user.getFirstName() + " " + user.getLastName();
                                } else {
                                        userName = authService.getNameByEmailId(userInfo.getEmail());
                                }
                                responseMap.put(ProfitMandiConstants.USER_ID, userInfo.getUserId());
                                responseMap.put(ProfitMandiConstants.USER_NAME, userName);
                                responseMap.put(ProfitMandiConstants.USER_STATUS, "fofoAssociate");
                                responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
                                return responseSender.ok(responseMap);
                        }
                } else {
                        try {
                                user = userRepository.selectByEmailId(userInfo.getEmail());
                        } catch (ProfitMandiBusinessException e1) {
                        }
                        if (user == null) {
                                try {
                                        user = userRepository.selectBySecondryEmailId(userInfo.getEmail());
                                } catch (ProfitMandiBusinessException e1) {
                                        LOGGER.info("Uneregistered user", userInfo.getEmail());
                                }
                        }
                }
                if (user != null) {
                        int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
                        responseMap.put(ProfitMandiConstants.EMAIL_ID, user.getEmailId());
                        responseMap.put(ProfitMandiConstants.USER_ID, user.getId());
                        responseMap.put(ProfitMandiConstants.USER_NAME, user.getFirstName() + " " + user.getLastName());
                        List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
                        // LOGGER.info("userRoles {} ", userRoles);

                        // generate new token if roles have been updated
                        if (userInfo.getRoleIds() == null || roleIds.size() != userInfo.getRoleIds().size()) {
                                String[] roleIdStrings = new String[roleIds.size()];
                                int index = 0;
                                for (int roleId : roleIds) {
                                        roleIdStrings[index++] = String.valueOf(roleId);
                                }
                                String newToken = JWTUtil.create(user.getId(), retailerId, roleIdStrings);
                                responseMap.put("newAuthToken", newToken);
                        }
                        // if user is retailer
                        Set<Integer> roleIdsSet = new HashSet<Integer>(roleIds);
                        if (roleManager.isRetailer(roleIdsSet)) {
                                UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
                                Retailer retailer = retailerRepository.selectById(uc.getUserId());
                                com.spice.profitmandi.dao.entity.user.User saholicUser = userUserRepository.selectById(uc.getUserId());
                                if (saholicUser.getAddressId() != null) {
                                        Address address = addressRepository.selectById(saholicUser.getAddressId());
                                        responseMap.put(ProfitMandiConstants.ADDRESS, address);
                                }
                                // if retailer is activated 1 then verified retailer
                                // else if migrated is 1 then old retailer
                                // also lets incoporte old process i.e is user is activated then also retailer
                                // is verified retailer
                                // else retailer is not verifed
                                if (retailer.isActive() || user.isActivated()) {
                                        if (roleManager.isPartner(roleIdsSet)) {
                                                responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.FOFO.getValue());
                                        } else {
                                                responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.VERIFIED_RETAILER.getValue());
                                        }
                                } else if (retailer.isMigrated()) {
                                        responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.RETAILER.getValue());
                                } else {
                                        responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_VERIFIED_RETAILER.getValue());
                                }
                        } else if (roleManager.isUser(roleIdsSet)) {
                                responseMap.put("userInfo", getRegisteredUserInfo(user));
                                responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
                        }
                } else {
                        responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_REGISTERED.getValue());
                        responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
                }

                return responseSender.ok(responseMap);
        }

        private RegisteredUserInfo getRegisteredUserInfo(User user) throws Throwable {
                RegisteredUserInfo ri = new RegisteredUserInfo();
                ri.setCity(user.getCity());
                ri.setFirstName(user.getFirstName());
                ri.setLastName(user.getLastName());
                ri.setPhone(user.getMobileNumber());
                ri.setPinCode(user.getPinCode());
                ri.setState(user.getState());
                return ri;
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                User user = new User();
                user.setFirstName(userRequest.getFirstName());
                user.setLastName(userRequest.getLastName());
                user.setCity(userRequest.getCity());
                user.setPinCode(Integer.valueOf(userRequest.getPinCode()));
                user.setState(userRequest.getState());
                user.setMobileNumber(userRequest.getMobieNumber());
                user.setEmailId(userRequest.getEmailId());
                user.setUsername("");
                user.setPassword("");
                user.setMobile_verified(false);
                user.setReferral_url("");
                user.setGroup_id(1);
                user.setStatus(1);
                user.setActivated(false);
                user.setCreateTimestamp(LocalDateTime.now());
                user.setUpdateTimestamp(LocalDateTime.now());
                userRepository.persist(user);
                Role role = roleRepository.selectByName(RoleType.USER.toString());
                UserRole userRole = new UserRole();
                userRole.setRoleId(role.getId());
                userRole.setUserId(user.getId());
                userRoleRepository.persist(userRole);
                return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1000"));

        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_ID, method = RequestMethod.GET)
        public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                return responseSender.ok(userRepository.selectById(id));
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER, method = RequestMethod.GET)
        public ResponseEntity<?> getByMobileNumber(HttpServletRequest request,
                        @RequestParam(name = "mobileNumber") String mobileNumber) throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                return responseSender.ok(userRepository.selectByMobileNumber(mobileNumber));
        }

        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        @RequestMapping(value = ProfitMandiConstants.URL_USER_ACTIVATE, method = RequestMethod.POST)
        public ResponseEntity<?> activateUser(HttpServletRequest request,
                        @RequestParam(name = "activationCode") String activationCode) throws Throwable {
                int userId = (int) request.getAttribute("userId");
                UserCart uc = userAccountRepository.getUserCart(userId);
                return responseSender.ok(userService.updateActivation(userId, uc.getUserId(), activationCode));
        }

        /*@ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        @RequestMapping(value = ProfitMandiConstants.URL_USER_NOTIFICATIONS, method = RequestMethod.GET)
        public ResponseEntity<?> getNofitications(HttpServletRequest request,
                        @RequestParam(name = "androidId") String androidId, @RequestParam(name = "pageNumber") int pageNumber,
                        @RequestParam(name = "pageSize") int pageSize) throws ProfitMandiBusinessException {
                int userId = (int) request.getAttribute("userId");
                String restResponse = null;
                Map<String, String> params = new HashMap<>();

                String uri = "/getAllNotifications";
                params.put("user_id", userId + "");
                params.put("android_id", androidId);
                params.put("limit", pageSize + "");
                params.put("offset", "" + ((pageNumber - 1) * pageSize));
                try {
                        restResponse = restClient.get(SchemeType.HTTP, nodeHost, nodePort, uri, params);
                } catch (HttpHostConnectException e) {
                        throw new ProfitMandiBusinessException("", "", "Could not Connect to host");
                }

                JsonArray result_json = Json.parse(restResponse).asArray();

                List<Notification> notifications = new ArrayList<>();

                for (JsonValue j : result_json) {
                        notifications.add(toNotifiaction(j.asObject()));
                }

                return responseSender.ok(notifications);
        }

        private Notification toNotifiaction(JsonObject jsonObject) {
                Notification n = (Notification) (new Gson().fromJson(jsonObject.toString(), Notification.class));
                if (n.getStatus().equals("opened") || n.getStatus().equals("referrer") || n.getStatus().equals("seen")) {
                        n.setSeen(true);
                }
                return n;
        }*/

        @RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
        public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request,
                        @RequestParam(name = "mobileNumber") String mobileNumber) {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                return responseSender.ok(userRepository.isExistByMobileNumber(mobileNumber));
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID, method = RequestMethod.GET)
        public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                User user = null;
                try {
                        user = userRepository.selectByEmailId(emailId);
                } catch (ProfitMandiBusinessException profitMandiBusinessException) {
                        user = userRepository.selectBySecondryEmailId(emailId);
                }
                return responseSender.ok(user);
        }

        @RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL, method = RequestMethod.GET)
        public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") int id) {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                return responseSender.ok(userRoleRepository.selectRolesByUserId(id));
        }

        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        @RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID_AND_FOFO_STORE_CODE, method = RequestMethod.GET)
        public ResponseEntity<?> getSecondryEmailAndStoreCode(HttpServletRequest request)
                        throws ProfitMandiBusinessException {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
                return responseSender.ok(userService.getEmailsAndFofoStoreCodeByUserId(userId));
        }

        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "-Token", required = true, dataType = "string", paramType = "header") })
        @RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID, method = RequestMethod.PUT)
        public ResponseEntity<?> updateSecondryEmailId(HttpServletRequest request,
                        @RequestParam(name = ProfitMandiConstants.SECONDRY_EMAIL_ID) String secondryEmailId) throws Throwable {
                int userId = (int) request.getAttribute("userId");
                User user = userRepository.selectById(userId);
                user.setSecondryEmailId(secondryEmailId);
                userRepository.persist(user);
                return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1001"));
        }

        @RequestMapping(value = ProfitMandiConstants.URL_ADMIN_TOKEN, method = RequestMethod.POST)
        public ResponseEntity<?> getAdminToken(HttpServletRequest request,
                        @RequestParam(name = "adminToken") String adminToken, @RequestParam(name = "emailId") String emailId) {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                if (!adminToken.equals(validAdminToken)) {
                        return responseSender.forbidden(null);
                }

                Map<String, Object> responseMap = new HashMap<>(2);
                User user = null;
                try {
                        user = userRepository.selectByEmailId(emailId);
                } catch (ProfitMandiBusinessException profitMandiBusinessException) {

                }

                if (user == null) {
                        try {
                                user = userRepository.selectBySecondryEmailId(emailId);
                        } catch (ProfitMandiBusinessException profitMandiBusinessException) {

                        }
                }
                if (user != null) {
                        int retailerId = 0;
                        try {
                                retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
                        } catch (ProfitMandiBusinessException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        }
                        List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
                        String[] roleIdsString = new String[roleIds.size()];
                        int index = 0;
                        for (int roleId : roleIds) {
                                roleIdsString[index++] = String.valueOf(roleId);
                        }
                        responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(user.getId(), retailerId, roleIdsString));
                        responseMap.put(ProfitMandiConstants.REGISTERED, true);
                } else {
                        responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(emailId));
                        responseMap.put(ProfitMandiConstants.REGISTERED, false);
                }
                return responseSender.ok(responseMap);

        }

        @RequestMapping(value = "/mobileappsettings", method = RequestMethod.POST)
        public ResponseEntity<?> mobileAppSettings(HttpServletRequest request, @RequestParam(name = "t") int timestamp,
                        @RequestParam(name = "imeinumber") String imeinumber)
                        throws ProfitMandiBusinessException, ClientProtocolException, IOException {

                final String uri = "http://api.profittill.com/mobileappsettings?t=" + timestamp + "&imeinumber=" + imeinumber;
                final String BASIC_AUTH = "Basic " + Base64.getEncoder().encodeToString("dtr:dtr18Feb2015".getBytes());
                Map<String, String> headers = new HashMap<>();
                Map<String, String> params = new HashMap<>();
                headers.put("Authorization", BASIC_AUTH);
                return responseSender.ok(restClient.post(uri, params, headers));
        }

        @RequestMapping(value = "/getPartners", method = RequestMethod.GET)
        @ApiImplicitParams({
                        @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId,
                        @RequestParam(value = "offset") int offset, @RequestParam(value = "limit") int limit)
                        throws ProfitMandiBusinessException {
                AuthUser authUser = authRepository.selectByGmailId(gmailId);

                Map<String, List<String>> storeGuyMap = new HashMap<>();
                for (Map.Entry<String, List<String>> entry : storeManagerMap.entrySet()) {
                        String storeEmail = entry.getKey();
                        List<String> storeGuys = entry.getValue();
                        for (String storeGuy : storeGuys) {
                                if (!storeGuyMap.containsKey(storeGuy)) {
                                        storeGuyMap.put(storeGuy, new ArrayList<>());
                                }
                                storeGuyMap.get(storeGuy).add(storeEmail);
                        }

                }
                storeGuyMap.remove("");

                List<String> emails = storeGuyMap.get(authUser.getEmailId());
                LOGGER.info("emails" + emails);
                List<User> users = userRepository.selectAllByEmails(emails,offset,limit);
                List<Partner> partners = new ArrayList<>();
                for (User user : users) {
                        
                        UserAccount uc = userAccountRepository.selectSaholicByUserId(user.getId());
                        com.spice.profitmandi.dao.entity.user.User userInfo = userUserRepository.selectById(uc.getAccountKey());        
                        CustomRetailer customRetailer = retailerService.getFofoRetailer(userInfo.getId());

                        Partner partner = new Partner();
                        partner.setBusinessName(customRetailer.getBusinessName());
                        partner.setPartnerId(customRetailer.getPartnerId());
                        partner.setCartId(customRetailer.getCartId());
                        partner.setEmail(customRetailer.getEmail());
                        partner.setGstNumber(customRetailer.getGstNumber());
                        partner.setDisplayName(customRetailer.getDisplayName());
                        partner.setCity(customRetailer.getAddress().getCity());
                        partner.setUserId(user.getId());
                        partners.add(partner);
                }
                LOGGER.info("partners" + partners);
                return responseSender.ok(partners);
        }

        public static final Map<String, String> nameEmail = new HashMap<>();

        public static final Map<String, List<String>> storeManagerMap = new HashMap<>();

        static {
                nameEmail.put("Amod", "amod.sen@smartdukaan.com");
                nameEmail.put("Parmod", "parmod.kumar@smartdukaan.com");
                nameEmail.put("Anis", "md.anis@smartdukaan.com");
                nameEmail.put("Manoj", "manoj.singh@smartdukaan.com");
                nameEmail.put("Adeel", "adeel.yazdani@smartdukaan.com");
                nameEmail.put("Mohinder", "mohinder.mutreja@smartdukaan.com");
                nameEmail.put("Dharmendar", "dharmender.verma@smartdukaan.com");
                nameEmail.put("Rajat", "rajat.gupta@smartdukaan.com");
                nameEmail.put("Ankit", "ankit.bhatia@smartdukaan.com");
                nameEmail.put("Rajit", "rajit.alag@smartdukaan.com");
                nameEmail.put("Gulshan", "gulshan.kumar@smartdukaan.com");
                nameEmail.put("PramodSharma", "parmod.sharma@smartdukaan.com");
                // nameEmail.put("Gulshan","");
                storeManagerMap.put("themobileplanet03@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("mobileplanet7599@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("robintelecom.snp@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("smartconnect4141@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("bhimsain919@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("babitaranirk@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("dharmendery079@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("kkv.enterprises1@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("gulshersaifi74226@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("deepak.lalwani1985@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("gupta.smartdukaan@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("sachinindri2006@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("kambojanil83@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("uppal.neeraj82@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("thefonehousekarnal@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("richa9910763006@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("smartdukangzb@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("lovelymobile183@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("smartdukaan.sonepat@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("arunmittal299@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("gtc01100@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("sumittyagi1975@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("metrofurniture342@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("suryaelectronicskaithal@gmail.com", Arrays.asList("Parmod", "", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("mmtelecomsec16@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("omsonsindia08@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("smartenterprisespv@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("cachaitnya@gmail.com", Arrays.asList("amod.sen@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("ajaykumarkansal03@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("spurwar73@gmail.com", Arrays.asList("md.anis@smartdukaan.com", "rajat.gupta@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("Shreemobile.ind@gmail.com", Arrays.asList("md.anis@smartdukaan.com", "rajat.gupta@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("felixenterprises2017@rediffmail.com", Arrays.asList("", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("nareandergupta@gmail.com", Arrays.asList("", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("shreebalajielectronic2019@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("saranshary@gmail.com", Arrays.asList("", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("gambhirsmartphone@gmail.com", Arrays.asList("", "gulshan.kumar@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("Priyankaenterprises9910@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("pawan.dhimaan@gmail.com", Arrays.asList("", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("lakshaydhulla62@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("parastelecom.stp@gmail.com", Arrays.asList("md.anis@smartdukaan.com", "rajat.gupta@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("talwarmukesh298@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("sahilnarang0009@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("supertelecomjind@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("saketnagpal@gmail.com", Arrays.asList("", "rajit.alag@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("DEEPAKGOYAL702.DG@GMAIL.COM", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("sambhav350@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("mayankarora98133@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("vijaymobilityandmoew@gmail.com", Arrays.asList("manoj.singh@smartdukaan.com", "", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("amitv70003@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("newagelucknow.123@gmail.com", Arrays.asList("md.anis@smartdukaan.com", "rajat.gupta@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("Newagetechnologygomtinagar@gmail.com", Arrays.asList("md.anis@smartdukaan.com", "rajat.gupta@smartdukaan.com", "adeel.yazdani@smartdukaan.com"));
                storeManagerMap.put("rohitbatra106@gmail.com", Arrays.asList("parmod.sharma@smartdukaan.com", "dharmender.verma@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("sonisunil9050873061@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("moderncohsr@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("raghubir.ngh@gmail.com", Arrays.asList("", "ankit.bhatia@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
                storeManagerMap.put("aman007singla@gmail.com", Arrays.asList("", "rajit.alag@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"));
        }
}