Subversion Repositories SmartDukaan

Rev

Rev 27368 | 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.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.google.gson.Gson;
import com.spice.profitmandi.dao.entity.dtr.GpsLocation;
import com.spice.profitmandi.dao.entity.dtr.User;
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
import com.spice.profitmandi.dao.repository.user.GpsLocationRepository;

@Controller
@Transactional(rollbackFor = Throwable.class)
public class MapTrackController {

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

        @Autowired
        GpsLocationRepository gpsLocationRepository;
        
        @Autowired
        UserRepository userRepository;
        
        @Autowired
        AuthRepository authRepository;
        
        
        @Autowired
        Gson gson;
        
        @RequestMapping(value = "/map", method = RequestMethod.GET)
        public String getByPin(HttpServletRequest request, @RequestParam String email, Model model) throws Exception {
                User dtrUser = userRepository.selectByEmailId(email);
                List<GpsLocation> locations = gpsLocationRepository.selectAllByUserIdAndDate(dtrUser.getId(), null);
                model.addAttribute("locations", locations);
                return "map-index";
        }

}