|
@@ -1,16 +1,27 @@
|
|
|
package org.jeecg.modules.devicePoint.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.device.entity.DeviceGatherService;
|
|
|
+import org.jeecg.modules.device.service.IDeviceGatherServiceService;
|
|
|
import org.jeecg.modules.devicePoint.entity.DevicePoint;
|
|
|
import org.jeecg.modules.devicePoint.entity.EditBatchParam;
|
|
|
+import org.jeecg.modules.devicePoint.entity.EditDevicePointBatchParam;
|
|
|
import org.jeecg.modules.devicePoint.mapper.DevicePointMapper;
|
|
|
import org.jeecg.modules.devicePoint.service.IDevicePointService;
|
|
|
+import org.jeecg.modules.gatherData.entity.FpgGatherData;
|
|
|
+import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 设备采集点
|
|
|
* @Author: jeecg-boot
|
|
@@ -20,6 +31,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@Service
|
|
|
public class DevicePointServiceImpl extends ServiceImpl<DevicePointMapper, DevicePoint> implements IDevicePointService {
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IDeviceGatherServiceService deviceGatherServiceService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void editBatch(EditBatchParam editBatchParam) {
|
|
|
baseMapper.delete(new LambdaQueryWrapper<DevicePoint>().eq(DevicePoint::getDeviceId,editBatchParam.getDeviceId()));
|
|
@@ -30,4 +47,44 @@ public class DevicePointServiceImpl extends ServiceImpl<DevicePointMapper, Devic
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DevicePoint> queryListByType(String deviceGather) {
|
|
|
+ List<DevicePoint> devicePointList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<DeviceGatherService> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(DeviceGatherService::getDeviceGather, deviceGather);
|
|
|
+ List<DeviceGatherService> deviceGatherServiceList = deviceGatherServiceService.list(queryWrapper);
|
|
|
+ if (!oConvertUtils.listIsNotEmpty(deviceGatherServiceList)){
|
|
|
+ return devicePointList;
|
|
|
+ }
|
|
|
+ List<String> ids = deviceGatherServiceList.stream().map(DeviceGatherService::getId).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<DevicePoint> query = new LambdaQueryWrapper<>();
|
|
|
+ query.in(DevicePoint::getGatherServiceId, ids);
|
|
|
+ devicePointList = baseMapper.selectList(query);
|
|
|
+ return devicePointList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void editDevicePointBatch(EditDevicePointBatchParam editDevicePointBatchParam) {
|
|
|
+ if (oConvertUtils.listIsNotEmpty(editDevicePointBatchParam.getDeleteDevicePoints())){
|
|
|
+ List<DevicePoint> deleteDevicePointList = new ArrayList<>();
|
|
|
+ deleteDevicePointList.forEach(x ->{
|
|
|
+ x.setDeviceId(null);
|
|
|
+ baseMapper.updateById(x);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<DevicePoint> saveOrUpdateDevicePointList = editDevicePointBatchParam.getDevicePoints();
|
|
|
+ if (oConvertUtils.listIsNotEmpty(saveOrUpdateDevicePointList)){
|
|
|
+ List<String> ids = saveOrUpdateDevicePointList.stream().map(DevicePoint::getId).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<DevicePoint> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(DevicePoint::getId, ids);
|
|
|
+ List<DevicePoint> listDevicePoint = baseMapper.selectList(queryWrapper);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(listDevicePoint)){
|
|
|
+ listDevicePoint.forEach(y ->{
|
|
|
+ y.setDeviceId(editDevicePointBatchParam.getDeviceId());
|
|
|
+ baseMapper.updateById(y);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|