Commit 0a798812 authored by suhuiguang's avatar suhuiguang

fix(综合搜索):数据同步自测bug

1.设备总价值、事务捕获
parent 2b27ec2f
......@@ -43,7 +43,7 @@ public enum FileFolderPathEnum {
/**
* 检验检测
*/
JYJC("jyjc", "/jyjc");
JYJC("jyjc", "jyjc");
private String module;
private String path;
......
......@@ -4,6 +4,10 @@ import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface EsEquipmentDao extends PagingAndSortingRepository<ESEquipmentInfo, String> {
List<ESEquipmentInfo> findAllByProjectContraptionId(String projectContraptionId);
}
......@@ -115,7 +115,7 @@ public class EsBaseEnterpriseInfo {
/**
* 涉及设备类型名称
*/
@Field(type = FieldType.Keyword)
@Field(type = FieldType.Text)
private String equipCategoryName;
......
......@@ -60,7 +60,7 @@ public class EsUserInfo {
/**
* 岗位名称-按照new_post显示
*/
@Field(type = FieldType.Keyword)
@Field(type = FieldType.Text)
private String postName;
/**
......@@ -144,7 +144,7 @@ public class EsUserInfo {
/**
* 设备类型名称
*/
@Field(type = FieldType.Keyword)
@Field(type = FieldType.Text)
private String equipTypeName;
/**
......@@ -162,7 +162,7 @@ public class EsUserInfo {
/**
* 岗位子类型名称(多个逗号分割)
*/
@Field(type = FieldType.Keyword)
@Field(type = FieldType.Text)
private String subPostName;
/**
......@@ -174,7 +174,7 @@ public class EsUserInfo {
/**
* 管辖机构名称--来源企业表
*/
@Field(type = FieldType.Keyword)
@Field(type = FieldType.Text)
private String superviseOrgName;
/**
......
......@@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
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.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.biz.edit.constant.EditConstant;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.CbDataDictTypeHandler;
......@@ -68,6 +70,8 @@ public class PieLineDataChangeServiceImpl {
private final IdxBizJgUseInfoServiceImpl useInfoService;
private final EsEquipmentDao esEquipmentDao;
public void update(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew, List<FieldChangeMeta> allChangeColumns) {
// 原有对象行转列
......@@ -133,8 +137,15 @@ public class PieLineDataChangeServiceImpl {
esDto.setSEQUENCE_NBR(v);
return esDto;
}).collect(Collectors.toList());
List<ESEquipmentInfo> esEquipmentInfos = recordsForDeleted.stream().map(v -> {
ESEquipmentInfo esDto = new ESEquipmentInfo();
esDto.setSEQUENCE_NBR(v);
return esDto;
}).collect(Collectors.toList());
// 删除es中的数据
esEquipmentCategory.deleteAll(esDtoList);
// 删除3库数据管道
esEquipmentDao.deleteAll(esEquipmentInfos);
}
private void buildDeletePieLineLog(List<PipelineChangeItemDto> recordsForDeleted, List<FieldChangeMeta> allChangeColumns, String projectContraptionId) {
......
......@@ -11,10 +11,11 @@ import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgMaintenanceRecordInfoServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationManageServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -30,14 +31,10 @@ import java.util.*;
public class EquipmentRefreshHandler implements IDataRefreshHandler {
private final IdxBizJgUseInfoServiceImpl useInfoService;
private final IdxBizJgFactoryInfoServiceImpl factoryInfoService;
private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
private final CategoryOtherInfoMapper categoryOtherInfoMapper;
private final EsEquipmentDao esEquipmentDao;
private final IdxBizJgMaintenanceRecordInfoServiceImpl maintenanceRecordInfoService;
private final IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoServiceImpl;
private final StatisticsDataUpdateService statisticsDataUpdateService;
private final IdxBizJgRegisterInfoServiceImpl registerInfoService;
private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageServiceImpl;
......
......@@ -63,7 +63,7 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
reminderItemDto.setEquipId(projectContraptionId);
reminderItemDto.setEquipNo(projectContraption.getProjectContraptionNo());
reminderItemDto.setEquipName(projectContraption.getProjectContraption());
reminderItemDto.setDetailData(BeanUtil.beanToMap(matchItemDto));
reminderItemDto.setDetailData(BeanUtil.beanToMap(projectContraption));
return gradeStrategyFactory.getStrategy(activeStrategy).calculateGrade(Collections.singletonList(reminderItemDto), matchItemDto);
}
......@@ -96,6 +96,11 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
updateWrapper.set(IdxBizJgProjectContraption::getDataQualityScore, level);
updateWrapper.set(BaseEntity::getRecDate, new Date());
idxBizJgProjectContraptionService.update(updateWrapper);
// 更新管道的等级与装置一样
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper2 = new LambdaUpdateWrapper<>();
updateWrapper2.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId);
updateWrapper2.set(IdxBizJgUseInfo::getDataQualityScore, level);
idxBizJgUseInfoService.update(updateWrapper2);
});
}
......
......@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
......@@ -67,6 +68,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -178,7 +181,12 @@ public class DataDockServiceImpl {
recordSet.add(record);
})).toArray(CompletableFuture[]::new)
).join();
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
}
});
return Boolean.TRUE;
}
......@@ -1513,7 +1521,7 @@ public class DataDockServiceImpl {
: "his".equals(equipmentInfoForm.get("DATA_SOURCE"))
? "jg_his_pl"
: "jg_his_black_pl";
Set<String> recordSet = new HashSet<>();
Arrays.stream(equipInfoExcelDtos.toArray(new EquipInfoExcelDto[0])).forEach(equ -> {
if (!equ.getEquList().equals(equList) || !equ.getEquCategory().equals(equCategory)){
throw new BadRequest("设备种类或设备类型与模板上传不一致,请核对后进行上传!");
......@@ -1527,8 +1535,10 @@ public class DataDockServiceImpl {
equMap.put("orgBranchCode", orgBranchCode);
equMap.put("EQU_STATE", equipmentInfoForm.get("EQU_STATE"));
}
this.saveEquipmentDataInTransaction(equMap, dataSource, remark);
String record = this.saveEquipmentDataInTransaction(equMap, dataSource, remark);
recordSet.add(record);
});
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
}
/**
......@@ -1752,9 +1762,6 @@ public class DataDockServiceImpl {
this.checkTheUnitProConAlreadyExists(paramsDto);
// 生成工程装置表信息
IdxBizJgProjectContraption proCon = this.saveProjectContraption(paramsDto);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), Sets.newHashSet(proCon.toString()), EquipCreateOrEditEvent.EquipType.project));
// 保存管道对应的idx表数据
List<String> records = this.savePipInfoToIdxTables(equLists, paramsDto, proCon);
if (isGYGD) {
......@@ -1779,7 +1786,7 @@ public class DataDockServiceImpl {
}
}
}
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.INSERT));
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), Sets.newHashSet(proCon.getSequenceNbr() + ""), EquipCreateOrEditEvent.EquipType.project));
return Boolean.TRUE;
}
......@@ -2451,7 +2458,12 @@ public class DataDockServiceImpl {
recordSet.add(record);
})).toArray(CompletableFuture[]::new)
).join();
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
}
});
return Boolean.TRUE;
}
......
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