2021-07-16 08:47:53 +08:00
|
|
|
package com.xkrs.controller;
|
|
|
|
|
2021-07-16 08:52:20 +08:00
|
|
|
import com.xkrs.service.ForestRangerService;
|
2021-07-16 08:47:53 +08:00
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author xkrs
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
public class XkRsForestRangerController {
|
|
|
|
|
|
|
|
@Resource
|
2021-07-16 08:52:20 +08:00
|
|
|
private ForestRangerService forestRangerService;
|
2021-07-16 08:47:53 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据区县编码查询相关护林员的信息
|
|
|
|
* @param rangerCountyCode
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/findByRangerCountyCode")
|
2021-07-16 08:52:20 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
|
|
|
public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value="Authorization") String token){
|
|
|
|
return forestRangerService.findByRangerCountyCode(rangerCountyCode);
|
2021-07-16 08:47:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据区县编码查询该区县所有护林员的信息
|
|
|
|
* @param countyCode
|
|
|
|
* @param token
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/findAllByRangerCountyCode")
|
2021-07-16 08:52:20 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
|
|
|
public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value="Authorization") String token){
|
|
|
|
return forestRangerService.findAllByRangerCountyCode(countyCode,token);
|
2021-07-16 08:47:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据手机号修改护林员的位置
|
|
|
|
* @param map
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@PostMapping("/updateLatAndLonByPhone")
|
2021-07-16 08:52:20 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
|
|
|
public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
|
2021-07-16 08:47:53 +08:00
|
|
|
String rangerLatitude = (String) map.get("rangerLatitude");
|
|
|
|
String rangerLongitude = (String) map.get("rangerLongitude");
|
|
|
|
String rangerPhone = (String) map.get("rangerPhone");
|
2021-07-16 08:52:20 +08:00
|
|
|
return forestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
|
2021-07-16 08:47:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|