zhanghua
2023-10-02 26d24ccf61613446c7740d8c0ef3e201cf5f5274
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
package com.ycl.controller.smoke;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.annotation.LogSave;
import com.ycl.api.CommonPage;
import com.ycl.api.CommonResult;
import com.ycl.controller.BaseController;
import com.ycl.dto.smoker.InTimeCountDto;
import com.ycl.entity.smoke.OdsCustomer;
import com.ycl.entity.smoke.OdsInTime;
import com.ycl.service.smoke.IOdsCustomerService;
import com.ycl.service.smoke.IOdsInTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("/smoke")
@Api(tags = "油烟管理管理")
public class InTimeController extends BaseController {
 
    IOdsInTimeService inTimeService;
    IOdsCustomerService customerService;
 
 
    @Autowired
 
    public void setInTimeService(IOdsInTimeService inTimeService) {
        this.inTimeService = inTimeService;
    }
 
    @Autowired
    public void setCustomerService(IOdsCustomerService customerService) {
        this.customerService = customerService;
    }
 
    @ApiOperation("获取所属单位")
    @RequestMapping(value = "/customer/list", method = RequestMethod.GET)
    @ResponseBody
    @LogSave(operationType = "油烟模块", contain = "获取所属单位")
    public CommonResult<CommonPage<OdsCustomer>> findCustomerList(@RequestParam(value = "keyword", required = false) String keyword,
                                                                  @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        Page<OdsCustomer> customerPage = customerService.findList(keyword, pageSize, pageNum);
        return CommonResult.success(CommonPage.restPage(customerPage));
    }
 
    @ApiOperation("查询实时数据")
    @RequestMapping(value = "/inTime/list", method = RequestMethod.GET)
    @ResponseBody
    @LogSave(operationType = "油烟模块", contain = "查询实时数据")
    public CommonResult<CommonPage<OdsInTime>> findInTimeList(@RequestParam(value = "owner", required = false) String owner,
                                                              @RequestParam(value = "onlineStatus", required = false) String onlineStatus,
                                                              @RequestParam(value = "status", required = false) String status,
                                                              @RequestParam(value = "startTime", required = false) String startTime,
                                                              @RequestParam(value = "endTime", required = false) String endTime,
                                                              @RequestParam(value = "type", required = false) String type,
                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        Page<OdsInTime> inTimePage = inTimeService.findList(owner, onlineStatus, startTime, endTime, type, status, pageSize, pageNum);
        return CommonResult.success(CommonPage.restPage(inTimePage));
    }
 
    @ApiOperation("获取设备在线情况")
    @RequestMapping(value = "/inTime/count", method = RequestMethod.GET)
    @ResponseBody
    @LogSave(operationType = "油烟模块", contain = "获取设备在线情况")
    public CommonResult<InTimeCountDto> getInTimeCount() {
        InTimeCountDto dto = inTimeService.getInTimeCount();
        return CommonResult.success(dto);
    }
}