|
@@ -4,8 +4,10 @@ package com.huimv.cattle.controller;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.druid.wall.violation.ErrorCode;
|
|
import com.alibaba.druid.wall.violation.ErrorCode;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.huimv.cattle.pojo.DataSource;
|
|
import com.huimv.cattle.pojo.PreventDetection;
|
|
import com.huimv.cattle.pojo.PreventDetection;
|
|
import com.huimv.cattle.pojo.vo.PreventDetectionVo;
|
|
import com.huimv.cattle.pojo.vo.PreventDetectionVo;
|
|
|
|
+import com.huimv.cattle.service.DataSourceService;
|
|
import com.huimv.cattle.service.PreventDetectionService;
|
|
import com.huimv.cattle.service.PreventDetectionService;
|
|
import com.huimv.cattle.token.TokenSign;
|
|
import com.huimv.cattle.token.TokenSign;
|
|
import com.huimv.cattle.utils.FarmCodeUtils;
|
|
import com.huimv.cattle.utils.FarmCodeUtils;
|
|
@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -35,6 +38,8 @@ import java.util.Map;
|
|
public class PreventDetectionController {
|
|
public class PreventDetectionController {
|
|
@Autowired
|
|
@Autowired
|
|
private PreventDetectionService preventDetectionService;
|
|
private PreventDetectionService preventDetectionService;
|
|
|
|
+ @Resource
|
|
|
|
+ private DataSourceService dataSourceService;
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@PostMapping("/savePreventDetection")
|
|
@PostMapping("/savePreventDetection")
|
|
@@ -72,6 +77,24 @@ public class PreventDetectionController {
|
|
}
|
|
}
|
|
return new Result(ResultCode.SUCCESS,list);
|
|
return new Result(ResultCode.SUCCESS,list);
|
|
}
|
|
}
|
|
|
|
+ @PostMapping("/getPreventDetectionScreen")
|
|
|
|
+ public Result getPreventDetectionScreen(@RequestBody PreventDetection preventDetection,HttpServletRequest request){
|
|
|
|
+ String farmCode = FarmCodeUtils.getFarmCode(preventDetection.getFarmCode(), request);
|
|
|
|
+ DataSource dataSource = dataSourceService.getDataSourceStatus();
|
|
|
|
+ //镇汇总
|
|
|
|
+ List<PreventDetection> list = new ArrayList<>();
|
|
|
|
+ if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==2) {
|
|
|
|
+ list = preventDetectionService.getPreventDetectionScreen();
|
|
|
|
+ }else {
|
|
|
|
+ list = preventDetectionService.list(new QueryWrapper<PreventDetection>().eq("farm_code",farmCode).orderByDesc("year").orderByDesc("month"));
|
|
|
|
+ if (ObjectUtil.isEmpty(list)){
|
|
|
|
+ return new Result(ResultCode.SUCCESS,new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //县填写
|
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|