fire_point/src/main/java/com/xkrs/controller/ForestRangerController.java

58 lines
1.9 KiB
Java

package com.xkrs.controller;
import com.xkrs.service.ForestRangerService;
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 ForestRangerController {
@Resource
private ForestRangerService forestRangerService;
/**
* 根据区县编码查询相关护林员的信息
* @param rangerCountyCode
* @return
*/
@GetMapping("/findByRangerCountyCode")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value="Authorization") String token){
return forestRangerService.findByRangerCountyCode(rangerCountyCode);
}
/**
* 根据区县编码查询该区县所有护林员的信息
* @param countyCode
* @param token
* @return
*/
@GetMapping("/findAllByRangerCountyCode")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value="Authorization") String token){
return forestRangerService.findAllByRangerCountyCode(countyCode,token);
}
/**
* 根据手机号修改护林员的位置
* @param map
* @return
*/
@PostMapping("/updateLatAndLonByPhone")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
String rangerLatitude = (String) map.get("rangerLatitude");
String rangerLongitude = (String) map.get("rangerLongitude");
String rangerPhone = (String) map.get("rangerPhone");
return forestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
}
}