cjl
2023-11-15 d117d3af15dddc4f07baffa8b5bf6b727c05de7c
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
package com.moral.api.controller;
 
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
import com.moral.api.entity.Device;
import com.moral.api.entity.MonitorPoint;
import com.moral.api.pojo.vo.device.AppDeviceVo;
import com.moral.api.service.DeviceService;
import com.moral.api.service.MonitorPointService;
import com.moral.api.service.SpecialDeviceService;
import com.moral.constant.ResultMessage;
 
 
@Slf4j
@Api(tags = {"小程序设备管理"})
@RestController
@RequestMapping("/AppDevice")
public class AppDevicController {
 
    @Autowired
    private MonitorPointService monitorPointService;
 
    @Autowired
    private DeviceService deviceService;
 
    @Autowired
    private SpecialDeviceService specialDeviceService;
 
 
 
    @GetMapping("selectOrganization")
    @ApiOperation(value = "小程序获取站点")
    public ResultMessage selectOrganization(){
        List<MonitorPoint> monitorPoints = monitorPointService.getOrganizations();
        return ResultMessage.ok(monitorPoints);
    }
 
 
    @GetMapping("selectDevice")
    @ApiOperation(value = "小程序获取设备")
    public ResultMessage selectDevice(@RequestParam @ApiParam(value = "monitorPointId",name = "站点ID") Integer monitorPointId){
        List<Device> organizationDevice = deviceService.getOrganizationDevice(monitorPointId);
        return ResultMessage.ok(ObjectUtils.isEmpty(organizationDevice)?null:organizationDevice);
    }
 
    @GetMapping("fuzzySearch")
    @ApiOperation(value = "小程序模糊搜索")
    public ResultMessage fuzzySearch(@RequestParam @ApiParam(value = "mac",name = "设备mac号") String mac){
        List<AppDeviceVo> devices = deviceService.getFuzzySearch(mac);
        return ResultMessage.ok(devices);
    }
 
 
    @GetMapping("specialDevice")
    @ApiOperation(value = "查询特殊设备")
    public ResultMessage selectSpecialDevice(){
        List<AppDeviceVo> appDeviceVos = specialDeviceService.selectSpecialDevice();
        return ResultMessage.ok(appDeviceVos);
    }
}