Commit cb3ef711 authored by suhuiguang's avatar suhuiguang

feat(jg): 西安数据核对

1.核对数据同步接口es不存在属地时进行更新属地已数据库为主
parent b0b01cf8
package com.yeejoin.amos.boot.module.jg.biz.data.fix.service; package com.yeejoin.amos.boot.module.jg.biz.data.fix.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.TzsDataRefreshMessage; import com.yeejoin.amos.boot.module.common.api.entity.TzsDataRefreshMessage;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher.FilterableBatchDataPatcher; import com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher.FilterableBatchDataPatcher;
import com.yeejoin.amos.boot.module.jg.biz.edit.utils.JsonDiffUtil;
import com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService; import com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService;
import com.yeejoin.amos.boot.module.jg.biz.refresh.handler.EquipmentRefreshHandler; import com.yeejoin.amos.boot.module.jg.biz.refresh.handler.EquipmentRefreshHandler;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -27,11 +32,14 @@ public class FilterableEquipInsert2EsPatcher extends FilterableBatchDataPatcher ...@@ -27,11 +32,14 @@ public class FilterableEquipInsert2EsPatcher extends FilterableBatchDataPatcher
private final IdxBizJgUseInfoMapper idxBizJgUseInfoMapper; private final IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
protected FilterableEquipInsert2EsPatcher(ApplicationContext applicationContext, ESEquipmentCategory equipmentCategory, EquipmentRefreshHandler refreshHandler, IdxBizJgUseInfoMapper idxBizJgUseInfoMapper) { private final IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper;
protected FilterableEquipInsert2EsPatcher(ApplicationContext applicationContext, ESEquipmentCategory equipmentCategory, EquipmentRefreshHandler refreshHandler, IdxBizJgUseInfoMapper idxBizJgUseInfoMapper, IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper) {
super(applicationContext); super(applicationContext);
this.equipmentCategory = equipmentCategory; this.equipmentCategory = equipmentCategory;
this.refreshHandler = refreshHandler; this.refreshHandler = refreshHandler;
this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper; this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper;
this.idxBizJgSupervisionInfoMapper = idxBizJgSupervisionInfoMapper;
} }
@Override @Override
...@@ -58,6 +66,19 @@ public class FilterableEquipInsert2EsPatcher extends FilterableBatchDataPatcher ...@@ -58,6 +66,19 @@ public class FilterableEquipInsert2EsPatcher extends FilterableBatchDataPatcher
} catch (Exception e) { } catch (Exception e) {
log.error("老设备索引插入处理失败:{}", record, e); log.error("老设备索引插入处理失败:{}", record, e);
} }
} else {
try {
IdxBizJgSupervisionInfo supervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, record)
.select(IdxBizJgSupervisionInfo::getRecord, IdxBizJgSupervisionInfo::getOrgBranchCode, IdxBizJgSupervisionInfo::getOrgBranchName));
ESEquipmentCategoryDto esEquipmentInfo = op.get();
if (supervisionInfo != null && StringUtils.isNotEmpty(supervisionInfo.getOrgBranchCode()) && JsonDiffUtil.isNullOrEmpty(esEquipmentInfo.getOrgBranchCode())) {
esEquipmentInfo.setOrgBranchCode(supervisionInfo.getOrgBranchCode());
esEquipmentInfo.setORG_BRANCH_NAME(supervisionInfo.getOrgBranchName());
equipmentCategory.save(esEquipmentInfo);
}
} catch (Exception e) {
log.error("老设备索引更新属地处理失败:{}", record, e);
}
} }
// 插入或者新索引 // 插入或者新索引
try { try {
......
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