|
|
|
@ -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<HazardWorkMapper, HazardW
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean deleteBacth(List<Long> workIds) { |
|
|
|
|
if(CollectionUtil.isEmpty(workIds)){ |
|
|
|
|
throw new ServiceException("请勾选作业区域,再进行删除!"); |
|
|
|
|
throw new HzServiceException(ResultCode.FAILURE, "请勾选作业区域,再进行删除!"); |
|
|
|
|
} |
|
|
|
|
// 删除作业区域记录 && 关联危险源记录
|
|
|
|
|
return super.removeByIds(workIds) && |
|
|
|
|
correlationService.remove(Wrappers.<Correlation>lambdaQuery().in(Correlation::getWorkId,workIds)); |
|
|
|
|
boolean remove = super.removeByIds(workIds); |
|
|
|
|
if (!remove) { |
|
|
|
|
throw new HzServiceException(ResultCode.FAILURE, "作业区域记录删除失败"); |
|
|
|
|
} |
|
|
|
|
List<Correlation> correlationList = correlationService.list(Wrappers.<Correlation>lambdaQuery().in(Correlation::getWorkId, workIds)); |
|
|
|
|
if (CollectionUtil.isNotEmpty(correlationList)) { |
|
|
|
|
List<Long> collectIds = correlationList.stream().map(Correlation::getId).collect(Collectors.toList()); |
|
|
|
|
return correlationService.removeByIds(collectIds); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|