|
@@ -6,10 +6,7 @@ import com.huimv.apiservice.limit.annotation.Limit;
|
|
|
import com.huimv.apiservice.service.PigService;
|
|
|
import com.huimv.common.utils.R;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -29,36 +26,38 @@ public class PigController {
|
|
|
|
|
|
/**
|
|
|
* 获取猪基本信息
|
|
|
+ *
|
|
|
* @param accessToken token
|
|
|
* @param pigEarTagNo 耳标号
|
|
|
* @return
|
|
|
*/
|
|
|
- @Limit(key = "pig_getPigInfo",name = "pig/getPigInfo",prefix = "apiservice")
|
|
|
- @RequestMapping("/getPigInfo")
|
|
|
- public R getPigInfo(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
+ //@Limit(key = "pig_getPigInfo",name = "pig/getPigInfo",prefix = "apiservice")
|
|
|
+ @GetMapping("/getPigInfo")
|
|
|
+ public R getPigInfo(@RequestParam(value = "accessToken") String accessToken,
|
|
|
@RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
//TODO token校验
|
|
|
- Map<String,Object> map = pigService.getPigInfoByEarTagNo(pigEarTagNo);
|
|
|
+ Map<String, Object> map = pigService.getPigInfoByEarTagNo(pigEarTagNo);
|
|
|
return Objects.requireNonNull(R.ok().put("code", 1000)).put("data", map);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取多媒体接口(照片/视频)
|
|
|
+ *
|
|
|
* @param accessToken token
|
|
|
* @param pigEarTagNo 耳标号
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping("/getImage")
|
|
|
- public R getImage(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
+ @GetMapping("/getImage")
|
|
|
+ public R getImage(@RequestParam(value = "accessToken") String accessToken,
|
|
|
@RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
//TODO token校验
|
|
|
PigImageVo pigImageVo = pigService.getImageByEarTagNo(pigEarTagNo);
|
|
|
return Objects.requireNonNull(R.ok().put("code", 1000)).put("data", pigImageVo);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/getListByBreed")
|
|
|
- public R getListByBreed(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
+ @GetMapping("/getListByBreed")
|
|
|
+ public R getListByBreed(@RequestParam(value = "accessToken") String accessToken,
|
|
|
@RequestParam("breedName") String breedName) {
|
|
|
//TODO token校验
|
|
|
List<PigBaseVo> pigBaseVoList = pigService.getListByBreed(breedName);
|
|
@@ -83,7 +82,7 @@ public class PigController {
|
|
|
|
|
|
@RequestMapping("/getIndoorEnv")
|
|
|
public R getIndoorEnv(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
- @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
+ @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
//TODO token校验
|
|
|
EnvVo envVo = pigService.getIndoorEnv(pigEarTagNo);
|
|
|
return Objects.requireNonNull(R.ok().put("code", 1000)).put("data", envVo);
|
|
@@ -102,24 +101,23 @@ public class PigController {
|
|
|
//8.获取当天的睡眠状态数据接⼝
|
|
|
@RequestMapping("/getSleepStatus")
|
|
|
public R getSleepStatus(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
- @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
+ @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
//TODO token校验
|
|
|
SleepStatusEntity sleepStatusEntity = pigService.getSleepStatus(pigEarTagNo);
|
|
|
|
|
|
|
|
|
-
|
|
|
- return Objects.requireNonNull(Objects.requireNonNull(R.ok().put("code", 1000)).put("msg", "查询成功")).put("data",sleepStatusEntity );
|
|
|
+ return Objects.requireNonNull(Objects.requireNonNull(R.ok().put("code", 1000)).put("msg", "查询成功")).put("data", sleepStatusEntity);
|
|
|
}
|
|
|
|
|
|
//9.获取当天的运动数据接⼝
|
|
|
@RequestMapping("/getActivityAmount")
|
|
|
public R getActivityAmount(@RequestParam(value = "accessToken", required = false) String accessToken,
|
|
|
- @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
+ @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
//TODO token校验
|
|
|
PigSportVo pigSportVo = pigService.getActivityAmount(pigEarTagNo);
|
|
|
|
|
|
|
|
|
- return Objects.requireNonNull(Objects.requireNonNull(R.ok().put("code", 1000)).put("msg", "查询成功")).put("data",pigSportVo );
|
|
|
+ return Objects.requireNonNull(Objects.requireNonNull(R.ok().put("code", 1000)).put("msg", "查询成功")).put("data", pigSportVo);
|
|
|
}
|
|
|
|
|
|
}
|