Commit dc592b26 by huangjy

fix:小程序设备编辑

parent dcaef69a
......@@ -55,6 +55,12 @@ public class PlatDeviceWechatController {
return ApiResponseUtils.success(platDeviceService.view(baseIdDTO.getId()));
}
@ApiOperation("详情通过iot设备id")
@PostMapping("viewByDeviceId")
public ApiResponseEntity<PlatDeviceViewVO> viewByDeviceId(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platDeviceService.viewByDeviceId(baseIdDTO.getId()));
}
@ApiOperation("配网")
@PostMapping("setUp")
public ApiResponseEntity<?> setup(@Validated @RequestBody PlatDeviceSetupDTO dto) {
......
......@@ -68,4 +68,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
Page<PlatDeviceListVO> getDevices(PlatDataScreenQueryDTO dto, Page<PlatDevice> p);
void savePlatDevice();
PlatDeviceViewVO viewByDeviceId(String id);
}
......@@ -216,6 +216,27 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
}
@Override
public PlatDeviceViewVO viewByDeviceId(String id) {
PlatDevice platDevice = getOne(new QueryWrapper<PlatDevice>().lambda().eq(PlatDevice::getOriDeviceId, id)
.last("limit 1"));
if (platDevice == null) {
return new PlatDeviceViewVO();
}
PlatDeviceViewVO vo = BeanDtoVoUtils.convert(platDevice, PlatDeviceViewVO.class);
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, platDevice.getId()));
if (other != null) {
BeanUtils.copyProperties(other, vo);
}
vo.setId(platDevice.getId());
return vo;
}
@Override
public void setup(PlatDeviceSetupDTO dto) {
log.info("设备配网请求参数:{}",JSON.toJSONString(dto));
PlatDevice db = getOne(new QueryWrapper<PlatDevice>().lambda()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment