forked from dyf/fys-Multi-tenant
feat(device): 新增设备控制相关接口
- 人员信息登记- 发送紧急通知 -上传设备 logo 图片 -静电预警档位设置- 照明档位设置- SOS 档位设置- 静止报警状态设置
This commit is contained in:
@ -0,0 +1,106 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
|
||||||
|
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
|
||||||
|
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
|
||||||
|
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.DeviceXinghanBizService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备控制类 HBY670
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/xinghan/device")
|
||||||
|
public class DeviceXinghanController extends BaseController {
|
||||||
|
|
||||||
|
private final DeviceXinghanBizService deviceXinghanBizService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/registerPersonInfo")
|
||||||
|
// @FunctionAccessAnnotation("registerPersonInfo")
|
||||||
|
public R<Void> registerPersonInfo(@Validated(AddGroup.class) @RequestBody AppPersonnelInfoBo bo) {
|
||||||
|
return toAjax(deviceXinghanBizService.registerPersonInfo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送紧急通知
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/sendAlarmMessage")
|
||||||
|
@FunctionAccessBatcAnnotation(value = "sendAlarmMessage", timeOut = 5, batchMaxTimeOut = 10)
|
||||||
|
public R<Void> sendAlarmMessage(@RequestBody AppDeviceSendMsgBo bo) {
|
||||||
|
return toAjax(deviceXinghanBizService.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");
|
||||||
|
}
|
||||||
|
deviceXinghanBizService.uploadDeviceLogo(bo);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 静电预警档位
|
||||||
|
* 3,2,1,0,分别表示高档/中档/低挡/关闭
|
||||||
|
*/
|
||||||
|
@PostMapping("/DetectGradeSettings")
|
||||||
|
public R<Void> DetectGradeSettings(@RequestBody DeviceInstructDto params) {
|
||||||
|
// params 转 JSONObject
|
||||||
|
deviceXinghanBizService.upDetectGradeSettings(params);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 照明档位
|
||||||
|
* 照明档位,2,1,0,分别表示弱光/强光/关闭
|
||||||
|
*/
|
||||||
|
@PostMapping("/LightGradeSettings")
|
||||||
|
public R<Void> LightGradeSettings(@RequestBody DeviceInstructDto params) {
|
||||||
|
// params 转 JSONObject
|
||||||
|
deviceXinghanBizService.upLightGradeSettings(params);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SOS档位
|
||||||
|
* SOS档位,2,1,0, 分别表示红蓝模式/爆闪模式/关闭
|
||||||
|
*/
|
||||||
|
@PostMapping("/SOSGradeSettings")
|
||||||
|
public R<Void> SOSGradeSettings(@RequestBody DeviceInstructDto params) {
|
||||||
|
// params 转 JSONObject
|
||||||
|
deviceXinghanBizService.upSOSGradeSettings(params);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 静止报警状态
|
||||||
|
* 静止报警状态,0-未静止报警,1-正在静止报警。
|
||||||
|
*/
|
||||||
|
@PostMapping("/ShakeBitSettings")
|
||||||
|
public R<Void> ShakeBitSettings(@RequestBody DeviceInstructDto params) {
|
||||||
|
// params 转 JSONObject
|
||||||
|
deviceXinghanBizService.upShakeBitSettings(params);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user