diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java index 2519ec4..c456c14 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java @@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.mapper.VectorParamMapper; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; +import org.springframework.stereotype.Service; /** * @Author: ypj * @Date: 2024/9/2 16:14 */ +@Service public class VectorParamServiceImpl extends ServiceImpl implements VectorParamService { } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java index 4510d3b..bd1e2cc 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzims.safeproduct.risk.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -16,18 +17,21 @@ import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; import com.hnac.hzims.safeproduct.risk.service.HazardWorkService; import com.hnac.hzims.safeproduct.risk.vo.HazardWorkVO; import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO; +import com.hnac.hzinfo.exception.HzServiceException; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.api.ResultCode; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -54,13 +58,22 @@ public class HazardWorkServiceImpl extends ServiceImpl workIds) { if(CollectionUtil.isEmpty(workIds)){ - throw new ServiceException("请勾选作业区域,再进行删除!"); + throw new HzServiceException(ResultCode.FAILURE, "请勾选作业区域,再进行删除!"); } // 删除作业区域记录 && 关联危险源记录 - return super.removeByIds(workIds) && - correlationService.remove(Wrappers.lambdaQuery().in(Correlation::getWorkId,workIds)); + boolean remove = super.removeByIds(workIds); + if (!remove) { + throw new HzServiceException(ResultCode.FAILURE, "作业区域记录删除失败"); + } + List correlationList = correlationService.list(Wrappers.lambdaQuery().in(Correlation::getWorkId, workIds)); + if (CollectionUtil.isNotEmpty(correlationList)) { + List collectIds = correlationList.stream().map(Correlation::getId).collect(Collectors.toList()); + return correlationService.removeByIds(collectIds); + } + return true; } /**