Commit 31a4333a authored by tianbo's avatar tianbo

feature:管道安装告知作废修改

parent 9d3183bd
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -13,5 +14,5 @@ import java.util.List; ...@@ -13,5 +14,5 @@ import java.util.List;
*/ */
public interface JgResumeInfoMapper extends BaseMapper<JgResumeInfo> { public interface JgResumeInfoMapper extends BaseMapper<JgResumeInfo> {
void deleteBatchByBusinessId(@Param("idList") List<String> idList); void deleteBatchByBusinessId(@Param("idList") Set<String> idList);
} }
...@@ -180,7 +180,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -180,7 +180,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
@Autowired @Autowired
private IdxBizJgProjectConstructionMapper projectConstructionMapper; private IdxBizJgProjectConstructionMapper projectConstructionMapper;
@Autowired
private IdxBizJgProjectContraptionMapper projectContraptionMapper;
@Autowired @Autowired
EventPublisher eventPublisher; EventPublisher eventPublisher;
...@@ -1154,6 +1155,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1154,6 +1155,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(jgInstallationNotice.getEquCategoryCode())) { if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(jgInstallationNotice.getEquCategoryCode())) {
// 处理工业管道审批后业务数据保存 // 处理工业管道审批后业务数据保存
this.savePipelineData(jgInstallationNotice, jgRelationEquips, finalYm, dto, taskV2Model1); this.savePipelineData(jgInstallationNotice, jgRelationEquips, finalYm, dto, taskV2Model1);
jgResumeInfoService.saveBatchResume(
Lists.newArrayList(JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(jgInstallationNotice.getProjectContraptionId()))
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.routePath(taskV2Model1.getRoutePath())
.build()));
} else { } else {
jgRelationEquips.forEach(jgRelationEquip -> { jgRelationEquips.forEach(jgRelationEquip -> {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
...@@ -1228,23 +1240,24 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1228,23 +1240,24 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum()); changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());
certificateChangeRecordEqService.save(changeRecordEq); certificateChangeRecordEqService.save(changeRecordEq);
}); });
jgResumeInfoService.saveBatchResume(
jgRelationEquips.stream()
.map(v -> JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(v.getEquId()))
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.routePath(taskV2Model1.getRoutePath())
.build())
.collect(Collectors.toList())
);
} }
// 更新关联设备表 // 更新关联设备表
jgInstallationNoticeEqService.updateBatchById(jgRelationEquips); jgInstallationNoticeEqService.updateBatchById(jgRelationEquips);
jgResumeInfoService.saveBatchResume(
jgRelationEquips.stream()
.map(v -> JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(Optional.ofNullable(projectContraptionId).orElse(String.valueOf(v.getEquId()))) // 压力管道使用装置id
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.routePath(taskV2Model1.getRoutePath())
.build())
.collect(Collectors.toList())
);
} else { } else {
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds()); jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
...@@ -1460,7 +1473,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1460,7 +1473,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr()); queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper); List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
List<String> ids = jgInstallationNoticeEqs.stream().map(item -> item.getEquId()).collect(Collectors.toList()); List<String> ids = jgInstallationNoticeEqs.stream().map(item -> item.getEquId()).collect(Collectors.toList());
List<Map<String, Object>> equipListMaps = Lists.newArrayList(); List<Map<String, Object>> equipListMaps;
String equCategoryCode = jgInstallationNotice.getEquCategoryCode(); String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true); Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true);
// 压力管道从工程装置表查询设备信息 // 压力管道从工程装置表查询设备信息
...@@ -1633,6 +1646,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1633,6 +1646,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void deleteConstructionInfo(JgInstallationNotice installationNotice) { private void deleteConstructionInfo(JgInstallationNotice installationNotice) {
constructionInfoMapper.delete(new LambdaQueryWrapper<IdxBizJgConstructionInfo>().eq(IdxBizJgConstructionInfo::getNoticeId, installationNotice.getSequenceNbr())); constructionInfoMapper.delete(new LambdaQueryWrapper<IdxBizJgConstructionInfo>().eq(IdxBizJgConstructionInfo::getNoticeId, installationNotice.getSequenceNbr()));
// 如果设备类型是工业管道,则还需删除工程装置施工信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(installationNotice.getEquCategoryCode())) {
LambdaQueryWrapper<IdxBizJgProjectConstruction> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizJgProjectConstruction::getNoticeId, installationNotice.getSequenceNbr());
projectConstructionMapper.delete(queryWrapper);
}
} }
private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) { private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) {
...@@ -1655,17 +1674,40 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1655,17 +1674,40 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 6.es 回退 // 6.es 回退
this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo); this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo);
}); });
// 如果是工业管道,则回滚工程装置表信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(installationNotice.getEquCategoryCode())) {
this.rollBackProjectContraptionInfo(installationNotice);
}
//删除设备履历信息 //删除设备履历信息
List<String> equipTransferIds = jgInstallationNoticeEqs.stream() Set<String> equipTransferIds = jgInstallationNoticeEqs.stream()
.map(JgInstallationNoticeEq::getEquipTransferId) .map(JgInstallationNoticeEq::getEquipTransferId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toSet());
if (!equipTransferIds.isEmpty()) { if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds); jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
} }
} }
/** /**
* 回滚工程装置表信息
* @param installationNotice installationNotice
*/
private void rollBackProjectContraptionInfo(JgInstallationNotice installationNotice) {
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgProjectContraption::getSequenceNbr, installationNotice.getProjectContraptionId()); // 设置更新条件
// 强制更新字段为 NULL
updateWrapper.set(IdxBizJgProjectContraption::getUseUnitCreditCode, null);
updateWrapper.set(IdxBizJgProjectContraption::getUseUnitName, null);
updateWrapper.set(IdxBizJgProjectContraption::getOrgCode, null);
updateWrapper.set(IdxBizJgProjectContraption::getOrgName, null);
updateWrapper.set(IdxBizJgProjectContraption::getUseRegistrationCode, null);
updateWrapper.set(IdxBizJgProjectContraption::getSupervisoryCode, null);
updateWrapper.set(IdxBizJgProjectContraption::getEquCode, null);
updateWrapper.set(IdxBizJgProjectContraption::getIsIntoManagement, false);
projectContraptionMapper.update(null, updateWrapper);
}
/**
* 释放96333码为未使用状态 * 释放96333码为未使用状态
* @param jgRelationEquip jgRelationEquip * @param jgRelationEquip jgRelationEquip
*/ */
......
...@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract; import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContractEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContractEq;
...@@ -31,7 +30,6 @@ import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher; ...@@ -31,7 +30,6 @@ 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.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis; import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
...@@ -42,7 +40,6 @@ import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO; ...@@ -42,7 +40,6 @@ import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.elasticsearch.client.RestHighLevelClient;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -894,9 +891,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC ...@@ -894,9 +891,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
// 删除在审批完成时写入的设备维保记录 // 删除在审批完成时写入的设备维保记录
idxBizJgMaintenanceRecordInfoService.remove(new LambdaQueryWrapper<IdxBizJgMaintenanceRecordInfo>().eq(IdxBizJgMaintenanceRecordInfo::getSourceId, maintenanceContract.getSequenceNbr())); idxBizJgMaintenanceRecordInfoService.remove(new LambdaQueryWrapper<IdxBizJgMaintenanceRecordInfo>().eq(IdxBizJgMaintenanceRecordInfo::getSourceId, maintenanceContract.getSequenceNbr()));
// 删除批量业务ID信息 // 删除批量业务ID信息
List<String> equipTransferIds = Collections.singletonList(maintenanceContract.getSequenceNbr().toString()); Set<String> equipTransferIds = Collections.singleton(maintenanceContract.getSequenceNbr().toString());
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds); jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
jgResumeInfoService.deleteBatchByBusinessId(equipmentLists.stream().filter(t -> t.getEquipTransferId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList())); jgResumeInfoService.deleteBatchByBusinessId(equipmentLists.stream().filter(t -> t.getEquipTransferId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toSet()));
} }
} }
......
...@@ -9,8 +9,10 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgResumeInfoService; ...@@ -9,8 +9,10 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgResumeInfoService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -58,7 +60,7 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu ...@@ -58,7 +60,7 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu
* 根据业务id进行删除 * 根据业务id进行删除
* @param idList 业务id * @param idList 业务id
*/ */
public void deleteBatchByBusinessId(List<String> idList) { public void deleteBatchByBusinessId(Set<String> idList) {
this.baseMapper.deleteBatchByBusinessId(idList); this.baseMapper.deleteBatchByBusinessId(idList);
} }
} }
\ No newline at end of file
...@@ -2763,10 +2763,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2763,10 +2763,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 5.历史设备处理 // 5.历史设备处理
this.dealHisRegEquipData(jgUseRegistration, record); this.dealHisRegEquipData(jgUseRegistration, record);
}); });
List<String> equipTransferIds = eqList.stream() Set<String> equipTransferIds = eqList.stream()
.map(JgUseRegistrationEq::getEquipTransferId) .map(JgUseRegistrationEq::getEquipTransferId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toSet());
if (!equipTransferIds.isEmpty()) { if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds); jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
} }
......
...@@ -1496,10 +1496,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1496,10 +1496,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS // 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS
this.rollBackForEquipEsInfo(record); this.rollBackForEquipEsInfo(record);
}); });
List<String> equipTransferIds = eqList.stream() Set<String> equipTransferIds = eqList.stream()
.map(JgVehicleInformationEq::getVehicleId) .map(JgVehicleInformationEq::getVehicleId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toSet());
if (!equipTransferIds.isEmpty()) { if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds); jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
} }
......
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