|
|
@ -14,6 +14,7 @@ import com.hnac.hzims.equipment.mapper.EmInfoMapper; |
|
|
|
import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper; |
|
|
|
import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper; |
|
|
|
import com.hnac.hzims.equipment.service.*; |
|
|
|
import com.hnac.hzims.equipment.service.*; |
|
|
|
import com.hnac.hzims.equipment.vo.*; |
|
|
|
import com.hnac.hzims.equipment.vo.*; |
|
|
|
|
|
|
|
import com.hnac.hzims.fdp.service.IFdpQuestionService; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
@ -28,6 +29,8 @@ import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.vo.CreateTableVO; |
|
|
|
import org.springblade.system.vo.CreateTableVO; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -39,6 +42,7 @@ import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import java.util.function.Consumer; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
@ -72,6 +76,12 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private DeviceClient deviceClient; |
|
|
|
private DeviceClient deviceClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IFdpQuestionService questionService; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.equipment.emInfo.code}") |
|
|
|
@Value("${hzims.equipment.emInfo.code}") |
|
|
|
public String deviceCodePath; |
|
|
|
public String deviceCodePath; |
|
|
|
|
|
|
|
|
|
|
@ -420,6 +430,27 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit |
|
|
|
return this.baseMapper.listByTenantId(tenantId); |
|
|
|
return this.baseMapper.listByTenantId(tenantId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Boolean remove(String ids) { |
|
|
|
|
|
|
|
List<Long> idList = Func.toLongList(",",ids); |
|
|
|
|
|
|
|
// 判断是否存在子设备
|
|
|
|
|
|
|
|
List<EmInfoEntity> childEmList = this.list(Wrappers.<EmInfoEntity>lambdaQuery().in(EmInfoEntity::getGpid, idList)); |
|
|
|
|
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(childEmList),() -> { |
|
|
|
|
|
|
|
throw new ServiceException("请先删除子设备信息"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 删除FDP答题记录
|
|
|
|
|
|
|
|
Consumer<Long> removeFdpEmInfo = id -> { |
|
|
|
|
|
|
|
EmInfoEntity infoEntity = this.getById(id); |
|
|
|
|
|
|
|
R<Dept> deptResult = sysClient.getDept(infoEntity.getDepartment()); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(infoEntity) && Func.isNotEmpty(infoEntity.getEmIndex()) && deptResult.isSuccess() |
|
|
|
|
|
|
|
&& Func.isNotEmpty(deptResult.getData()) && Func.isNotEmpty(deptResult.getData().getStationId())) { |
|
|
|
|
|
|
|
questionService.deleteDevsetAnswer(deptResult.getData().getStationId(), infoEntity.getEmIndex()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
idList.forEach(removeFdpEmInfo); |
|
|
|
|
|
|
|
return this.deleteLogic(Func.toLongList(",", ids)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设备信息缓存(ct、pt、installedCapacity、监测点位) |
|
|
|
* 设备信息缓存(ct、pt、installedCapacity、监测点位) |
|
|
|