Commit ec8978ad authored by hezhuozhi's avatar hezhuozhi

删除导入的装置信息

parent 4c872f42
......@@ -171,6 +171,18 @@ public class IdxBizJgProjectContraptionController extends BaseController {
}
/**
* 根据sequenceNbr删除datasource为jg_his_gd_pl的数据
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteByHisGdPl")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除datasource为jg_his_gd_pl的数据", notes = "根据sequenceNbr删除datasource为jg_his_gd_pl的数据")
public ResponseModel<Boolean> deleteByHisGdPl(@RequestParam(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.deleteByHisGdPl(sequenceNbr));
}
/**
* 获取检验信息详情
*
* @return
......
......@@ -24,4 +24,6 @@ public interface IIdxBizJgProjectContraptionService extends IService<IdxBizJgPro
IPage<IdxBizJgProjectContraption> proConPageByParams(Map<String, String> params, Page<IdxBizJgProjectContraption> page, ReginParams reginParams);
List<IdxBizJgProjectContraption> proConListByParams(Map<String, String> params, ReginParams reginParams);
Boolean deleteByHisGdPl(Long sequenceNbr);
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -8,16 +10,21 @@ 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.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectConclusionConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectTypeConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -87,6 +94,26 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
private JgVehicleInformationMapper jgVehicleInformationMapper;
@Autowired
private JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgSupervisionInfoServiceImpl idxBizJgSupervisionInfoService;
@Autowired
private IdxBizJgOtherInfoServiceImpl idxBizJgOtherInfoService;
@Autowired
private IdxBizJgTechParamsPipelineServiceImpl idxBizJgTechParamsPipelineService;
@Autowired
private IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
@Autowired
private IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
@Autowired
private ESEquipmentCategory esEquipmentCategory;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -474,4 +501,82 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteByHisGdPl(Long sequenceNbr) {
IdxBizJgProjectContraption idxBizJgProjectContraption = baseMapper.selectById(sequenceNbr);
if(Objects.nonNull(idxBizJgProjectContraption)){
String dataSource = idxBizJgProjectContraption.getDataSource();
if(!"jg_his_gd_pl".equals(dataSource)){
throw new BadRequest("数据源不是导入类型禁止删除");
}
// 删除管道对应的idx表数据
this.deletePipInfoToIdxTables(idxBizJgProjectContraption);
// 删除工程装置表信息
removeById(idxBizJgProjectContraption.getSequenceNbr());
}
return Boolean.TRUE;
}
private void deletePipInfoToIdxTables(IdxBizJgProjectContraption idxBizJgProjectContraption) {
Long jgProjectContraptionSequenceNbr = idxBizJgProjectContraption.getSequenceNbr();
LambdaQueryWrapper<IdxBizJgUseInfo> jgUseInfoWrapper = new LambdaQueryWrapper<>();
jgUseInfoWrapper.eq(IdxBizJgUseInfo::getProjectContraptionId,jgProjectContraptionSequenceNbr);
List<IdxBizJgUseInfo> useInfos = idxBizJgUseInfoService.list(jgUseInfoWrapper);
//获取records
List<String> records = new ArrayList<>();
if(CollectionUtil.isNotEmpty(useInfos)){
for (IdxBizJgUseInfo useInfo : useInfos) {
records.add(useInfo.getRecord());
}
}
if(CollectionUtil.isNotEmpty(records)){
// 删除检验检测信息
LambdaQueryWrapper<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoWrapper = new LambdaQueryWrapper<>();
inspectionDetectionInfoWrapper.in(IdxBizJgInspectionDetectionInfo::getRecord,records);
idxBizJgInspectionDetectionInfoService.remove(inspectionDetectionInfoWrapper);
// 删除设计信息
LambdaQueryWrapper<IdxBizJgDesignInfo> designInfoWrapper = new LambdaQueryWrapper<>();
designInfoWrapper.in(IdxBizJgDesignInfo::getRecord,records);
idxBizJgDesignInfoService.remove(designInfoWrapper);
// 删除制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.in(IdxBizJgFactoryInfo::getRecord,records);
idxBizJgFactoryInfoService.remove(factoryInfoWrapper);
// 删除施工信息
LambdaQueryWrapper<IdxBizJgConstructionInfo> constructionInfoWrapper = new LambdaQueryWrapper<>();
constructionInfoWrapper.in(IdxBizJgConstructionInfo::getRecord,records);
idxBizJgConstructionInfoService.remove(constructionInfoWrapper);
// 删除注册登记信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> registerInfoWrapper = new LambdaQueryWrapper<>();
registerInfoWrapper.in(IdxBizJgRegisterInfo::getRecord,records);
idxBizJgRegisterInfoService.remove(registerInfoWrapper);
// 删除监督管理
LambdaQueryWrapper<IdxBizJgSupervisionInfo> supervisionInfoWrapper = new LambdaQueryWrapper<>();
supervisionInfoWrapper.in(IdxBizJgSupervisionInfo::getRecord,records);
idxBizJgSupervisionInfoService.remove(supervisionInfoWrapper);
// 删除其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> otherInfoWrapper = new LambdaQueryWrapper<>();
otherInfoWrapper.in(IdxBizJgOtherInfo::getRecord,records);
idxBizJgOtherInfoService.remove(otherInfoWrapper);
// 删除管道技术参数
LambdaQueryWrapper<IdxBizJgTechParamsPipeline> techParamsPipelineWrapper = new LambdaQueryWrapper<>();
techParamsPipelineWrapper.in(IdxBizJgTechParamsPipeline::getRecord,records);
idxBizJgTechParamsPipelineService.remove(techParamsPipelineWrapper);
//删除es数据
for (String record : records) {
esEquipmentCategory.deleteById(record);
}
// 删除使用信息
idxBizJgUseInfoService.remove(jgUseInfoWrapper);
}
}
}
\ No newline at end of file
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