fix:app接口优化

V0.5.x
tangfudong 2024-04-17 17:49:13 +08:00
parent 01354d2369
commit 11ad6bdbaa
2 changed files with 5 additions and 66 deletions

View File

@ -109,6 +109,7 @@ public class ThingModel extends TenantModel implements Id<Long>, Serializable {
switch (type) { switch (type) {
case "bool": case "bool":
case "enum": case "enum":
return val;
case "int": case "int":
return Integer.parseInt(val); return Integer.parseInt(val);
default: default:

View File

@ -23,16 +23,14 @@ import cc.iotkit.data.manager.ICategoryData;
import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IDeviceInfoData;
import cc.iotkit.data.manager.IUserInfoData; import cc.iotkit.data.manager.IUserInfoData;
import cc.iotkit.manager.dto.bo.device.DeviceLogQueryBo; import cc.iotkit.manager.dto.bo.device.DeviceLogQueryBo;
import cc.iotkit.manager.dto.bo.device.ServiceInvokeBo;
import cc.iotkit.manager.dto.bo.device.SetDeviceServicePorpertyBo;
import cc.iotkit.manager.dto.bo.ruleinfo.RuleInfoBo;
import cc.iotkit.manager.dto.vo.product.ProductVo; import cc.iotkit.manager.dto.vo.product.ProductVo;
import cc.iotkit.manager.dto.vo.ruleinfo.RuleInfoVo;
import cc.iotkit.manager.dto.vo.thingmodel.ThingModelVo; import cc.iotkit.manager.dto.vo.thingmodel.ThingModelVo;
import cc.iotkit.manager.model.vo.FindDeviceVo; import cc.iotkit.manager.model.vo.FindDeviceVo;
import cc.iotkit.manager.model.vo.SpaceDeviceVo; import cc.iotkit.manager.model.vo.SpaceDeviceVo;
import cc.iotkit.manager.service.*; import cc.iotkit.manager.service.IHomeService;
import cc.iotkit.model.InvokeResult; import cc.iotkit.manager.service.IProductService;
import cc.iotkit.manager.service.ISpaceDeviceService;
import cc.iotkit.manager.service.ISpaceService;
import cc.iotkit.model.UserInfo; import cc.iotkit.model.UserInfo;
import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Category;
@ -74,16 +72,7 @@ public class SpaceDeviceController {
@Autowired @Autowired
private IHomeService homeService; private IHomeService homeService;
@Autowired @Autowired
private DataOwnerService dataOwnerService;
@Autowired
private IRuleEngineService ruleEngineService;
@Autowired
private IUserInfoData userInfoData; private IUserInfoData userInfoData;
@Autowired
private IDeviceManagerService deviceServiceImpl;
//赋予应用端设备的服务和属性设置,关于应用的接口及相关权限设计后续完善,先打通链路
@Autowired
private DeviceCtrlService deviceCtrlService;
/** /**
* 使 * 使
@ -244,57 +233,6 @@ public class SpaceDeviceController {
return findDeviceVo; return findDeviceVo;
} }
@ApiOperation("获取设备详情")
@PostMapping("/detail")
public DeviceInfo getDetail(@RequestBody @Validated Request<String> request) {
return deviceServiceImpl.getDetail(request.getData());
}
@ApiOperation("保存规则")
@PostMapping("/saveRuleEngine")
public boolean saveRuleEngine(@RequestBody @Validated Request<RuleInfoBo> ruleInfoBo) {
return ruleEngineService.saveRule(ruleInfoBo.getData());
}
@ApiOperation("删除规则")
@PostMapping("/delRuleEngine")
public boolean delRuleEngine(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
return ruleEngineService.deleteRule(ruleId);
}
@ApiOperation("停止规则")
@PostMapping("/stopRuleEngine")
public boolean stopRuleEngine(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
return ruleEngineService.pauseRule(ruleId);
}
@ApiOperation("恢复规则")
@PostMapping("/startRuleEngine")
public boolean startRuleEngine(@Validated @RequestBody Request<String> request) {
String ruleId = request.getData();
return ruleEngineService.resumeRule(ruleId);
}
@ApiOperation("规则列表")
@PostMapping("/ruleEngineList")
public Paging<RuleInfoVo> ruleEngineList(@Validated @RequestBody PageRequest<RuleInfoBo> request) {
return ruleEngineService.selectPageList(request);
}
@ApiOperation("调用设备服务")
@PostMapping("/invokeService")
public InvokeResult invokeService(@RequestBody @Validated Request<ServiceInvokeBo> request) {
return new InvokeResult(deviceCtrlService.invokeService(request.getData().getDeviceId(), request.getData().getService(), request.getData().getArgs()));
}
@ApiOperation(value = "设备属性设置")
@PostMapping("/setProperty")
public InvokeResult setProperty(@RequestBody @Validated Request<SetDeviceServicePorpertyBo> request) {
return new InvokeResult(deviceCtrlService.setProperty(request.getData().getDeviceId(), request.getData().getArgs()));
}
/** /**
* REMOVE_DEVICE * REMOVE_DEVICE
* *