|
@@ -1,11 +1,29 @@
|
|
|
package com.xy.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.xy.config.ThreadPoolConfig;
|
|
|
+import com.xy.dto.DeviceInfoDto;
|
|
|
+import com.xy.dto.DeviceRegisterDto;
|
|
|
+import com.xy.dto.DeviceStatusDto;
|
|
|
+import com.xy.dto.DeviceSysinfoDto;
|
|
|
import com.xy.entity.DeviceInfo;
|
|
|
import com.xy.mapper.DeviceInfoMapper;
|
|
|
import com.xy.service.DeviceInfoService;
|
|
|
+import com.xy.utils.Emptys;
|
|
|
+import com.xy.utils.MybatisPlusQuery;
|
|
|
+import com.xy.utils.R;
|
|
|
+import com.xy.utils.ThreadPoolUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.SneakyThrows;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.xy.utils.PlusBeans.copy;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 设备-信息 服务实现类
|
|
@@ -15,6 +33,44 @@ import org.springframework.stereotype.Service;
|
|
|
* @since 2022-12-23
|
|
|
*/
|
|
|
@Service
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Api(tags = "设备-信息")
|
|
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
|
|
|
|
|
|
+ private final DeviceSysinfoServiceImpl deviceSysinfoService;
|
|
|
+
|
|
|
+ private final DeviceStatusServiceImpl deviceStatusService;
|
|
|
+
|
|
|
+ private final DeviceRegisterServiceImpl deviceRegisterService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @SneakyThrows
|
|
|
+ @ApiOperation("对象查询")
|
|
|
+ public R<DeviceInfoDto.Vo> obj(DeviceInfoDto.Obj obj) {
|
|
|
+ //设备信息
|
|
|
+ LambdaQueryWrapper<DeviceInfo> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(obj, DeviceInfo.class).build();
|
|
|
+ List<DeviceInfo> list = list(lambdaQueryWrapper);
|
|
|
+ if (!Emptys.check(list)) {
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ DeviceInfoDto.Vo deviceInfo = copy(DeviceInfoDto.Vo.class, list.get(0));
|
|
|
+ ThreadPoolUtils.excPoll(ThreadPoolConfig.COMMON_POLL, 3)
|
|
|
+ .execute(() -> {
|
|
|
+ //系统信息
|
|
|
+ DeviceSysinfoDto.Vo deviceSysinfo = deviceSysinfoService.get(new DeviceSysinfoDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
+ deviceInfo.setDeviceSysinfo(Emptys.check(deviceSysinfo) ? deviceSysinfo : null);
|
|
|
+ })
|
|
|
+ .execute(() -> {
|
|
|
+ //状态信息
|
|
|
+ DeviceStatusDto.Vo deviceStatus = deviceStatusService.obj(new DeviceStatusDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
+ deviceInfo.setDeviceStatus(Emptys.check(deviceStatus) ? deviceStatus : null);
|
|
|
+ })
|
|
|
+ .execute(() -> {
|
|
|
+ //注册信息
|
|
|
+ DeviceRegisterDto.Vo deviceRegister = deviceRegisterService.obj(new DeviceRegisterDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
+ deviceInfo.setDeviceRegister(Emptys.check(deviceRegister) ? deviceRegister : null);
|
|
|
+ })
|
|
|
+ .end();
|
|
|
+ return R.ok(deviceInfo);
|
|
|
+ }
|
|
|
}
|