From 03837d1e53e4e34862c87f33445282405e2a12a8 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 2 Sep 2024 20:18:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BD=9C=E4=B8=9A=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=88=A0=E9=99=A4=E6=8A=A5=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../risk/service/impl/HazardWorkServiceImpl.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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; } /** From 60f9491116352010332ef1b5f8efdd8c3b763ad8 Mon Sep 17 00:00:00 2001 From: luyie Date: Tue, 3 Sep 2024 09:48:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E5=90=91=E9=87=8F=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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 { }