南昌市物联网技防平台-后台
Administrator
2021-04-12 36afc3a1f1437b8a3283dc0bf6475e96fded05a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package org.springblade.jfpt.animalheat.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.jfpt.animalheat.vo.AnimalHeatExcel;
import org.springblade.jfpt.animalheat.entity.BladeAnimalHeat;
import org.springblade.jfpt.animalheat.service.AnimalHeatService;
import org.springblade.jfpt.animalheat.vo.AnimalHeatVo;
import org.springblade.jfpt.parcel.vo.ConditionVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 体温监测控制层
 * @time 2021-2-25
 */
 
@RestController
@RequestMapping("animalHeat/animalHeat")
@AllArgsConstructor
public class AnimalHeatController {
 
    private final AnimalHeatService animalHeatService;
 
    /**
     * 获取体温数据统计
     * @param animalHeatVo 条件参数 开始时间,结束时间
     * @return
     */
    @GetMapping("/getAnimalStatis")
    public R getAnimalStatis(AnimalHeatVo animalHeatVo,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Allow-Credentials","true");
        return R.data(animalHeatService.getAnimalStatis(animalHeatVo));
    }
 
 
    /**
     * 体温数据的分页数据--图表的点击事件
     * @param animalHeatVo 查询条件  包含时间状态type 0:本日  1:本周   2:本月
     * @param query  查询页码
     * @return
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    public R<IPage<BladeAnimalHeat>> page(AnimalHeatVo animalHeatVo, Query query,HttpServletResponse response) {
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Allow-Credentials","true");
        return R.data(animalHeatService.selectAnimalHeatPage(Condition.getPage(query), animalHeatVo));
    }
 
    /**
     * 查询本周每天的体温数据数量
     * @return
     */
    @GetMapping("/selWeekDayAnimalStatis")
    public R selWeekDayAnimalStatis(HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Allow-Credentials","true");
        return R.data(animalHeatService.selWeekDayAnimalStatis());
    }
 
    /**
     * 导出体温数据列表
     * @param animalHeatVo 条件
     * @param response 返回域
     */
    @GetMapping("/export-animalHeat")
    public void exportAnimalHeat(AnimalHeatVo animalHeatVo,HttpServletResponse response){
        List<AnimalHeatExcel> list = animalHeatService.exportAnimalHeat(animalHeatVo);
        ExcelUtil.export(response, "体温检测数据" + DateUtil.time(), "体温检测数据表", list, AnimalHeatExcel.class);
    }
 
}