|
@@ -0,0 +1,134 @@
|
|
|
+package com.huimv.eartag2.api.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.huimv.eartag2.api.service.*;
|
|
|
+import com.huimv.eartag2.common.utils.Result;
|
|
|
+import com.huimv.eartag2.common.utils.ResultCode;
|
|
|
+import com.huimv.eartag2.api.pojo.BaseMap;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author zn
|
|
|
+ * @since 2022-08-30
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/pig")
|
|
|
+public class EartagAbnormalAlarmController {
|
|
|
+ @Autowired
|
|
|
+ private EartagAbnormalAlarmService eartagAbnormalAlarmService;
|
|
|
+ @Autowired
|
|
|
+ private FarmerAssetService farmerAssetService;
|
|
|
+ @Autowired
|
|
|
+ private IEartagEartagRegister2Service eartagRegisterService;
|
|
|
+ @Autowired
|
|
|
+ private IBaseMapService baseMapService;
|
|
|
+
|
|
|
+ //美维首页健康监测
|
|
|
+ @PostMapping("/getHealthy")
|
|
|
+ public Result getHealthy(@RequestBody Map<String, String> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.getHealthy(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ //美维首页群体健康
|
|
|
+ @PostMapping("/allHealthy")
|
|
|
+ public Result healthy(@RequestBody Map<String, String> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.allHealthy(paramsMap);
|
|
|
+ }
|
|
|
+ //美维首页羊只健康
|
|
|
+ @PostMapping("/getSheepHealthy")
|
|
|
+ public Result getSheepHealthy(@RequestBody Map<String, String> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.getSheepHealthy(paramsMap);
|
|
|
+ }
|
|
|
+ //获取报警接口
|
|
|
+ @PostMapping("/getWarning")
|
|
|
+ public Result getWarning(@RequestBody Map<String, String> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.getWarning(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ //下面是之前接口,暂时不动
|
|
|
+ @PostMapping("/getEarTemWarning")
|
|
|
+ public Result getEarTemWarning(@RequestBody Map<String, Object> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.getEarTemWarning(paramsMap);
|
|
|
+ }
|
|
|
+ @PostMapping("/listFarmer")
|
|
|
+ public Result listFarmer() throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.listFarmer();
|
|
|
+ }
|
|
|
+ @PostMapping("/getNewPig")
|
|
|
+ public Result getNewPig(@RequestBody Map<String, String> paramsMap) throws ParseException {
|
|
|
+ return eartagAbnormalAlarmService.getNewPig(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/getAssetStatistics")
|
|
|
+ public Result getAssetStatistics(@RequestBody Map<String, Object> paramsMap) throws ParseException {
|
|
|
+ return farmerAssetService.getAssetStatistics(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/countAll")
|
|
|
+ public Result countAll(@RequestBody Map<String, Object> paramsMap) {
|
|
|
+ return eartagAbnormalAlarmService.countAll(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/pigMonitor")
|
|
|
+ public Result pigMonitor(@RequestBody Map<String, Object> paramsMap) {
|
|
|
+ return eartagAbnormalAlarmService.pigMonitor(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/getFarmerAndPig")
|
|
|
+ public Result getFarmerAndPig(@RequestBody Map<String, Object> paramsMap) {
|
|
|
+ return eartagAbnormalAlarmService.getFarmerAndPig(paramsMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IEartagData2Service eartagDataService;
|
|
|
+ @PostMapping("/getEnvByTime")
|
|
|
+ public Result getEnvByTime(@RequestBody Map<String,String> map, HttpServletRequest request){
|
|
|
+ return eartagDataService.getEnvByTimePanan(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/getEnvLast")
|
|
|
+ public Result getEnvLast(@RequestBody Map<String,String> map){
|
|
|
+ return eartagDataService.getEnvLast(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/listFarmUnitEartagData")
|
|
|
+ public Result listFarmUnitEartagData(@RequestBody Map<String, String> params, HttpServletRequest req){
|
|
|
+// Integer userId = TokenSign.getMemberIdByJwtToken(req);
|
|
|
+// params.put("userId",userId+"");
|
|
|
+ return eartagRegisterService.listFarmUnitEartagDataQingshan(params);
|
|
|
+ }
|
|
|
+ @PostMapping("/mapAdd")
|
|
|
+ public Result mapAdd(@RequestBody BaseMap baseMap){
|
|
|
+ baseMapService.save(baseMap);
|
|
|
+ return new Result(10000,"添加成功",true);
|
|
|
+ }
|
|
|
+ @PostMapping("/mapUpdate")
|
|
|
+ public Result mmapUpdateapAdd(@RequestBody BaseMap baseMap){
|
|
|
+ baseMapService.updateById(baseMap);
|
|
|
+ return new Result(10000,"删除成功",true);
|
|
|
+ }
|
|
|
+ @PostMapping("/mapDelete")
|
|
|
+ public Result mapDelete(@RequestBody BaseMap baseMap){
|
|
|
+ baseMapService.removeById(baseMap);
|
|
|
+ return new Result(10000,"删除成功",true);
|
|
|
+ }
|
|
|
+ @PostMapping("/mapList")
|
|
|
+ public Result mapList(@RequestBody Map<String,Integer> map){
|
|
|
+ return new Result(ResultCode.SUCCESS, baseMapService.list());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|