Commit 889a3068 authored by suhuiguang's avatar suhuiguang

1.管道历史问题处理-550数据处理

parent 6737776d
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -37,4 +39,20 @@ public interface JgInstallationNoticeEqMapper extends CustomBaseMapper<JgInstall
*/
List<PieLineEquipContraptionDto> selectPCIdNeErrorPieLineInUseInfo2();
/**
* 查询存在多个安装告知的设备-管道
*
* @return List<JgInstallationNoticeEq> 管道record数组
*/
List<PieLineEquipContraptionDto> selectPCIdNeErrorPieLineInUseInfo3();
/**
* 查询管道对应的安装告知单
*
* @return List<JgInstallationNoticeEqDto> 管道对应的最新安装告知
*/
JgInstallationNoticeEqDto selectLatestNoticeByRecord(@Param("record") String record) ;
}
......@@ -54,4 +54,33 @@
and pc.usc_unit_credit_code = n.install_unit_credit_code
order by n.create_date
</select>
<select id="selectPCIdNeErrorPieLineInUseInfo3" resultType="com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto">
SELECT
distinct ne.equ_id as record
FROM
"tzs_jg_installation_notice" n,
tzs_jg_installation_notice_eq ne,
"idx_biz_jg_use_info" u,
idx_biz_jg_project_contraption pc
WHERE
ne.equip_transfer_id = n.sequence_nbr
and ne.equ_id = u."RECORD"
and pc.sequence_nbr = n.project_contraption_id
and n.is_delete = '0'
and n.notice_status != '6617'
and u.project_contraption_id != n.project_contraption_id
and pc.usc_unit_credit_code = n.install_unit_credit_code
</select>
<select id="selectLatestNoticeByRecord" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto">
select
max(n.sequence_nbr) as equipTransferId
from
"tzs_jg_installation_notice" n,
tzs_jg_installation_notice_eq ne
where
n.is_delete = '0'
and n.notice_status != '6617'
and ne.equip_transfer_id = n.sequence_nbr
and ne.equ_id = #{record}
</select>
</mapper>
......@@ -119,5 +119,13 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(true);
}
@ApiOperation(httpMethod = "PUT", value = "20250110-处理一个管道在多个安装告知里,刷管道的use_info、es的装置id,已最新安装告知为准", notes = "历史数据处理")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/v5/projectContraption/useInfo")
public ResponseModel<Boolean> projectUseInfoUpdateV5(){
dataHandlerService.projectUseInfoUpdateV5();
return ResponseHelper.buildResponse(true);
}
}
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
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.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
......@@ -930,4 +931,32 @@ public class DataHandlerServiceImpl {
List<PieLineEquipContraptionDto> eqsAfter = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo2();
log.info("处理后:查询管道装置id与安装告知的装置id的不一样管道设备:{}", eqsAfter.size());
}
/**
* 处理一个管道在多个安装告知里,刷管道的use_info、es的装置id,已最新安装告知为准
*/
@Transactional(rollbackFor = Exception.class)
public void projectUseInfoUpdateV5() {
List<PieLineEquipContraptionDto> eqs = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo3();
log.info("处理前:一个管道在多个安装告知里,安装告知的装置id的不一样管道设备:{}", eqs.size());
eqs.forEach(eq->{
JgInstallationNoticeEqDto jgInstallationNoticeEqDto = jgInstallationNoticeEqMapper.selectLatestNoticeByRecord(eq.getRecord());
JgInstallationNotice jgInstallationNotice = jgInstallationNoticeMapper.selectOne(new LambdaQueryWrapper<JgInstallationNotice>()
.eq(BaseEntity::getSequenceNbr, jgInstallationNoticeEqDto.getEquipTransferId())
.select(JgInstallationNotice::getProjectContraptionId, JgInstallationNotice::getProjectContraption));
// 1.已安装告知单据为准更新es
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getRecord());
equInfosWithEs.ifPresent(equInfoEs -> {
equInfoEs.setProjectContraptionId(jgInstallationNotice.getProjectContraptionId());
equInfoEs.setPROJECT_CONTRAPTION(jgInstallationNotice.getProjectContraption());
esEquipmentCategory.save(equInfoEs);
});
// 2.已安装告知单据为准更新use_info
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, eq.getRecord());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, jgInstallationNotice.getProjectContraptionId());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraption, jgInstallationNotice.getProjectContraption());
useInfoService.update(updateWrapper);
});
}
}
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