Commit ec924042 authored by suhuiguang's avatar suhuiguang

fix(jg): 设备删除

1.删除时不再使用消息而是实时删除
parent 6ab2ddd7
...@@ -229,10 +229,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -229,10 +229,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode()); map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map); registerInfoService.batchDeleteByRecord(map);
} }
// 删除装置表信息 // 删除装置表信息
this.removeById(sequenceNbr); this.removeById(sequenceNbr);
eventPublisher.publish(new DataRefreshEvent(this, useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()), DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return Boolean.TRUE; return Boolean.TRUE;
} }
...@@ -961,7 +959,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -961,7 +959,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
} }
// 删除装置表信息 // 删除装置表信息
this.removeByIds(ids); this.removeByIds(ids);
eventPublisher.publish(new DataRefreshEvent(this, useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()), DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return Boolean.TRUE; return Boolean.TRUE;
} }
......
...@@ -29,7 +29,9 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; ...@@ -29,7 +29,9 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*; import com.yeejoin.amos.boot.biz.common.utils.*;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper; import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
...@@ -119,8 +121,7 @@ import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPE ...@@ -119,8 +121,7 @@ import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPE
import static com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum.YIDENGJI; import static com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum.YIDENGJI;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.*;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_VIEW_JG_ALL;
/** /**
...@@ -361,6 +362,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -361,6 +362,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
private TechParamsBackupService techParamsBackupService; private TechParamsBackupService techParamsBackupService;
@Autowired
private EsEquipmentDao esEquipmentDao;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE"; public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
public static final String DATA_QUALITY_SCORE_JG = "DATA_QUALITY"; public static final String DATA_QUALITY_SCORE_JG = "DATA_QUALITY";
...@@ -1230,10 +1234,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1230,10 +1234,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString()); esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto); list.add(esEquipmentCategoryDto);
} }
// 删除校验,被引用时不可删除。管道不做是否引用校验,直接删除已有管道(20251121注释,管道引用不能删除)
//if(!PipelineEnum.PRESSURE_PIPELINE.getCode().equals(map.get("equList"))) {
//this.checkForDelete(records);
//}
this.checkForDelete(records); this.checkForDelete(records);
if (CollUtil.isNotEmpty(records)) { if (CollUtil.isNotEmpty(records)) {
// 删除涉及的19张表的数据 // 删除涉及的19张表的数据
...@@ -1242,11 +1242,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1242,11 +1242,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
// 删除es中的数据 // 删除es中的数据
esEquipmentCategory.deleteAll(list); esEquipmentCategory.deleteAll(list);
esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return true; return true;
} }
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
return records.stream().map(record->{
ESEquipmentInfo esEquipmentInfo = new ESEquipmentInfo();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
/** /**
* 删除校验,被引用时不可删除 * 删除校验,被引用时不可删除
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment