BJQ6075 设备控制类

This commit is contained in:
2025-11-06 10:39:12 +08:00
parent 1dc3386284
commit c7ff118bfe
12 changed files with 421 additions and 145 deletions

View File

@ -28,6 +28,7 @@ public class DeviceBJQController extends BaseController {
private final DeviceBJQBizService appDeviceService;
/**
* 获取设备详细信息
*
@ -35,10 +36,11 @@ public class DeviceBJQController extends BaseController {
*/
@GetMapping("/{id}")
public R<AppDeviceDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
@PathVariable Long id) {
return R.ok(appDeviceService.getInfo(id));
}
/**
* 人员信息登记
*/
@ -74,7 +76,7 @@ public class DeviceBJQController extends BaseController {
public R<Void> upload(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
MultipartFile file = bo.getFile();
if(file.getSize()>1024*1024*2){
if (file.getSize() > 1024 * 1024 * 2) {
return R.warn("图片不能大于2M");
}
appDeviceService.uploadDeviceLogo(bo);
@ -90,7 +92,7 @@ public class DeviceBJQController extends BaseController {
public R<Void> batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
MultipartFile file = bo.getFile();
if(file.getSize()>1024*1024*2){
if (file.getSize() > 1024 * 1024 * 2) {
return R.warn("图片不能大于2M");
}
appDeviceService.batchUploadLogo(bo);
@ -112,7 +114,6 @@ public class DeviceBJQController extends BaseController {
/**
* 灯光亮度设置
*
*/
// @FunctionAccessAnnotation("lightBrightnessSettings")
@PostMapping("/lightBrightnessSettings")
@ -123,7 +124,6 @@ public class DeviceBJQController extends BaseController {
/**
* 激光模式设置
*
*/
@PostMapping("/laserModeSettings")
// @FunctionAccessAnnotation("laserModeSettings")

View File

@ -29,7 +29,7 @@ import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/device")
public class DeviceControlCenterController extends BaseController {
public class DeviceControlCenterController extends BaseController {
private final DeviceBizService appDeviceService;
@ -42,6 +42,7 @@ public class DeviceControlCenterController extends BaseController {
return appDeviceService.queryWebDeviceList(bo, pageQuery);
}
/**
* 绑定设备
*/
@ -59,6 +60,7 @@ public class DeviceControlCenterController extends BaseController {
return toAjax(appDeviceService.unBindDevice(id));
}
/**
* 查询设备类型列表
*/
@ -68,6 +70,7 @@ public class DeviceControlCenterController extends BaseController {
return R.ok(typeList);
}
/**
* 重命名设备
*
@ -100,7 +103,7 @@ public class DeviceControlCenterController extends BaseController {
*/
@GetMapping("/instructionRecord")
public TableDataInfo<InstructionRecordVo> getInstructionRecord(InstructionRecordDto dto, PageQuery pageQuery) {
return appDeviceService.getInstructionRecord(dto,pageQuery);
return appDeviceService.getInstructionRecord(dto, pageQuery);
}
/**
@ -111,7 +114,7 @@ public class DeviceControlCenterController extends BaseController {
pageQuery.setPageNum(1);
pageQuery.setPageSize(2000);
TableDataInfo<InstructionRecordVo> instructionRecord = appDeviceService.getInstructionRecord(dto, pageQuery);
if(instructionRecord.getRows() == null){
if (instructionRecord.getRows() == null) {
return;
}
ExcelUtil.exportExcel(instructionRecord.getRows(), "设备操作日志", InstructionRecordVo.class, response);
@ -123,7 +126,7 @@ public class DeviceControlCenterController extends BaseController {
*/
@GetMapping("/locationHistory")
public TableDataInfo<LocationHistoryVo> getLocationHistory(InstructionRecordDto dto, PageQuery pageQuery) {
return appDeviceService.getLocationHistory(dto,pageQuery);
return appDeviceService.getLocationHistory(dto, pageQuery);
}
/**
@ -134,7 +137,7 @@ public class DeviceControlCenterController extends BaseController {
pageQuery.setPageNum(1);
pageQuery.setPageSize(2000);
TableDataInfo<LocationHistoryVo> result = appDeviceService.getLocationHistory(dto, pageQuery);
if(result.getRows() == null){
if (result.getRows() == null) {
return;
}
ExcelUtil.exportExcel(result.getRows(), "历史轨迹记录", LocationHistoryVo.class, response);
@ -147,4 +150,5 @@ public class DeviceControlCenterController extends BaseController {
public R<List<LocationHistoryDetailVo>> getLocationHistoryDetail(Long id) {
return R.ok(appDeviceService.getLocationHistoryDetail(id));
}
}

View File

@ -0,0 +1,140 @@
package com.fuyuanshen.web.controller.device.bjq;
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.core.validate.AddGroup;
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessAnnotation;
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessBatcAnnotation;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo;
import com.fuyuanshen.web.service.device.DeviceBJQBizService;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* web后台:设备控制类
* 6075
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/bjq6075/device")
public class DeviceBJQ6075Controller extends BaseController {
private final DeviceBJQBizService appDeviceService;
/**
* 获取设备详细信息
*
* @param id 主键
*/
@GetMapping("/{id}")
public R<AppDeviceDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(appDeviceService.getInfo(id));
}
/**
* 人员信息登记
*/
@PostMapping(value = "/registerPersonInfo")
// @FunctionAccessAnnotation("registerPersonInfo")
public R<Void> registerPersonInfo(@Validated(AddGroup.class) @RequestBody AppPersonnelInfoBo bo) {
return toAjax(appDeviceService.registerPersonInfo(bo));
}
/**
* 发送信息
*/
@PostMapping(value = "/sendMessage")
@FunctionAccessBatcAnnotation(value = "sendMessage", timeOut = 30, batchMaxTimeOut = 40)
public R<Void> sendMessage(@RequestBody AppDeviceSendMsgBo bo) {
return toAjax(appDeviceService.sendMessage(bo));
}
/**
* 发送报警信息
*/
@PostMapping(value = "/sendAlarmMessage")
@FunctionAccessBatcAnnotation(value = "sendAlarmMessage", timeOut = 5, batchMaxTimeOut = 10)
public R<Void> sendAlarmMessage(@RequestBody AppDeviceSendMsgBo bo) {
return toAjax(appDeviceService.sendAlarmMessage(bo));
}
/**
* 上传设备logo图片
*/
@PostMapping("/uploadLogo")
@FunctionAccessAnnotation("uploadLogo")
public R<Void> upload(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
MultipartFile file = bo.getFile();
if (file.getSize() > 1024 * 1024 * 2) {
return R.warn("图片不能大于2M");
}
appDeviceService.uploadDeviceLogo(bo);
return R.ok();
}
/**
* 批量上传设备logo图片
*/
@PostMapping("/batchUploadLogo")
@FunctionAccessAnnotation("batchUploadLogo")
public R<Void> batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
MultipartFile file = bo.getFile();
if (file.getSize() > 1024 * 1024 * 2) {
return R.warn("图片不能大于2M");
}
appDeviceService.batchUploadLogo(bo);
return R.ok();
}
/**
* 灯光模式
* 0关灯1强光模式2弱光模式, 3爆闪模式, 4泛光模式
*/
// @FunctionAccessAnnotation("lightModeSettings")
@PostMapping("/lightModeSettings")
public R<Void> lightModeSettings(@RequestBody DeviceInstructDto params) {
// params 转 JSONObject
appDeviceService.lightModeSettings(params);
return R.ok();
}
/**
* 灯光亮度设置
*/
// @FunctionAccessAnnotation("lightBrightnessSettings")
@PostMapping("/lightBrightnessSettings")
public R<Void> lightBrightnessSettings(@RequestBody DeviceInstructDto params) {
appDeviceService.lightBrightnessSettings(params);
return R.ok();
}
/**
* 激光模式设置
*/
@PostMapping("/laserModeSettings")
// @FunctionAccessAnnotation("laserModeSettings")
public R<Void> laserModeSettings(@RequestBody DeviceInstructDto params) {
appDeviceService.laserModeSettings(params);
return R.ok();
}
}