|
|
@@ -6,14 +6,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ktg.common.core.text.Convert;
|
|
|
import com.ktg.common.utils.DateUtils;
|
|
|
import com.ktg.iscs.domain.IsIsolationPoint;
|
|
|
+import com.ktg.iscs.domain.IsSopPoints;
|
|
|
import com.ktg.iscs.domain.vo.points.PointDetailVO;
|
|
|
import com.ktg.iscs.mapper.IsIsolationPointMapper;
|
|
|
import com.ktg.iscs.service.IIsIsolationPointService;
|
|
|
+import com.ktg.iscs.service.IIsSopPointsService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 隔离点Service业务层处理
|
|
|
@@ -26,6 +29,8 @@ public class IsIsolationPointServiceImpl extends ServiceImpl<IsIsolationPointMap
|
|
|
{
|
|
|
@Autowired
|
|
|
private IsIsolationPointMapper isIsolationPointMapper;
|
|
|
+ @Autowired
|
|
|
+ private IIsSopPointsService iIsSopPointsService;
|
|
|
|
|
|
/**
|
|
|
* 查询隔离点
|
|
|
@@ -105,9 +110,22 @@ public class IsIsolationPointServiceImpl extends ServiceImpl<IsIsolationPointMap
|
|
|
{
|
|
|
Assert.notBlank(pointIds, "请选择需要删除的数据!");
|
|
|
Long[] longIds = Convert.toLongArray(pointIds);
|
|
|
+ // 查询有没有sop使用改隔离点,有的话不允许删除
|
|
|
+ checkPointUsed(longIds);
|
|
|
return isIsolationPointMapper.deleteIsIsolationPointByPointIds(longIds);
|
|
|
}
|
|
|
|
|
|
+ private void checkPointUsed(Long[] longIds) {
|
|
|
+ List<IsSopPoints> sopPoints = iIsSopPointsService.list(Wrappers.<IsSopPoints>lambdaQuery()
|
|
|
+ .in(IsSopPoints::getPointId, longIds));
|
|
|
+ if (!sopPoints.isEmpty()) {
|
|
|
+ List<Long> usedPointIds = sopPoints.stream().map(IsSopPoints::getPointId).collect(Collectors.toList());
|
|
|
+ List<IsIsolationPoint> isIsolationPoints = listByIds(usedPointIds);
|
|
|
+ List<String> usedPoindNames = isIsolationPoints.stream().map(IsIsolationPoint::getPointName).collect(Collectors.toList());
|
|
|
+ Assert.isTrue(false, usedPoindNames + "点位正在被sop使用,无法删除!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除隔离点信息
|
|
|
*
|