feat(aiot): 新增方案B Controller
- AiAlertController: AI告警查询和统计API - AiAlgoTemplateController: 算法模板管理API - AiEdgeDeviceController: 边缘设备状态查询API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.genersoft.iot.vmp.aiot.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.aiot.bean.AiAlert;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiAlertService;
|
||||
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.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/alert")
|
||||
@Tag(name = "AI-告警管理")
|
||||
public class AiAlertController {
|
||||
|
||||
@Autowired
|
||||
private IAiAlertService alertService;
|
||||
|
||||
@Operation(summary = "告警列表(分页、筛选)")
|
||||
@GetMapping("/list")
|
||||
public PageInfo<AiAlert> queryList(
|
||||
@Parameter(description = "摄像头ID") @RequestParam(required = false) String cameraId,
|
||||
@Parameter(description = "告警类型") @RequestParam(required = false) String alertType,
|
||||
@Parameter(description = "开始时间") @RequestParam(required = false) String startTime,
|
||||
@Parameter(description = "结束时间") @RequestParam(required = false) String endTime,
|
||||
@RequestParam int page,
|
||||
@RequestParam int count) {
|
||||
return alertService.queryList(cameraId, alertType, startTime, endTime, page, count);
|
||||
}
|
||||
|
||||
@Operation(summary = "告警详情")
|
||||
@GetMapping("/{alertId}")
|
||||
public AiAlert queryDetail(@PathVariable String alertId) {
|
||||
return alertService.queryByAlertId(alertId);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除告警")
|
||||
@DeleteMapping("/delete")
|
||||
public void delete(@RequestParam(required = false) String alertId,
|
||||
@RequestParam(required = false) List<String> alertIds) {
|
||||
if (alertId != null) {
|
||||
alertService.delete(alertId);
|
||||
}
|
||||
if (alertIds != null && !alertIds.isEmpty()) {
|
||||
alertService.deleteBatch(alertIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "告警统计")
|
||||
@GetMapping("/statistics")
|
||||
public Map<String, Object> statistics(
|
||||
@Parameter(description = "统计起始时间") @RequestParam(required = false, defaultValue = "2020-01-01 00:00:00") String startTime) {
|
||||
return alertService.statistics(startTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.genersoft.iot.vmp.aiot.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.aiot.bean.AiAlgoTemplate;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiAlgoTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/template")
|
||||
@Tag(name = "AI-算法参数模板")
|
||||
public class AiAlgoTemplateController {
|
||||
|
||||
@Autowired
|
||||
private IAiAlgoTemplateService templateService;
|
||||
|
||||
@Operation(summary = "创建/更新模板")
|
||||
@PostMapping("/save")
|
||||
public void save(@RequestBody AiAlgoTemplate template) {
|
||||
templateService.save(template);
|
||||
}
|
||||
|
||||
@Operation(summary = "模板列表")
|
||||
@GetMapping("/list")
|
||||
public List<AiAlgoTemplate> queryList(
|
||||
@Parameter(description = "按算法代码筛选") @RequestParam(required = false) String algoCode) {
|
||||
return templateService.queryList(algoCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "模板详情")
|
||||
@GetMapping("/{templateId}")
|
||||
public AiAlgoTemplate queryDetail(@PathVariable String templateId) {
|
||||
return templateService.queryByTemplateId(templateId);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除模板")
|
||||
@DeleteMapping("/{templateId}")
|
||||
public void delete(@PathVariable String templateId) {
|
||||
templateService.delete(templateId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.genersoft.iot.vmp.aiot.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.aiot.bean.AiEdgeDevice;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiEdgeDeviceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/device")
|
||||
@Tag(name = "AI-边缘设备管理")
|
||||
public class AiEdgeDeviceController {
|
||||
|
||||
@Autowired
|
||||
private IAiEdgeDeviceService edgeDeviceService;
|
||||
|
||||
@Operation(summary = "边缘设备列表及状态")
|
||||
@GetMapping("/list")
|
||||
public List<AiEdgeDevice> queryList() {
|
||||
return edgeDeviceService.queryAll();
|
||||
}
|
||||
|
||||
@Operation(summary = "设备详情")
|
||||
@GetMapping("/{deviceId}")
|
||||
public AiEdgeDevice queryDetail(@PathVariable String deviceId) {
|
||||
return edgeDeviceService.queryByDeviceId(deviceId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user