feat:添加iot模块的功能权限和菜单

V0.5.x
xiwa 2023-07-24 13:24:41 +08:00
parent 01a1894f14
commit 8df36940b6
10 changed files with 4283 additions and 2525 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@ import cc.iotkit.common.api.Request;
import cc.iotkit.manager.service.AlertService;
import cc.iotkit.model.alert.AlertConfig;
import cc.iotkit.model.alert.AlertRecord;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -26,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = {"告警中心"})
@Slf4j
@RestController
@ -38,24 +38,28 @@ public class AlertController {
@ApiOperation("新增告警中心配置")
@SaCheckPermission("iot:alertConfig:add")
@PostMapping("/createAlertConfig")
public AlertConfig createAlertConfig(@RequestBody @Validated Request<AlertConfig> request) {
return alertService.createAlertConfig(request);
}
@ApiOperation("编辑告警中心配置")
@SaCheckPermission("iot:alertConfig:edit")
@PostMapping("/updateAlertConfig")
public AlertConfig updateAlertConfig(@RequestBody @Validated Request<AlertConfig> request) {
return alertService.updateAlertConfig(request);
}
@ApiOperation("删除告警中心配置")
@SaCheckPermission("iot:alertConfig:remove")
@PostMapping("/deleteAlertConfigById")
public Boolean deleteAlertConfigById(@RequestBody @Validated Request<Long> request) {
return alertService.deleteAlertConfigById(request);
}
@ApiOperation("查询告警中心配置分页")
@SaCheckPermission("iot:alertConfig:query")
@PostMapping("/selectAlertConfigPage")
public Paging<AlertConfig> selectAlertConfigPage(@RequestBody @Validated PageRequest<AlertConfig> request) {
return alertService.selectAlertConfigPage(request);
@ -63,12 +67,11 @@ public class AlertController {
@ApiOperation("查询告警消息分页")
@SaCheckPermission("iot:alert:query")
@PostMapping("/selectAlertRecordPage")
public Paging<AlertRecord> selectAlertRecordPage(@RequestBody @Validated PageRequest<AlertRecord> request) {
return alertService.selectAlertRecordPage(request);
}
}

View File

@ -31,6 +31,7 @@ import cc.iotkit.model.device.DeviceGroup;
import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.device.message.DeviceProperty;
import cc.iotkit.model.device.message.ThingModelMessage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -61,42 +62,49 @@ public class DeviceController {
@ApiOperation(value = "服务调用", notes = "服务调用", httpMethod = "POST")
@SaCheckPermission("iot:device:ctrl")
@PostMapping("/service/invoke")
public InvokeResult invokeService(@RequestBody @Validated Request<ServiceInvokeBo> request) {
return new InvokeResult(deviceService.invokeService(request.getData().getDeviceId(), request.getData().getService(), request.getData().getArgs()));
}
@ApiOperation(value = "属性获取", notes = "属性获取", httpMethod = "POST")
@SaCheckPermission("iot:device:ctrl")
@PostMapping("/service/property/get")
public InvokeResult invokeServicePropertySet(@RequestBody @Validated Request<GetDeviceServicePorpertyBo> request) {
return new InvokeResult(deviceService.getProperty(request.getData().getDeviceId(), request.getData().getPropertyNames(), true));
}
@ApiOperation(value = "属性设置", notes = "属性设置", httpMethod = "POST")
@SaCheckPermission("iot:device:ctrl")
@PostMapping("/service/property/set")
public InvokeResult setProperty(@RequestBody @Validated Request<SetDeviceServicePorpertyBo> request) {
return new InvokeResult(deviceService.setProperty(request.getData().getDeviceId(), request.getData().getArgs()));
}
@ApiOperation(value = "设备列表", notes = "设备列表", httpMethod = "POST")
@SaCheckPermission("iot:device:query")
@PostMapping("/list")
public Paging<DeviceInfo> getDevices(@Validated @RequestBody PageRequest<DeviceQueryBo> pageRequest) {
return deviceServiceImpl.getDevices(pageRequest);
}
@ApiOperation(value = "创建设备")
@SaCheckPermission("iot:device:add")
@PostMapping("/add")
public boolean createDevice(@RequestBody @Validated Request<DeviceInfoBo> bo) {
return deviceServiceImpl.addDevice(bo.getData());
}
@ApiOperation(value = "保存设备")
@SaCheckPermission("iot:device:edit")
@PostMapping("/save")
public boolean saveDevice(@RequestBody @Validated Request<DeviceInfoBo> bo) {
return deviceServiceImpl.saveDevice(bo.getData());
}
@ApiOperation(value = "获取子设备", notes = "获取子设备")
@SaCheckPermission("iot:device:query")
@PostMapping("/children/list")
public List<DeviceInfoVo> getChildren(@Validated @RequestBody PageRequest<String> request) {
String deviceId = request.getData();
@ -104,42 +112,49 @@ public class DeviceController {
}
@ApiOperation("获取网关设备")
@SaCheckPermission("iot:device:query")
@PostMapping("/getParentDevices")
public List<ParentDeviceVo> getParentDevices() {
return deviceServiceImpl.getParentDevices();
}
@ApiOperation("获取设备详情")
@SaCheckPermission("iot:device:query")
@PostMapping("/detail")
public DeviceInfo getDetail(@RequestBody @Validated Request<String> request) {
return deviceServiceImpl.getDetail(request.getData());
}
@ApiOperation("获取设备详情")
@SaCheckPermission("iot:device:query")
@PostMapping("/getByPkDn")
public DeviceInfo getByPkDn(@Validated @RequestBody Request<DeviceQueryByPkDnBo> query) {
return deviceServiceImpl.getByPkDn(query.getData().getPk(), query.getData().getDn());
}
@ApiOperation("删除设备")
@SaCheckPermission("iot:device:remove")
@PostMapping("/delete")
public boolean deleteDevice(@Validated @RequestBody Request<String> request) {
return deviceServiceImpl.deleteDevice(request.getData());
}
@ApiOperation("批量删除设备")
@SaCheckPermission("iot:device:remove")
@PostMapping("/batchDelete")
public boolean batchDelete(@Validated @RequestBody Request<List<String>> request) {
return deviceServiceImpl.batchDeleteDevice(request.getData());
}
@ApiOperation("设备物模型日志")
@SaCheckPermission("iot:deviceLog:query")
@PostMapping("/deviceLogs/list")
public Paging<ThingModelMessage> logs(@Validated @RequestBody PageRequest<DeviceLogQueryBo> request) {
return deviceServiceImpl.logs(request);
}
@ApiOperation("设备属性日志")
@SaCheckPermission("iot:deviceLog:query")
@PostMapping("/deviceProperty/log/list")
public List<DeviceProperty> getPropertyHistory(@Validated @RequestBody
Request<DevicePropertyLogQueryBo> query) {
@ -152,12 +167,14 @@ public class DeviceController {
}
@ApiOperation("设备解绑")
@SaCheckPermission("iot:device:edit")
@PostMapping("/unbind")
public boolean unbindDevice(@Validated @RequestBody Request<String> request) {
return deviceServiceImpl.unbindDevice(request.getData());
}
@ApiOperation("获取设备物模型")
@SaCheckPermission("iot:thingModel:query")
@PostMapping("/getThingModel")
public ThingModelVo getThingModel(@Validated @RequestBody Request<String> request) {
String deviceId = request.getData();
@ -166,12 +183,14 @@ public class DeviceController {
}
@ApiOperation("添加标签")
@SaCheckPermission("iot:device:edit")
@PostMapping("/tag/add")
public boolean addTag(@Validated @RequestBody Request<DeviceTagAddBo> bo) {
return deviceServiceImpl.addTag(bo.getData());
}
@ApiOperation("模拟设备上报")
@SaCheckPermission("iot:device:query")
@PostMapping("/simulateSend")
public boolean simulateSend(
@Validated @RequestBody Request<ThingModelMessageBo> bo) {
@ -183,6 +202,7 @@ public class DeviceController {
*
*/
@ApiOperation("消费设备信息消息(实时推送设备信息)")
@SaCheckPermission("iot:device:query")
@PostMapping("/consumer")
public DeferredResult<ThingModelMessage> consumerDeviceInfo(
@Validated @RequestBody Request<DeviceConsumerBo> bo
@ -195,6 +215,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "获取分组列表")
@SaCheckPermission("iot:deviceGroup:query")
@PostMapping("/groups/list")
public Paging<DeviceGroupVo> getDeviceGroups(
@Validated @RequestBody PageRequest<DeviceGroupBo> pageRequest) {
@ -205,6 +226,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "添加设备分组")
@SaCheckPermission("iot:deviceGroup:add")
@PostMapping("/group/add")
public boolean addGroup(@Validated @RequestBody Request<DeviceGroupBo> group) {
return deviceServiceImpl.addGroup(group.getData().to(DeviceGroup.class));
@ -214,6 +236,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "修改设备分组")
@SaCheckPermission("iot:deviceGroup:edit")
@PostMapping("/group/edit")
public boolean editGroup(@RequestBody @Validated Request<DeviceGroupBo> bo) {
return deviceServiceImpl.updateGroup(bo.getData());
@ -224,6 +247,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "删除分组")
@SaCheckPermission("iot:deviceGroup:remove")
@PostMapping("/group/delete")
public boolean deleteGroup(@Validated @RequestBody Request<String> request) {
String id = request.getData();
@ -234,6 +258,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "清空组下所有设备")
@SaCheckPermission("iot:deviceGroup:remove")
@PostMapping("/group/clear")
public boolean clearGroup(@Validated @RequestBody Request<String> request) {
String id = request.getData();
@ -244,6 +269,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "添加设备到组")
@SaCheckPermission("iot:deviceGroup:edit")
@PostMapping("/group/addDevices")
public boolean addToGroup(@Validated @RequestBody Request<DeviceAddGroupBo> bo) {
return deviceServiceImpl.addDevice2Group(bo.getData());
@ -253,6 +279,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "将设备从组中移除")
@SaCheckPermission("iot:deviceGroup:edit")
@PostMapping("/group/removeDevices")
public boolean removeDevices(@Validated @RequestBody Request<DeviceAddGroupBo> bo) {
DeviceAddGroupBo data = bo.getData();
@ -263,6 +290,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "保存设备配置")
@SaCheckPermission("iot:device:edit")
@PostMapping("/config/save")
public boolean saveConfig(@Validated @RequestBody Request<DeviceConfigAddBo> request) {
DeviceConfig data = request.getData().to(DeviceConfig.class);
@ -273,6 +301,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "获取设备配置")
@SaCheckPermission("iot:device:query")
@PostMapping("/config/get")
public DeviceConfigVo getConfig(@Validated @RequestBody Request<String> request) {
String deviceId = request.getData();
@ -283,6 +312,7 @@ public class DeviceController {
*
*/
@ApiOperation(value = "设备配置下发")
@SaCheckPermission("iot:device:ctrl")
@PostMapping("/config/send")
public InvokeResult sendConfig(@Validated @RequestBody Request<String> bo) {
String deviceId = bo.getData();

View File

@ -14,6 +14,7 @@ import cc.iotkit.model.notify.Channel;
import cc.iotkit.model.notify.ChannelConfig;
import cc.iotkit.model.notify.ChannelTemplate;
import cc.iotkit.model.notify.NotifyMessage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -41,78 +42,91 @@ public class NotifyController {
private NotifyService notifyService;
@ApiOperation("获取通道类型列表")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/getList")
public List<Channel> getChannelList() {
return notifyService.getChannelList();
}
@ApiOperation("获取通道配置分页列表")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/config/getList")
public Paging<ChannelConfigVo> getChannelConfigList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelConfigBo> request) {
return notifyService.getChannelConfigList(request);
}
@ApiOperation("获取通道配置列表")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/config/getAll")
public List<ChannelConfigVo> getChannelConfigAll() {
return notifyService.getChannelConfigAll();
}
@ApiOperation("新增通道配置")
@SaCheckPermission("iot:channel:add")
@PostMapping("/channel/config/add")
public ChannelConfig addChannelConfig(@RequestBody @Validated(EditGroup.class) Request<ChannelConfig> request) {
return notifyService.addChannelConfig(request.getData());
}
@ApiOperation("根据ID获取通道配置")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/config/getById")
public ChannelConfig getChannelConfigById(@RequestBody @Validated(QueryGroup.class) Request<Long> request) {
return notifyService.getChannelConfigById(request.getData());
}
@ApiOperation("修改通道配置")
@SaCheckPermission("iot:channel:edit")
@PostMapping("/channel/config/updateById")
public ChannelConfig updateChannelConfigById(@RequestBody @Validated Request<ChannelConfig> request) {
return notifyService.updateChannelConfigById(request.getData());
}
@ApiOperation("删除通道配置")
@SaCheckPermission("iot:channel:remove")
@PostMapping("/channel/config/delById")
public Boolean delChannelConfigById(@RequestBody @Validated Request<Long> request) {
return notifyService.delChannelConfigById(request.getData());
}
@ApiOperation("获取通道模板列表")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/template/getList")
public Paging<ChannelTemplateVo> getChannelTemplateList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelTemplateBo> request) {
return notifyService.getChannelTemplateList(request);
}
@ApiOperation("新增通道模板")
@SaCheckPermission("iot:channel:add")
@PostMapping("/channel/template/add")
public ChannelTemplate addChannelTemplate(@RequestBody @Validated(EditGroup.class) Request<ChannelTemplateBo> request) {
return notifyService.addChannelTemplate(request.getData());
}
@ApiOperation("根据ID获取通道模板")
@SaCheckPermission("iot:channel:query")
@PostMapping("/channel/template/getById")
public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request<Long> request) {
return notifyService.getChannelTemplateById(request.getData());
}
@ApiOperation("修改通道模板")
@SaCheckPermission("iot:channel:edit")
@PostMapping("/channel/template/updateById")
public ChannelTemplate updateChannelTemplateById(@RequestBody @Validated Request<ChannelTemplate> request) {
return notifyService.updateChannelTemplateById(request.getData());
}
@ApiOperation("删除通道模板")
@SaCheckPermission("iot:channel:remove")
@PostMapping("/channel/template/delById")
public Boolean delChannelTemplateById(@RequestBody @Validated(EditGroup.class) Request<Long> request) {
return notifyService.delChannelTemplateById(request.getData());
}
@ApiOperation("消息列表")
@SaCheckPermission("iot:channelMsg:query")
@PostMapping("/message/getList")
public Paging<NotifyMessage> messageList(@RequestBody @Validated(QueryGroup.class) PageRequest<NotifyMessage> request) {
return notifyService.getNotifyMessageList(request);

View File

@ -14,6 +14,7 @@ import cc.iotkit.manager.dto.vo.ota.DeviceUpgradeVo;
import cc.iotkit.manager.dto.vo.ota.OtaPackageUploadVo;
import cc.iotkit.manager.service.OtaService;
import cc.iotkit.model.ota.OtaPackage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -41,6 +42,7 @@ public class OtaController extends BaseController {
private OtaService otaService;
@ApiOperation("升级包上传")
@SaCheckPermission("iot:ota:add")
@PostMapping(value = "/package/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public OtaPackageUploadVo packageUpload(@RequestPart("file") MultipartFile file, @RequestParam("requestId") String requestId) throws Exception {
if (ObjectUtil.isNull(file)) {
@ -50,24 +52,28 @@ public class OtaController extends BaseController {
}
@ApiOperation("新增升级包")
@SaCheckPermission("iot:ota:add")
@PostMapping("/package/add")
public OtaPackage packageAdd(@RequestBody @Valid Request<OtaPackageBo> request) {
return otaService.addOtaPackage(request.getData());
}
@ApiOperation("删除升级包")
@SaCheckPermission("iot:ota:remove")
@PostMapping("/package/delById")
public Boolean delPackageById(@RequestBody @Valid Request<Long> request) {
return otaService.delOtaPackageById(request.getData());
}
@ApiOperation("升级包列表")
@SaCheckPermission("iot:ota:query")
@PostMapping("/package/getList")
public Paging<OtaPackage> packageList(@RequestBody @Validated PageRequest<OtaPackage> request) {
return otaService.getOtaPackagePageList(request);
}
@ApiOperation("OTA升级")
@SaCheckPermission("iot:ota:upgrade")
@PostMapping("/device/upgrade")
public DeviceUpgradeVo deviceUpgrade(@RequestBody Request<DeviceUpgradeBo> request) {
String result = otaService.startUpgrade(request.getData().getOtaId(), request.getData().getDeviceIds());
@ -75,12 +81,14 @@ public class OtaController extends BaseController {
}
@ApiOperation("设备升级结果查询")
@SaCheckPermission("iot:ota:query")
@PostMapping("/device/detail")
public Paging<DeviceOtaDetailVo> otaDeviceDetail(@RequestBody PageRequest<DeviceOtaDetailBo> request) {
return otaService.otaDeviceDetail(request);
}
@ApiOperation("设备升级批次查询")
@SaCheckPermission("iot:ota:query")
@PostMapping("/device/info")
public Paging<DeviceOtaInfoVo> otaDeviceInfo(@RequestBody PageRequest<DeviceOtaInfoBo> request) {
return otaService.otaDeviceInfo(request);

View File

@ -25,6 +25,7 @@ import cc.iotkit.manager.dto.vo.product.ProductVo;
import cc.iotkit.manager.dto.vo.productmodel.ProductModelVo;
import cc.iotkit.manager.dto.vo.thingmodel.ThingModelVo;
import cc.iotkit.manager.service.IProductService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
@ -47,14 +48,16 @@ public class ProductController {
@Autowired
private IProductService productService;
@PostMapping("/list")
@ApiOperation("列表")
@SaCheckPermission("iot:product:query")
@PostMapping("/list")
public Paging<ProductVo> getProducts(@Validated @RequestBody
PageRequest<ProductBo> request) {
return productService.selectPageList(request);
}
@ApiOperation("新建")
@SaCheckPermission("iot:product:add")
@PostMapping(value = "/add")
@Log(title = "产品", businessType = BusinessType.INSERT)
public ProductVo create(@Validated(AddGroup.class) @RequestBody Request<ProductBo> request) {
@ -62,95 +65,107 @@ public class ProductController {
}
@ApiOperation(value = "编辑产品")
@SaCheckPermission("iot:product:edit")
@PostMapping("/edit")
@Log(title = "产品", businessType = BusinessType.UPDATE)
public boolean edit(@Validated(EditGroup.class) @RequestBody Request<ProductBo> request) {
return productService.updateEntity(request.getData());
}
@ApiOperation("查看详情")
@SaCheckPermission("iot:product:query")
@PostMapping(value = "/getDetail")
public ProductVo getDetail(@RequestBody @Validated Request<String> request) {
return productService.getDetail(request.getData());
}
@ApiOperation("删除产品")
@SaCheckPermission("iot:product:remove")
@PostMapping(value = "/deleteProduct")
public boolean deleteProduct(@RequestBody @Validated Request<String> request) {
return productService.deleteProduct(request.getData());
}
@PostMapping("/getThingModelByProductKey")
@ApiOperation("查看物模型")
@SaCheckPermission("iot:thingModel:query")
@PostMapping("/getThingModelByProductKey")
public ThingModelVo getThingModelByProductKey(@RequestBody @Validated Request<String> request) {
return productService.getThingModelByProductKey(request.getData());
}
@ApiOperation("保存物模型")
@SaCheckPermission("iot:thingModel:edit")
@PostMapping("/thingModel/save")
public boolean saveThingModel(@Validated @RequestBody Request<ThingModelBo> request) {
return productService.saveThingModel(request.getData());
}
@PostMapping("/thingModel/delete")
@ApiOperation("删除物模型")
@SaCheckPermission("iot:thingModel:remove")
@PostMapping("/thingModel/delete")
@Log(title = "物模型", businessType = BusinessType.DELETE)
public boolean deleteThingModel(@Validated @RequestBody Request<Long> id) {
return productService.deleteThingModel(id.getData());
}
@PostMapping("/category/list")
@ApiOperation("产品品类分页展示")
@SaCheckPermission("iot:category:query")
@PostMapping("/category/list")
public Paging<CategoryVo> getCategories(@Validated @RequestBody PageRequest<CategoryBo> request) {
return productService.selectCategoryPageList(request);
}
@PostMapping("/category/getAll")
@ApiOperation("产品品类展示")
@SaCheckPermission("iot:category:query")
@PostMapping("/category/getAll")
public List<CategoryVo> getCategorieList() {
return productService.selectCategoryList();
}
@SaCheckRole("iot_admin")
@ApiOperation("品类编辑")
@SaCheckRole("iot_admin")
@SaCheckPermission("iot:category:edit")
@PostMapping("/category/edit")
public boolean saveCategory(@Validated @RequestBody Request<CategoryBo> req) {
return productService.editCategory(req.getData());
}
@SaCheckRole("iot_admin")
@PostMapping("/category/delete")
@ApiOperation("删除品类")
@SaCheckRole("iot_admin")
@SaCheckPermission("iot:category:remove")
@PostMapping("/category/delete")
public boolean delCategory(@Validated @RequestBody Request<String> req) {
return productService.deleteCategory(req.getData());
}
@ApiOperation("上传产品图片")
@SaCheckPermission("iot:product:edit")
@PostMapping("/uploadImg/{productKey}")
public String uploadImg(@PathVariable("productKey") String productKey,
@RequestParam("file") MultipartFile file) {
return productService.uploadImg(productKey, file);
}
@PostMapping("/getModelsByProductKey")
@ApiModelProperty("获取产品型号")
@SaCheckPermission("iot:product:query")
@PostMapping("/getModelsByProductKey")
public List<ProductModelVo> getModels(@Validated @RequestBody Request<String> bo) {
return productService.getModels(bo.getData());
}
@PostMapping("/productModel/edit")
@ApiOperation("编辑产品型号")
@SaCheckPermission("iot:product:edit")
@PostMapping("/productModel/edit")
public boolean saveProductModel(@Validated @RequestBody Request<ProductModelBo> bo) {
return productService.editProductModel(bo.getData());
}
@PostMapping("/productModel/delete")
@ApiOperation("删除产品型号")
@SaCheckPermission("iot:product:remove")
@PostMapping("/productModel/delete")
public boolean deleteProductModel(@Validated @RequestBody Request<String> id) {
return productService.deleteProductModel(id.getData());
}

View File

@ -20,6 +20,7 @@ import cc.iotkit.manager.dto.bo.protocolconverter.ProtocolConverterBo;
import cc.iotkit.manager.dto.vo.protocolcomponent.ProtocolComponentVo;
import cc.iotkit.manager.dto.vo.protocolconverter.ProtocolConverterVo;
import cc.iotkit.manager.service.IProtocolService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,6 +37,7 @@ public class ProtocolController {
private IProtocolService protocolService;
@ApiOperation("上传Jar包")
@SaCheckPermission("iot:component:add")
@PostMapping("/uploadJar")
public String uploadJar(
@RequestParam("id") String id,
@ -44,12 +46,14 @@ public class ProtocolController {
}
@ApiOperation("添加组件")
@SaCheckPermission("iot:component:add")
@PostMapping("/addComponent")
public boolean addComponent(@RequestBody @Validated Request<ProtocolComponentBo> bo) {
return protocolService.addComponent(bo.getData());
}
@ApiOperation("修改组件")
@SaCheckPermission("iot:component:edit")
@PostMapping("/editComponent")
public boolean saveComponent(@RequestBody @Validated Request<ProtocolComponentBo> bo) {
protocolService.saveComponent(bo.getData());
@ -57,6 +61,7 @@ public class ProtocolController {
}
@ApiOperation("获取组件详情")
@SaCheckPermission("iot:component:query")
@PostMapping("/getComponentDetail")
public ProtocolComponentVo getComponentScript(@Validated @RequestBody Request<String> req) {
String id = req.getData();
@ -65,6 +70,7 @@ public class ProtocolController {
}
@ApiOperation("保存组件脚本")
@SaCheckPermission("iot:component:edit")
@PostMapping("/saveComponentScript")
public boolean saveComponentScript(@Validated
@RequestBody Request<ProtocolComponentBo> upReq) {
@ -73,12 +79,14 @@ public class ProtocolController {
@ApiOperation("删除组件")
@SaCheckPermission("iot:component:remove")
@PostMapping("/delete")
public boolean deleteComponent(@Validated @RequestBody Request<String> req) {
return protocolService.deleteComponent(req.getData());
}
@ApiOperation("获取组件列表")
@SaCheckPermission("iot:component:query")
@PostMapping("/list")
public Paging<ProtocolComponentVo> getComponents(@Validated @RequestBody
PageRequest<ProtocolComponentBo> query) {
@ -86,24 +94,28 @@ public class ProtocolController {
}
@ApiOperation("获取转换脚本列表")
@SaCheckPermission("iot:converter:query")
@PostMapping("/converters/list")
public Paging<ProtocolConverterVo> getConverters(@Validated @RequestBody PageRequest<ProtocolConverterBo> query) {
return protocolService.selectConvertersPageList(query);
}
@ApiOperation("新增转换脚本")
@SaCheckPermission("iot:converter:add")
@PostMapping("/converter/add")
public boolean addConverter(@Validated(AddGroup.class) @RequestBody Request<ProtocolConverterBo> converter) {
return protocolService.addConverter(converter.getData());
}
@ApiOperation("修改转换脚本")
@SaCheckPermission("iot:converter:edit")
@PostMapping("/converter/edit")
public boolean editConverter(@Validated(EditGroup.class) @RequestBody Request<ProtocolConverterBo> req) {
return protocolService.editConverter(req.getData());
}
@ApiOperation("获取转换脚本详情")
@SaCheckPermission("iot:converter:query")
@PostMapping("/getConverterScript")
public ProtocolConverterVo getConverter(@RequestBody Request<String> req) {
String id = req.getData();
@ -111,6 +123,7 @@ public class ProtocolController {
}
@PostMapping("/converterScript/edit")
@SaCheckPermission("iot:converter:edit")
@ApiOperation("保存转换脚本")
public boolean saveConverterScript(
@Validated @RequestBody Request<ProtocolConverterBo> req) {
@ -119,6 +132,7 @@ public class ProtocolController {
}
@PostMapping("/converter/delete")
@SaCheckPermission("iot:converter:remove")
@ApiOperation("删除转换脚本")
public boolean deleteConverter(@RequestBody @Validated Request<String> req) {
String id = req.getData();
@ -126,6 +140,7 @@ public class ProtocolController {
}
@PostMapping("/component/changeState")
@SaCheckPermission("iot:component:edit")
@ApiOperation("组件启用/禁用")
public boolean changeComponentState(@RequestBody @Validated Request<ChangeStateBo> req) {
return protocolService.changeComponentState(req.getData());

View File

@ -21,6 +21,7 @@ import cc.iotkit.manager.dto.vo.ruleinfo.RuleLogVo;
import cc.iotkit.manager.dto.vo.taskinfo.TaskInfoVo;
import cc.iotkit.manager.dto.vo.taskinfo.TaskLogVo;
import cc.iotkit.manager.service.IRuleEngineService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -41,6 +42,7 @@ public class RuleEngineController {
IRuleEngineService ruleEngineService;
@ApiOperation("规则列表")
@SaCheckPermission("iot:rule:query")
@PostMapping("/list")
public Paging<RuleInfoVo> rules(
@Validated @RequestBody
@ -50,12 +52,14 @@ public class RuleEngineController {
}
@ApiOperation("保存规则")
@SaCheckPermission("iot:rule:eidt")
@PostMapping("/edit")
public boolean saveRule(@RequestBody @Validated Request<RuleInfoBo> ruleInfoBo) {
return ruleEngineService.saveRule(ruleInfoBo.getData());
}
@ApiOperation("暂停规则")
@SaCheckPermission("iot:rule:edit")
@PostMapping("/pause")
public boolean pauseRule(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
@ -63,6 +67,7 @@ public class RuleEngineController {
}
@ApiOperation("恢复规则")
@SaCheckPermission("iot:rule:edit")
@PostMapping("/resume")
public boolean resumeRule(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
@ -71,6 +76,7 @@ public class RuleEngineController {
}
@ApiOperation("删除规则")
@SaCheckPermission("iot:rule:remove")
@PostMapping("/delete")
public boolean deleteRule(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
@ -78,6 +84,7 @@ public class RuleEngineController {
}
@ApiOperation("规则日志")
@SaCheckPermission("iot:rule:query")
@PostMapping("/ruleLog/list")
public Paging<RuleLogVo> getRuleLogs(
@Validated @RequestBody PageRequest<RuleLogBo> request
@ -86,6 +93,7 @@ public class RuleEngineController {
}
@ApiOperation("清理日志")
@SaCheckPermission("iot:rule:remove")
@PostMapping("/ruleLog/clear")
public boolean clearRuleLogs(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
@ -94,18 +102,21 @@ public class RuleEngineController {
}
@ApiOperation("定时任务列表")
@SaCheckPermission("iot:task:query")
@PostMapping("/tasks/list")
public Paging<TaskInfoVo> tasks(@Validated @RequestBody PageRequest<TaskInfoBo> request) {
return ruleEngineService.selectTaskPageList(request);
}
@ApiOperation("保存定时任务")
@SaCheckPermission("iot:task:edit")
@PostMapping("/task/save")
public boolean saveTask(@Validated @RequestBody Request<TaskInfoBo> taskInfo) {
return ruleEngineService.saveTask(taskInfo.getData());
}
@ApiOperation("停止定时任务")
@SaCheckPermission("iot:task:edit")
@PostMapping("/task/pause")
public boolean pauseTask(@Validated @RequestBody Request<String> request) {
String taskId = request.getData();
@ -113,12 +124,14 @@ public class RuleEngineController {
}
@ApiOperation("恢复定时任务")
@SaCheckPermission("iot:task:edit")
@PostMapping("/task/resume")
public boolean resumeTask(@Validated @RequestBody Request<String> request) {
return ruleEngineService.resumeTask(request.getData());
}
@ApiOperation("更新定时任务")
@SaCheckPermission("iot:task:edit")
@PostMapping("/task/renew")
public boolean renewTask(@Validated @RequestBody Request<String> request) {
String taskId = request.getData();
@ -127,6 +140,7 @@ public class RuleEngineController {
}
@ApiOperation("删除定时任务")
@SaCheckPermission("iot:task:remove")
@PostMapping("/task/delete")
public boolean deleteTask(@Validated @RequestBody Request<String> request) {
String taskId = request.getData();
@ -135,6 +149,7 @@ public class RuleEngineController {
}
@ApiOperation("定时任务日志list")
@SaCheckPermission("iot:task:query")
@PostMapping("/taskLogs/list")
public Paging<TaskLogVo> getTaskLogs(
@Validated @RequestBody PageRequest<TaskLogBo> request
@ -143,6 +158,7 @@ public class RuleEngineController {
}
@ApiOperation("清除定时任务日志")
@SaCheckPermission("iot:task:remove")
@PostMapping("/taskLogs/clear")
public boolean clearTaskLogs(@Validated @RequestBody Request<String> request) {
return ruleEngineService.clearTaskLogs(request.getData());

View File

@ -10,6 +10,7 @@ import cc.iotkit.manager.dto.bo.screen.PublishChangeBo;
import cc.iotkit.manager.service.IScreenService;
import cc.iotkit.model.screen.Screen;
import cc.iotkit.model.screen.ScreenApi;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -35,12 +36,14 @@ public class ScreenController {
private IScreenService screenService;
@ApiOperation(value = "获取大屏列表", httpMethod = "POST")
@SaCheckPermission("iot:screen:list")
@PostMapping("/getScreens")
public Paging<Screen> getBigScreens(@Validated @RequestBody PageRequest<Screen> request) {
return screenService.getBigScreens(request);
}
@ApiOperation(value = "上传大屏资源包")
@SaCheckPermission("iot:screen:add")
@PostMapping("/uploadResourceFile")
public Long uploadResourceFile(@RequestParam("file") MultipartFile file,
@RequestBody @Validated Request<Long> id){
@ -52,6 +55,7 @@ public class ScreenController {
}
@ApiOperation(value = "获取大屏接口")
@SaCheckPermission("iot:screen:list")
@PostMapping("/getScreenApis")
public List<ScreenApi> getScreenApis(@RequestBody @Validated Request<Long> id) {
if (ObjectUtil.isEmpty(id.getData())) {
@ -61,12 +65,14 @@ public class ScreenController {
}
@ApiOperation(value = "获取默认大屏")
@SaCheckPermission("iot:screen:query")
@PostMapping("/getDefaultScreen")
public Screen getDefaultScreen() {
return screenService.getDefaultScreen();
}
@ApiOperation(value = "同步资源包接口")
@SaCheckPermission("iot:screen:query")
@PostMapping("/syncResourceApis")
public List<ScreenApi> syncResourceApis(@RequestBody @Validated Request<Long> id) {
if (ObjectUtil.isEmpty(id.getData())) {
@ -76,6 +82,7 @@ public class ScreenController {
}
@ApiOperation(value = "预览接口")
@SaCheckPermission("iot:screen:query")
@PostMapping("/previewApis")
public void previewApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) {
if (ObjectUtil.isNull(screenApis.getData()) || screenApis.getData().isEmpty()) {
@ -85,6 +92,7 @@ public class ScreenController {
}
@ApiOperation(value = "保存大屏接口")
@SaCheckPermission("iot:screen:edit")
@PostMapping("/saveScreenApis")
public void saveScreenApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) {
if (ObjectUtil.isNull(screenApis.getData()) || screenApis.getData().isEmpty()) {
@ -94,30 +102,35 @@ public class ScreenController {
}
@ApiOperation(value = "调试模式转换")
@SaCheckPermission("iot:screen:edit")
@PostMapping("/debugModeChange")
public void debugMode(@RequestBody @Validated Request<DebugChangeBo> debugChange) {
screenService.debugModeChange(debugChange.getData());
}
@ApiOperation(value = "添加大屏")
@SaCheckPermission("iot:screen:add")
@PostMapping("/addScreen")
public void addScreen(@RequestBody @Validated Request<Screen> screen) {
screenService.addBigScreen(screen.getData());
}
@ApiOperation(value = "保存大屏")
@SaCheckPermission("iot:screen:edit")
@PostMapping("/saveScreen")
public void saveScreen(@RequestBody @Validated Request<Screen> screen) {
screenService.saveBigScreen(screen.getData());
}
@ApiOperation(value = "发布状态改变")
@SaCheckPermission("iot:screen:edit")
@PostMapping("/publishStatusChange")
public void publishStatusChange(@RequestBody @Validated Request<PublishChangeBo> req) {
screenService.publishStatusChange(req.getData());
}
@ApiOperation(value = "设置默认大屏")
@SaCheckPermission("iot:screen:edit")
@PostMapping("/setDefaultScreen")
public void setDefaultScreen(@RequestBody @Validated Request<Long> id) {
if (ObjectUtil.isEmpty(id.getData())) {
@ -127,6 +140,7 @@ public class ScreenController {
}
@ApiOperation(value = "删除大屏", httpMethod = "POST")
@SaCheckPermission("iot:screen:remove")
@PostMapping("/deleteScreen")
public void deleteScreen(@RequestBody @Validated Request<Long> id) {
if (ObjectUtil.isEmpty(id.getData())) {

View File

@ -25,6 +25,7 @@ import cc.iotkit.model.device.VirtualDevice;
import cc.iotkit.model.device.VirtualDeviceLog;
import cc.iotkit.temporal.IVirtualDeviceLogData;
import cc.iotkit.virtualdevice.VirtualManager;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -53,6 +54,7 @@ public class VirtualDeviceController {
private IVirtualDeviceLogData virtualDeviceLogData;
@ApiOperation("获取虚拟设备列表")
@SaCheckPermission("iot:virtualDevice:query")
@PostMapping("/list")
public Paging<VirtualDevice> getDevices(PageRequest<VirtualDevice> pageRequest) {
return virtualDeviceData.findAll(pageRequest);
@ -62,6 +64,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("添加虚拟设备")
@SaCheckPermission("iot:virtualDevice:add")
@PostMapping("/add")
public void add(@Validated @RequestBody VirtualDevice virtualDevice) {
virtualDeviceData.save(virtualDevice);
@ -71,6 +74,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("修改虚拟设备")
@SaCheckPermission("iot:virtualDevice:edit")
@PostMapping("/modify")
public void modify(@Validated @RequestBody Request<VirtualDevice> bo) {
VirtualDevice virtualDevice = bo.getData();
@ -85,6 +89,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("获取虚拟设备详情")
@SaCheckPermission("iot:virtualDevice:query")
@PostMapping("/getDetail")
public VirtualDevice detail(@Validated @RequestBody Request<String> bo) {
return checkOwner(bo.getData());
@ -94,6 +99,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("设置虚拟设备状态")
@SaCheckPermission("iot:virtualDevice:edit")
@PostMapping("/setState")
public void setState(@Validated @RequestBody Request<ChangeStateBo> bo) {
ChangeStateBo data = bo.getData();
@ -117,6 +123,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("删除虚拟设备")
@SaCheckPermission("iot:virtualDevice:remove")
@PostMapping("/delete")
public void delete(@Validated @RequestBody Request<String> bo) {
String id = bo.getData();
@ -128,6 +135,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("批量删除虚拟设备")
@SaCheckPermission("iot:virtualDevice:remove")
@PostMapping("/batchDelete")
public void batchDelete(@Validated @RequestBody Request<List<String>> ids) {
virtualDeviceData.deleteByIds(ids.getData());
@ -137,6 +145,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("保存脚本")
@SaCheckPermission("iot:virtualDevice:edit")
@PostMapping("/saveScript")
public void saveScript(@Validated @RequestBody Request<DeviceSaveScriptBo> bo) {
DeviceSaveScriptBo data = bo.getData();
@ -151,6 +160,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("保存关联设备")
@SaCheckPermission("iot:virtualDevice:edit")
@PostMapping("/saveDevices")
public void saveDevices(@Validated @RequestBody Request<VirtualSaveDevicesBo> bo) {
VirtualSaveDevicesBo data = bo.getData();
@ -165,6 +175,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("手动执行虚拟设备")
@SaCheckPermission("iot:virtualDevice:query")
@PostMapping("/run")
public void run(@Validated @RequestBody Request<String> bo) {
String id = bo.getData();
@ -176,6 +187,7 @@ public class VirtualDeviceController {
*
*/
@ApiOperation("取虚拟设备执行日志")
@SaCheckPermission("iot:virtualDevice:query")
@PostMapping("/logs/list")
public Paging<VirtualDeviceLog> getLogs(
@Validated @RequestBody PageRequest<DeviceLogQueryBo> bo) {