|
@@ -2,6 +2,7 @@ package com.xy.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.xy.dto.DeviceStatusDto;
|
|
|
import com.xy.dto.DeviceSysinfoDto;
|
|
|
import com.xy.entity.DeviceSysinfo;
|
|
|
import com.xy.mapper.DeviceSysinfoMapper;
|
|
@@ -10,7 +11,9 @@ import com.xy.utils.MybatisPlusQuery;
|
|
|
import com.xy.utils.R;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -30,8 +33,11 @@ import static com.xy.utils.Beans.copy;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@Api(tags = "设备-系统信息")
|
|
|
+@AllArgsConstructor(onConstructor_ = @Lazy)
|
|
|
public class DeviceSysinfoServiceImpl extends ServiceImpl<DeviceSysinfoMapper, DeviceSysinfo> implements DeviceSysinfoService {
|
|
|
|
|
|
+ private DeviceStatusServiceImpl deviceStatusService;
|
|
|
+
|
|
|
@PostMapping("obj")
|
|
|
@ApiOperation("对象查询")
|
|
|
public R<DeviceSysinfoDto.Vo> get(@RequestBody DeviceSysinfoDto.Vo vo) {
|
|
@@ -58,11 +64,11 @@ public class DeviceSysinfoServiceImpl extends ServiceImpl<DeviceSysinfoMapper, D
|
|
|
@ApiOperation("上报信息")
|
|
|
public R up(@RequestBody DeviceSysinfoDto.Up up) {
|
|
|
log.info("设备系统信息上报:{}", up.toString());
|
|
|
- DeviceSysinfo deviceSysinfo = getById(up.getDeviceId());
|
|
|
- if (deviceSysinfo == null) {
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
updateById(copy(DeviceSysinfo.class, up));
|
|
|
+ DeviceStatusDto.Up upStatus = new DeviceStatusDto.Up()
|
|
|
+ .setDeviceId(up.getDeviceId());
|
|
|
+ upStatus.setIsUpVersion(true);
|
|
|
+ deviceStatusService.up(upStatus);
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|