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

57 lines
1.8 KiB
Java
Raw Normal View History

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