jinpengyong
2024-02-29 b8e97933ddcffb65754a82b9993e3a37097cc2d2
screen-api/src/main/java/com/moral/api/controller/AppDevicController.java
@@ -15,10 +15,11 @@
import java.util.List;
import com.moral.api.entity.Device;
import com.moral.api.entity.Organization;
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.OrganizationService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.api.service.MonitorPointService;
import com.moral.api.service.SpecialDeviceService;
import com.moral.constant.ResultMessage;
@@ -29,36 +30,43 @@
public class AppDevicController {
    @Autowired
    private OrganizationService organizationService;
    private MonitorPointService monitorPointService;
    @Autowired
    private DeviceService deviceService;
    @Autowired
    private SpecialDeviceService specialDeviceService;
    @GetMapping("selectOrganization")
    @ApiOperation(value = "小程序获取组织")
    @ApiOperation(value = "小程序获取站点")
    public ResultMessage selectOrganization(){
        List<Organization> organizations = organizationService.getOrganizations();
        return ResultMessage.ok(organizations);
        List<MonitorPoint> monitorPoints = monitorPointService.getOrganizations();
        return ResultMessage.ok(monitorPoints);
    }
    @GetMapping("selectDevice")
    @ApiOperation(value = "小程序获取设备")
    public ResultMessage selectDevice(@RequestParam @ApiParam(value = "organizationId",name = "组织ID") Integer organizationId){
        List<Device> organizationDevice = deviceService.getOrganizationDevice(organizationId);
        if (ObjectUtils.isEmpty(organizationDevice)){
            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
        }
        return ResultMessage.ok(organizationDevice);
    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<Device> devices = deviceService.getFuzzySearch(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);
    }
}