|
|
|
@ -2,13 +2,19 @@ package com.hnac.hzims.safeproduct.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; |
|
|
|
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceEntity; |
|
|
|
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; |
|
|
|
|
import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum; |
|
|
|
|
import com.hnac.hzims.safeproduct.mapper.SpecialDeviceInspectionMapper; |
|
|
|
|
import com.hnac.hzims.safeproduct.mapper.SpecialDeviceMapper; |
|
|
|
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 特种设备服务实现类 |
|
|
|
@ -19,6 +25,9 @@ import java.util.List;
|
|
|
|
|
@Service |
|
|
|
|
public class SpecialDeviceServiceImpl extends ServiceImpl<SpecialDeviceMapper, SpecialDeviceEntity> implements ISpecialDeviceService { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
SpecialDeviceInspectionMapper specialDeviceInspectionMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查找时间范围内的过期设备 |
|
|
|
|
*/ |
|
|
|
@ -30,4 +39,19 @@ public class SpecialDeviceServiceImpl extends ServiceImpl<SpecialDeviceMapper, S
|
|
|
|
|
.le(SpecialDeviceEntity::getInspectionNextTime, endTime); |
|
|
|
|
return this.list(queryWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除特种设备 |
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@Override |
|
|
|
|
public boolean removeDevice(Long id) { |
|
|
|
|
List<SpecialDeviceInspectionEntity> inspections = specialDeviceInspectionMapper.getRefDeviceInspection(id); |
|
|
|
|
List<Long> ids = inspections.stream().map(SpecialDeviceInspectionEntity::getId).collect(Collectors.toList()); |
|
|
|
|
int removeInspection = specialDeviceInspectionMapper.deleteBatchIds(ids); |
|
|
|
|
if (removeInspection == SafeProductConstant.SUCCESS) { |
|
|
|
|
return this.removeById(id); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|