添加设备查询和设备更新接口

This commit is contained in:
648540858
2024-03-13 23:16:01 +08:00
parent d78f76e58b
commit 4eb0163e43
11 changed files with 462 additions and 5 deletions

View File

@@ -1,15 +1,21 @@
package com.genersoft.iot.vmp.jt1078.config;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
import com.genersoft.iot.vmp.jt1078.proc.response.*;
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* curl http://localhost:18080/api/jt1078/start/live/18864197066/1
@@ -26,6 +32,9 @@ public class JT1078Controller {
@Resource
JT1078Template jt1078Template;
@Resource
Ijt1078Service service;
/**
* jt1078Template 调用示例
*/
@@ -47,5 +56,26 @@ public class JT1078Controller {
return wvpResult;
}
@Operation(summary = "分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@GetMapping("/device/list")
public PageInfo<JTDevice> getDevices(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online) {
return service.getDeviceList(page, count, query, online);
}
@Operation(summary = "更新设备信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "device", description = "设备", required = true)
@PostMapping("/device/update")
public void updateDevice(JTDevice device){
assert device.getId() > 0;
assert device.getDeviceId() != null;
service.updateDevice(device);
}
}