| 27366 |
amit.gupta |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
|
|
|
5 |
import javax.servlet.http.HttpServletRequest;
|
|
|
6 |
|
|
|
7 |
import org.apache.logging.log4j.LogManager;
|
|
|
8 |
import org.apache.logging.log4j.Logger;
|
|
|
9 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
10 |
import org.springframework.stereotype.Controller;
|
|
|
11 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
12 |
import org.springframework.ui.Model;
|
|
|
13 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
14 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
15 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
16 |
|
|
|
17 |
import com.google.gson.Gson;
|
|
|
18 |
import com.spice.profitmandi.dao.entity.dtr.GpsLocation;
|
|
|
19 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
|
|
20 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
|
|
21 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
|
|
22 |
import com.spice.profitmandi.dao.repository.user.GpsLocationRepository;
|
|
|
23 |
|
|
|
24 |
@Controller
|
|
|
25 |
@Transactional(rollbackFor = Throwable.class)
|
|
|
26 |
public class MapTrackController {
|
|
|
27 |
|
|
|
28 |
private static final Logger LOGGER = LogManager.getLogger(PostOfficeController.class);
|
|
|
29 |
|
|
|
30 |
@Autowired
|
|
|
31 |
GpsLocationRepository gpsLocationRepository;
|
|
|
32 |
|
|
|
33 |
@Autowired
|
|
|
34 |
UserRepository userRepository;
|
|
|
35 |
|
|
|
36 |
@Autowired
|
|
|
37 |
AuthRepository authRepository;
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
@Autowired
|
|
|
41 |
Gson gson;
|
|
|
42 |
|
|
|
43 |
@RequestMapping(value = "/map", method = RequestMethod.GET)
|
|
|
44 |
public String getByPin(HttpServletRequest request, @RequestParam String email, Model model) throws Exception {
|
|
|
45 |
User dtrUser = userRepository.selectByEmailId(email);
|
|
|
46 |
List<GpsLocation> locations = gpsLocationRepository.selectAllByUserIdAndDate(dtrUser.getId(), null);
|
| 27368 |
amit.gupta |
47 |
LOGGER.info("locations {}", locations);
|
| 27366 |
amit.gupta |
48 |
model.addAttribute("locations", locations);
|
|
|
49 |
return "map-index";
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
}
|