Commit 2187bfff authored by suhuiguang's avatar suhuiguang

1.管道历史问题处理

parent d40ef5af
package com.yeejoin.amos.boot.module.jg.api.dto;
import lombok.Data;
@Data
public class PieLineEquipContraptionDto {
/**
* 装置id
*/
private String projectContraptionId;
/**
* 装置名称
*/
private String projectContraption;
/**
* 设备record
*/
private String record;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import java.util.List;
......@@ -28,4 +29,12 @@ public interface JgInstallationNoticeEqMapper extends CustomBaseMapper<JgInstall
*/
List<JgInstallationNoticeEq> selectPCIdNeErrorPieLineInUseInfo();
/**
* 查询安装告知(非删除、已作废)的装置id和设备的使用信息装置id不一样的设备
*
* @return List<JgInstallationNoticeEq> 管道record数组
*/
List<PieLineEquipContraptionDto> selectPCIdNeErrorPieLineInUseInfo2();
}
......@@ -34,4 +34,24 @@
and u.project_contraption_id != n.project_contraption_id
and pc."rec_user_name" LIKE '%杨生元%' AND pc."rec_date" >= '2025-01-06 00:00:00'
</select>
<select id="selectPCIdNeErrorPieLineInUseInfo2" resultType="com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto">
SELECT
ne.equ_id as record,
pc.project_contraption,
pc.sequence_nbr as project_contraption_id
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
order by n.create_date
</select>
</mapper>
......@@ -111,5 +111,13 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(true);
}
@ApiOperation(httpMethod = "PUT", value = "20250109-之前刷库问题导致的管道的装置id与安装告知不一样,已安装告知为准,刷使用信息表的装置id、es的装置id【只处理未做过使用登记或者使用登记未完成的】", notes = "历史数据处理")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/v4/projectContraption/useInfo")
public ResponseModel<Boolean> projectUseInfoUpdateV4(){
dataHandlerService.projectUseInfoUpdateV4();
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.PieLineEquipContraptionDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
......@@ -902,4 +903,30 @@ public class DataHandlerServiceImpl {
private List<JgInstallationNotice> getNotInsertProjectConstructionInstallNotice() {
return jgInstallationNoticeMapper.selectNotInsertProjectConstructionInstallNoticeList();
}
/**
* 之前刷库问题导致的管道的装置id与安装告知的装置id的不一样的数据刷库
* 已安装告知为准,刷1.使用信息表的装置id;2.es的装置id。进行比对装置的安装信息与安装告知的信息安装信息对上才刷【使用登记审批完成后,装置表的安装单位信息回清空,故不包括这部分数据】】
*/
public void projectUseInfoUpdateV4() {
List<PieLineEquipContraptionDto> eqs = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo2();
log.info("处理前:查询管道的装置id与安装告知的装置id的不一样管道设备:{}", eqs.size());
eqs.forEach(eq->{
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getRecord());
equInfosWithEs.ifPresent(equInfoEs -> {
// 已安装告知单据为准更新es
equInfoEs.setProjectContraptionId(eq.getProjectContraptionId());
equInfoEs.setPROJECT_CONTRAPTION(eq.getProjectContraption());
esEquipmentCategory.save(equInfoEs);
// 已安装告知单据为准更新use_info
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, eq.getRecord());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, eq.getProjectContraptionId());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraption, eq.getProjectContraption());
useInfoService.update(updateWrapper);
});
});
List<PieLineEquipContraptionDto> eqsAfter = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo2();
log.info("处理后:查询管道装置id与安装告知的装置id的不一样管道设备:{}", eqsAfter.size());
}
}
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