Commit 6098a5ed authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_main' into develop_tzs_main

parents 2eae243e 63f45e00
...@@ -132,4 +132,11 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto { ...@@ -132,4 +132,11 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
@FieldDisplayDefine(value = "使用登记编号") @FieldDisplayDefine(value = "使用登记编号")
private String useRegistrationCode; private String useRegistrationCode;
@FieldDisplayDefine(value = "监管码", isExist = false)
private String supervisoryCode;
@FieldDisplayDefine(value = "设备代码", isExist = false)
private String equCode;
} }
...@@ -113,6 +113,8 @@ public class PieLineDataChangeServiceImpl { ...@@ -113,6 +113,8 @@ public class PieLineDataChangeServiceImpl {
private ProjectContraptionChangeDataDto getOldProjectContraptionData(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew) { private ProjectContraptionChangeDataDto getOldProjectContraptionData(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew) {
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionServiceImpl.getById(projectContraptionChangeDataDtoNew.getProjectContraptionId()); IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionServiceImpl.getById(projectContraptionChangeDataDtoNew.getProjectContraptionId());
projectContraptionChangeDataDtoNew.setEquCode(projectContraption.getEquCode());
projectContraptionChangeDataDtoNew.setSupervisoryCode(projectContraption.getSupervisoryCode());
return BeanUtil.copyProperties(projectContraption, ProjectContraptionChangeDataDto.class); return BeanUtil.copyProperties(projectContraption, ProjectContraptionChangeDataDto.class);
} }
...@@ -197,7 +199,7 @@ public class PieLineDataChangeServiceImpl { ...@@ -197,7 +199,7 @@ public class PieLineDataChangeServiceImpl {
// 汇总表打印会使用 // 汇总表打印会使用
useInfo.setUseDate(projectContraptionChangeDataDto.getUseDate()); useInfo.setUseDate(projectContraptionChangeDataDto.getUseDate());
useInfo.setDataSource(projectContraptionChangeDataDto.getDataSource()); useInfo.setDataSource(projectContraptionChangeDataDto.getDataSource());
useInfo.setIsIntoManagement(Boolean.FALSE); useInfo.setIsIntoManagement(Boolean.TRUE);
useInfo.setEquState(String.valueOf(EquipmentEnum.ZAIYONG.getCode())); useInfo.setEquState(String.valueOf(EquipmentEnum.ZAIYONG.getCode()));
SingleProjectEquipChangeProcess.setNewUseAddressInfo(projectContraptionChangeDataDto, useInfo); SingleProjectEquipChangeProcess.setNewUseAddressInfo(projectContraptionChangeDataDto, useInfo);
commonEquipDataProcessService.getIdxBizJgUseInfoService().save(useInfo); commonEquipDataProcessService.getIdxBizJgUseInfoService().save(useInfo);
...@@ -255,6 +257,7 @@ public class PieLineDataChangeServiceImpl { ...@@ -255,6 +257,7 @@ public class PieLineDataChangeServiceImpl {
otherInfo.setSequenceNbr(null); otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领"); otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date()); otherInfo.setRecDate(new Date());
otherInfo.setSupervisoryCode(projectContraptionChangeDataDto.getSupervisoryCode());
commonEquipDataProcessService.getIdxBizJgOtherInfoMapper().insert(otherInfo); commonEquipDataProcessService.getIdxBizJgOtherInfoMapper().insert(otherInfo);
//管道技术参数 //管道技术参数
...@@ -291,6 +294,11 @@ public class PieLineDataChangeServiceImpl { ...@@ -291,6 +294,11 @@ public class PieLineDataChangeServiceImpl {
esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName()); esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName());
esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode()); esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode());
esEquipmentDto.setCREATE_DATE(new Date().getTime()); esEquipmentDto.setCREATE_DATE(new Date().getTime());
esEquipmentDto.setUSE_PLACE(String.join("/", projectContraptionChangeDataDto.getProvinceName(), projectContraptionChangeDataDto.getCityName(), projectContraptionChangeDataDto.getCountyName(), projectContraptionChangeDataDto.getStreetName()));
esEquipmentDto.setUSE_PLACE_CODE(String.join("#", projectContraptionChangeDataDto.getProvince(), projectContraptionChangeDataDto.getCity(), projectContraptionChangeDataDto.getCounty(), projectContraptionChangeDataDto.getStreet()));
esEquipmentDto.setADDRESS(projectContraptionChangeDataDto.getAddress());
esEquipmentDto.setSUPERVISORY_CODE(projectContraptionChangeDataDto.getSupervisoryCode());
esEquipmentDto.setEQU_CODE(projectContraptionChangeDataDto.getEquCode());
esEquipmentDto.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId()); esEquipmentDto.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId());
if (inspectionDetectionInfo.getNextInspectDate() != null) { if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime()); esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
...@@ -387,6 +395,11 @@ public class PieLineDataChangeServiceImpl { ...@@ -387,6 +395,11 @@ public class PieLineDataChangeServiceImpl {
esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName()); esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName());
esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode()); esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode());
esEquipmentDto.setUSE_ORG_CODE(projectContraptionChangeDataDto.getUseRegistrationCode()); esEquipmentDto.setUSE_ORG_CODE(projectContraptionChangeDataDto.getUseRegistrationCode());
esEquipmentDto.setUSE_PLACE(String.join("/", projectContraptionChangeDataDto.getProvinceName(), projectContraptionChangeDataDto.getCityName(), projectContraptionChangeDataDto.getCountyName(), projectContraptionChangeDataDto.getStreetName()));
esEquipmentDto.setUSE_PLACE_CODE(String.join("#", projectContraptionChangeDataDto.getProvince(), projectContraptionChangeDataDto.getCity(), projectContraptionChangeDataDto.getCounty(), projectContraptionChangeDataDto.getStreet()));
esEquipmentDto.setADDRESS(projectContraptionChangeDataDto.getAddress());
esEquipmentDto.setSUPERVISORY_CODE(projectContraptionChangeDataDto.getSupervisoryCode());
esEquipmentDto.setEQU_CODE(projectContraptionChangeDataDto.getEquCode());
if (pipelineNew.getNextInspectDate() != null) { if (pipelineNew.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(pipelineNew.getNextInspectDate().getTime()); esEquipmentDto.setNEXT_INSPECT_DATE(pipelineNew.getNextInspectDate().getTime());
} }
......
...@@ -842,7 +842,7 @@ public class DataDockServiceImpl { ...@@ -842,7 +842,7 @@ public class DataDockServiceImpl {
* @param record 设备唯一编码 * @param record 设备唯一编码
*/ */
private void saveEquInfoToEs(String record, String isCompleteXa) { private void saveEquInfoToEs(String record, String isCompleteXa) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
if (!ObjectUtils.isEmpty(equipmentCategoryDto)) { if (!ObjectUtils.isEmpty(equipmentCategoryDto)) {
long recTime; long recTime;
...@@ -2975,7 +2975,7 @@ public class DataDockServiceImpl { ...@@ -2975,7 +2975,7 @@ public class DataDockServiceImpl {
idxBizJgUseInfoService.updateById(useInfo); idxBizJgUseInfoService.updateById(useInfo);
// es更新 // es更新
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(useInfo.getRecord()); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(useInfo.getRecord());
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
equipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.TRUE); equipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.TRUE);
esEquipmentCategory.save(equipmentCategoryDto); esEquipmentCategory.save(equipmentCategoryDto);
......
...@@ -106,7 +106,6 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -106,7 +106,6 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE;
...@@ -1141,7 +1140,7 @@ public class DataHandlerServiceImpl { ...@@ -1141,7 +1140,7 @@ public class DataHandlerServiceImpl {
} }
String[] recordArr = records.trim().split(","); String[] recordArr = records.trim().split(",");
for (String record : recordArr) { for (String record : recordArr) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
categoryOtherInfoMapper.updateEsStatus(record); categoryOtherInfoMapper.updateEsStatus(record);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record); Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record);
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.*;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class EquipChangeDataUpdateService {
private final ESEquipmentCategory esEquipmentCategory;
private final IdxBizJgDesignInfoMapper idxBizJgDesignInfoMapper;
private final IdxBizJgFactoryInfoMapper jgFactoryInfoMapper;
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
private final IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
private final CommonMapper commonMapper;
private final EquipmentCategoryMapper equipmentCategoryMapper;
private final IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
public void updateRegisterChangeData(String record, EquipRegisterChangeDataDto registerChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgRegisterInfo::getRecord, record);
updateWrapper.set(IdxBizJgRegisterInfo::getEquCode, registerChangeDataDto.getEquCode());
updateWrapper.set(IdxBizJgRegisterInfo::getEquCategory, registerChangeDataDto.getEquCategory());
updateWrapper.set(IdxBizJgRegisterInfo::getEquDefine, registerChangeDataDto.getEquDefine());
updateWrapper.set(IdxBizJgRegisterInfo::getProductName, registerChangeDataDto.getProductName());
updateWrapper.set(IdxBizJgRegisterInfo::getEquType, registerChangeDataDto.getEquType());
updateWrapper.set(IdxBizJgRegisterInfo::getEquPrice, registerChangeDataDto.getEquPrice());
updateWrapper.set(IdxBizJgRegisterInfo::getProductPhoto, registerChangeDataDto.getProductPhoto());
updateWrapper.set(IdxBizJgRegisterInfo::getOtherAccessoriesReg, registerChangeDataDto.getOtherAccessoriesReg());
idxBizJgRegisterInfoMapper.update(null, updateWrapper);
updateRegisterEsData(record, registerChangeDataDto);
}
public void updateDesignChangeData(String record, EquipDesignChangeDataDto equipDesignChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgDesignInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgDesignInfo::getRecord, record);
updateWrapper.set(IdxBizJgDesignInfo::getDesignDate, equipDesignChangeDataDto.getDesignDate());
updateWrapper.set(IdxBizJgDesignInfo::getDesignDoc, equipDesignChangeDataDto.getDesignDoc());
updateWrapper.set(IdxBizJgDesignInfo::getDesignUnitCreditCode, equipDesignChangeDataDto.getDesignUnitCreditCode());
updateWrapper.set(IdxBizJgDesignInfo::getDesignUnitName, equipDesignChangeDataDto.getDesignUnitName());
updateWrapper.set(IdxBizJgDesignInfo::getDesignUseDate, equipDesignChangeDataDto.getDesignUseDate());
updateWrapper.set(IdxBizJgDesignInfo::getDesignLicenseNum, equipDesignChangeDataDto.getDesignLicenseNum());
updateWrapper.set(IdxBizJgDesignInfo::getAppraisalUnit, equipDesignChangeDataDto.getAppraisalUnit());
updateWrapper.set(IdxBizJgDesignInfo::getOtherAccessoriesDes, equipDesignChangeDataDto.getOtherAccessoriesDes());
updateWrapper.set(IdxBizJgDesignInfo::getAppraisalDate, equipDesignChangeDataDto.getAppraisalDate());
updateWrapper.set(IdxBizJgDesignInfo::getDrawingDo, equipDesignChangeDataDto.getDrawingDo());
updateWrapper.set(IdxBizJgDesignInfo::getDesignStandard, equipDesignChangeDataDto.getDesignStandard());
updateWrapper.set(equipDesignChangeDataDto.getDesignIsComplete() != null, IdxBizJgDesignInfo::getDesignIsComplete, equipDesignChangeDataDto.getDesignIsComplete());
idxBizJgDesignInfoMapper.update(null, updateWrapper);
}
public void updateFactoryChangeData(String record, EquipFactoryChangeDataDto equipFactoryChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgFactoryInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgFactoryInfo::getRecord, record);
// 影响设备代码的生成
updateWrapper.set(IdxBizJgFactoryInfo::getProduceDate, StringUtils.isNotEmpty(equipFactoryChangeDataDto.getProduceDate()) ? DateUtil.parse(equipFactoryChangeDataDto.getProduceDate(), "yyyy-MM-dd") : null);
updateWrapper.set(IdxBizJgFactoryInfo::getProduceUnitName, equipFactoryChangeDataDto.getProduceUnitName());
updateWrapper.set(IdxBizJgFactoryInfo::getProduceCountry, equipFactoryChangeDataDto.getProduceCountry());
updateWrapper.set(IdxBizJgFactoryInfo::getProduceUnitCreditCode, equipFactoryChangeDataDto.getProduceUnitCreditCode());
updateWrapper.set(IdxBizJgFactoryInfo::getProduceLicenseNum, equipFactoryChangeDataDto.getProduceLicenseNum());
updateWrapper.set(IdxBizJgFactoryInfo::getProductQualityYieldProve, equipFactoryChangeDataDto.getProductQualityYieldProve());
updateWrapper.set(IdxBizJgFactoryInfo::getFactoryStandard, equipFactoryChangeDataDto.getFactoryStandard());
updateWrapper.set(IdxBizJgFactoryInfo::getFactoryNum, equipFactoryChangeDataDto.getFactoryNum());
updateWrapper.set(IdxBizJgFactoryInfo::getFactSupervisionInspectionReport, equipFactoryChangeDataDto.getFactSupervisionInspectionReport());
updateWrapper.set(IdxBizJgFactoryInfo::getOtherAccessoriesFact, equipFactoryChangeDataDto.getOtherAccessoriesFact());
updateWrapper.set(IdxBizJgFactoryInfo::getImported, equipFactoryChangeDataDto.getImported());
updateWrapper.set(IdxBizJgFactoryInfo::getInsUseMaintainExplain, equipFactoryChangeDataDto.getInsUseMaintainExplain());
updateWrapper.set(IdxBizJgFactoryInfo::getBoilerEnergyEfficiencyCertificate, equipFactoryChangeDataDto.getBoilerEnergyEfficiencyCertificate());
updateWrapper.set(equipFactoryChangeDataDto.getFactoryIsComplete() != null, IdxBizJgFactoryInfo::getFactoryIsComplete, equipFactoryChangeDataDto.getFactoryIsComplete());
jgFactoryInfoMapper.update(null, updateWrapper);
this.updateFactoryEsData(record, equipFactoryChangeDataDto);
}
private void updateFactoryEsData(String record, EquipFactoryChangeDataDto equipFactoryChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCE_DATE(equipFactoryChangeDataDto.getProduceDate());
esEquipmentCategoryDto.setFACTORY_NUM(equipFactoryChangeDataDto.getFactoryNum());
esEquipmentCategoryDto.setPRODUCE_UNIT_NAME(equipFactoryChangeDataDto.getProduceUnitName());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
private void updateRegisterEsData(String record, EquipRegisterChangeDataDto registerChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCT_NAME(registerChangeDataDto.getProductName());
esEquipmentCategoryDto.setEQU_CODE(registerChangeDataDto.getEquCode());
esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType());
esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory());
esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine());
// 冗余设备类别名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) {
esEquipmentCategoryDto.setEQU_CATEGORY(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquCategory());
if (category != null) {
esEquipmentCategoryDto.setEQU_CATEGORY(category.getName());
}
}
// 冗余设备品种名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquDefine())) {
esEquipmentCategoryDto.setEQU_DEFINE(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquDefine());
if (category != null) {
esEquipmentCategoryDto.setEQU_DEFINE(category.getName());
}
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateRegisterEsDataPieLine(ProjectContraptionChangeDataDto registerChangeDataDto) {
// es 数据更新
List<ESEquipmentCategoryDto> pieLines = esEquipmentCategory.findAllByProjectContraptionId(registerChangeDataDto.getProjectContraptionId());
for (ESEquipmentCategoryDto esEquipmentCategoryDto : pieLines) {
esEquipmentCategoryDto.setPROJECT_CONTRAPTION(registerChangeDataDto.getProjectContraption());
}
if (!pieLines.isEmpty()) {
esEquipmentCategory.saveAll(pieLines);
}
}
private EquipmentCategory getEquipmentCategory(String categoryCode) {
return equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, categoryCode));
}
public void updateTechParamByRecord(String tableName, String record, List<FieldChangeMeta> changeDataDtos) {
List<DynamicColumnDto> columns = changeDataDtos.stream().map(c -> {
DynamicColumnDto columnDto = new DynamicColumnDto();
columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(c.getColumnKey()).toUpperCase()));
columnDto.setColumnValue(c.getColumnNewValue());
return columnDto;
}).collect(Collectors.toList());
// sql 动态构建入库
commonMapper.updateTechParamDynamic(tableName, record, columns);
}
public void checkFactoryChangeData(String record, EquipFactoryChangeDataDto equipFactoryChangeDataDto, String equList, String equCategory, String equDefine) {
// 气瓶时检验出厂编号-普通气瓶,车用气瓶不再此范围内
if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) && StringUtils.isNotEmpty(equipFactoryChangeDataDto.getFactoryNum())) {
boolean isUsed = this.checkFactoryNumUnique(equipFactoryChangeDataDto.getFactoryNum(), record, equipFactoryChangeDataDto.getProduceUnitCreditCode());
if (isUsed) {
throw new BadRequest("出厂编号/产品编码在该企业中已存在!");
}
}
}
/**
* 普通气瓶检验-同制造单位下唯一
*
* @param factoryNum 出厂编号
* @param produceUnitCreditCode 制造单位编码
* @return 是否被占用
*/
private boolean checkFactoryNumUnique(String factoryNum, String record, String produceUnitCreditCode) {
return commonMapper.checkFactoryNumUnique(factoryNum, record, produceUnitCreditCode) > 0;
}
public void checkRegisterChangeData(String record, EquipRegisterChangeDataDto registerChangeDataDto) {
// 自行输入时,检验设备代码的全局唯一性
if (registerChangeDataDto.getEquCodeType().equals(EquCodeTypeEnum.INPUT.getCode()) && StringUtils.isNotEmpty(registerChangeDataDto.getEquCode())) {
Boolean isUsed = this.checkEquCodeUniqueness(registerChangeDataDto.getEquCode(), record);
if (isUsed) {
throw new BadRequest("设备代码:" + registerChangeDataDto.getEquCode() + "在系统中已存在!");
}
}
}
private Boolean checkEquCodeUniqueness(String equCode, String record) {
// 根据设备代码检查唯一性
return idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode, "", record) > 0;
}
public void checkDesignChangeData(String record, EquipDesignChangeDataDto equipDesignChangeDataDto) {
}
public void updatePieLineDesignData(String record, PieLineDesignChangeDataDto equipDesignChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgDesignInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgDesignInfo::getRecord, record);
updateWrapper.set(IdxBizJgDesignInfo::getDesignUnitName, equipDesignChangeDataDto.getDesignUnitName());
updateWrapper.set(IdxBizJgDesignInfo::getRecDate, new Date());
idxBizJgDesignInfoMapper.update(null, updateWrapper);
}
public void updateUseInfoChangeData(String record, EquipUseInfoChangeDataDto equipUseInfoChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
updateWrapper.set(IdxBizJgUseInfo::getUseUnitCreditCode, equipUseInfoChangeDataDto.getUseUnitCreditCode());
updateWrapper.set(IdxBizJgUseInfo::getUseUnitName, equipUseInfoChangeDataDto.getUseUnitName());
updateWrapper.set(IdxBizJgUseInfo::getUseInnerCode, equipUseInfoChangeDataDto.getUseInnerCode());
idxBizJgUseInfoService.update(updateWrapper);
this.updateUseInfoEsData(record, equipUseInfoChangeDataDto);
}
private void updateUseInfoEsData(String record, EquipUseInfoChangeDataDto equipUseInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSE_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateOtherInfoChangeData(String record, EquipOtherInfoChangeDataDto otherInfoChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgOtherInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgOtherInfo::getRecord, record);
updateWrapper.set(IdxBizJgOtherInfo::getInformationManageCode, otherInfoChangeDataDto.getInformationManageCode());
updateWrapper.set(IdxBizJgOtherInfo::getCylinderStampAttachment, otherInfoChangeDataDto.getCylinderStampAttachment());
updateWrapper.set(IdxBizJgOtherInfo::getInformationSituation, otherInfoChangeDataDto.getInformationSituation());
idxBizJgOtherInfoMapper.update(null, updateWrapper);
}
}
...@@ -113,6 +113,7 @@ import java.util.*; ...@@ -113,6 +113,7 @@ import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPECIAL_CYLINDER; import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPECIAL_CYLINDER;
...@@ -503,16 +504,28 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -503,16 +504,28 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return record * @return record
*/ */
private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) { private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) {
List<ESEquipmentCategoryDto> addEsEquipCategoryDtos = new ArrayList<>();
List<ESEquipmentCategoryDto> deleteEsEquipCategoryDtos = new ArrayList<>();
List<ESEquipmentInfo> addEsEquipInfos = new ArrayList<>();
List<ESEquipmentInfo> deleteEsEquipInfos = new ArrayList<>();
// 获取表单数据并进行类型检查 // 获取表单数据并进行类型检查
LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID)); LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID));
// 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
try { try {
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType, company)); return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType, company, addEsEquipCategoryDtos, deleteEsEquipCategoryDtos, addEsEquipInfos, deleteEsEquipInfos));
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: {}", e.getMessage(), e); log.error("操作失败,数据异常: {}", e.getMessage(), e);
handleError(e, String.valueOf(paramMap.getOrDefault(SEQUENCE_NBR, "")), operateType); // 回滚es:新增的需要删除、删除的需要用快照数据保存
if (!ValidationUtil.isEmpty(addEsEquipCategoryDtos)) {
esEquipmentCategory.deleteAll(addEsEquipCategoryDtos);
esEquipmentDao.deleteAll(this.buildEquipData(addEsEquipCategoryDtos.stream().map(ESEquipmentCategoryDto::getSEQUENCE_NBR).collect(Collectors.toList())));
}
if (!ValidationUtil.isEmpty(deleteEsEquipCategoryDtos)) {
esEquipmentCategory.saveAll(deleteEsEquipCategoryDtos);
}
if (!ValidationUtil.isEmpty(deleteEsEquipInfos)) {
esEquipmentDao.saveAll(deleteEsEquipInfos);
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
} }
...@@ -537,7 +550,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -537,7 +550,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return new ArrayList<>(15); return new ArrayList<>(15);
} }
private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType, CompanyBo company) { private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType, CompanyBo company, List<ESEquipmentCategoryDto> addEsEquipCategoryDtos, List<ESEquipmentCategoryDto> deleteEsEquipCategoryDtos, List<ESEquipmentInfo> addEsEquipInfos, List<ESEquipmentInfo> deleteEsEquipInfos) {
Date date = new Date(); Date date = new Date();
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增 // 设备是否复制而来,复制来的设备走新增
...@@ -560,10 +573,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -560,10 +573,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.stream() .stream()
.map(IdxBizJgUseInfo::getRecord) .map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toList()); .collect(Collectors.toList());
idxBizJgRegisterInfoService.batchDeleteByRecord(MapBuilder.<String, Object>create() // 删除涉及的19张表的数据
.put("recordList", records) superviseInfoMapper.deleteDataAll(records);
.put("equList", equipmentInfoForm.get("EQU_LIST")) // 先查询旧es数据,用于后续报错回滚
.build()); deleteEsEquipCategoryDtos.addAll(StreamSupport.stream(esEquipmentCategory.findAllById(records).spliterator(), false).collect(Collectors.toList()));
deleteEsEquipInfos.addAll(StreamSupport.stream(esEquipmentDao.findAllById(records).spliterator(), false).collect(Collectors.toList()));
// 删除两个es
esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipmentInfoForm.get(PIPELINE_LIST); List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipmentInfoForm.get(PIPELINE_LIST);
...@@ -839,6 +856,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -839,6 +856,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName()); esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr)); esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr));
esEquipmentCategoryList.add(esEquipmentDto); esEquipmentCategoryList.add(esEquipmentDto);
addEsEquipCategoryDtos.add(esEquipmentDto);
} }
idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList); idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList);
iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList); iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList);
...@@ -913,8 +931,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -913,8 +931,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID)); LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID));
// 操作类型 // 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增
boolean isCopy = !ValidationUtil.isEmpty(equipmentInfoForm.get(IS_COPY));
operateType = isCopy ? OPERATESAVE : operateType;
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
String record = (String) equipmentInfoForm.get(RECORD); String record = (String) equipmentInfoForm.get(RECORD);
ESEquipmentCategoryDto esEquipmentCategoryDto = esEquipmentCategory.findById(record).orElse(null);
try { try {
// 设备代码 字段的唯一性校验 // 设备代码 字段的唯一性校验
checkEquCodeUniqueness(equipmentInfoForm); checkEquCodeUniqueness(equipmentInfoForm);
...@@ -923,7 +945,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -923,7 +945,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 96333码 字段的唯一性校验 // 96333码 字段的唯一性校验
check96333Code(equipmentInfoForm); check96333Code(equipmentInfoForm);
} catch (Exception e) { } catch (Exception e) {
handleError(e, null, null); handleError(e, null, null, null);
} }
// 操作类型 // 操作类型
try { try {
...@@ -935,7 +957,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -935,7 +957,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: " + e.getMessage(), e); log.error("操作失败,数据异常: " + e.getMessage(), e);
handleError(e, record, operateType); handleError(e, record, operateType, esEquipmentCategoryDto);
} }
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
...@@ -950,7 +972,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -950,7 +972,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
String record = (String) equipmentInfoForm.get(RECORD); String record = (String) equipmentInfoForm.get(RECORD);
String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE); String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE);
ESEquipmentCategoryDto esEquipmentCategoryDto = esEquipmentCategory.findById(record).orElse(null);
if (dataSource.contains("his")) { if (dataSource.contains("his")) {
// 使用登记证编号校验 // 使用登记证编号校验
this.checkUseRegistrationCodeIsNotNUll(equipmentInfoForm); this.checkUseRegistrationCodeIsNotNUll(equipmentInfoForm);
...@@ -971,7 +993,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -971,7 +993,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 历史有使用登记证的场车设备校验车牌号的唯一性 // 历史有使用登记证的场车设备校验车牌号的唯一性
checkCarNumberUniquenessWithHisCC(equipmentInfoForm, record, dataSource); checkCarNumberUniquenessWithHisCC(equipmentInfoForm, record, dataSource);
} catch (Exception e) { } catch (Exception e) {
handleError(e, null, null); handleError(e, null, null, null);
} }
// 使用登记按照单位办理除外,其余进行编辑校验 // 使用登记按照单位办理除外,其余进行编辑校验
...@@ -983,6 +1005,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -983,6 +1005,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 操作类型 // 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增
boolean isCopy = !ValidationUtil.isEmpty(equipmentInfoForm.get(IS_COPY));
operateType = isCopy ? OPERATESAVE : operateType;
try { try {
// 保存数据 // 保存数据
record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company); record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company);
...@@ -993,7 +1018,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -993,7 +1018,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: " + e.getMessage(), e); log.error("操作失败,数据异常: " + e.getMessage(), e);
handleError(e, record, operateType); handleError(e, record, operateType, esEquipmentCategoryDto);
} }
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
...@@ -1186,7 +1211,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1186,7 +1211,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
private void handleError(Exception e, String record, String operateType) { private void handleError(Exception e, String record, String operateType, ESEquipmentCategoryDto esEquipmentCategoryDto) {
log.error("处理设备新增或更新异常: " + e.getMessage(), e); log.error("处理设备新增或更新异常: " + e.getMessage(), e);
// 删除数据库数据和ES数据 // 删除数据库数据和ES数据
if (!ObjectUtils.isEmpty(record) && OPERATESAVE.equals(operateType)) { if (!ObjectUtils.isEmpty(record) && OPERATESAVE.equals(operateType)) {
...@@ -1195,6 +1220,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1195,6 +1220,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
superviseInfoMapper.deleteDataAll(records); superviseInfoMapper.deleteDataAll(records);
esEquipmentCategory.deleteById(record); esEquipmentCategory.deleteById(record);
} }
if (!ValidationUtil.isEmpty(record) && OPERATEEDIT.equals(operateType) && !ValidationUtil.isEmpty(esEquipmentCategoryDto)) {
esEquipmentCategory.save(esEquipmentCategoryDto);
}
throw new BadRequest(e.getMessage()); throw new BadRequest(e.getMessage());
} }
...@@ -1222,34 +1250,49 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1222,34 +1250,49 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean batchDeleteByRecord(Map<String, Object> map) { public boolean batchDeleteByRecord(Map<String, Object> map) {
Object recordList = map.get("recordList");
List<String> records = new ArrayList<>(); List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>(); List<ESEquipmentCategoryDto> originalEsList1 = new ArrayList<>();
List<ESEquipmentInfo> originalEsList2 = new ArrayList<>();
try {
Object recordList = map.get("recordList");
// 删除ES数据 // 删除ES数据
if (recordList.toString().contains("[")) { if (recordList.toString().contains("[")) {
for (String record : (List<String>) recordList) { records.addAll((List<String>) recordList);
records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
esEquipmentCategoryDto.setSEQUENCE_NBR(record);
list.add(esEquipmentCategoryDto);
}
} else { } else {
records.add(recordList.toString()); records.add(recordList.toString());
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto);
} }
this.checkForDelete(records); this.checkForDelete(records);
if (CollUtil.isNotEmpty(records)) { if (CollUtil.isNotEmpty(records)) {
// 删除涉及的19张表的数据 // 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records); superviseInfoMapper.deleteDataAll(records);
} }
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(records)) {
originalEsList1 = StreamSupport.stream(esEquipmentCategory.findAllById(records).spliterator(), false).collect(Collectors.toList());
originalEsList2 = StreamSupport.stream(esEquipmentDao.findAllById(records).spliterator(), false).collect(Collectors.toList());
// 删除es中的数据 // 删除es中的数据
esEquipmentCategory.deleteAll(list); esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
esEquipmentDao.deleteAll(this.buildEquipData(records)); esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
return true; return true;
} catch (Exception e) {
log.error("批量删除设备注册信息异常: " + e.getMessage(), e);
this.rollbackEsInfo(originalEsList1, originalEsList2);
throw new BadRequest(e.getMessage());
}
}
/**
* 回滚es删除的数据
* @param originalEsList1 esEquipmentCategoryDto集合
* @param originalEsList2 esEquipmentInfo集合
*/
private void rollbackEsInfo(List<ESEquipmentCategoryDto> originalEsList1, List<ESEquipmentInfo> originalEsList2) {
if (CollUtil.isNotEmpty(originalEsList1)) {
esEquipmentCategory.saveAll(originalEsList1);
}
if (CollUtil.isNotEmpty(originalEsList2)) {
esEquipmentDao.saveAll(originalEsList2);
}
} }
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) { private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
...@@ -1260,6 +1303,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1260,6 +1303,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private Iterable<? extends ESEquipmentCategoryDto> buildEquipCategoryData(List<String> records) {
return records.stream().map(record->{
ESEquipmentCategoryDto esEquipmentInfo = new ESEquipmentCategoryDto();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
/** /**
* 删除校验,被引用时不可删除 * 删除校验,被引用时不可删除
* *
...@@ -4085,8 +4136,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4085,8 +4136,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
public void saveEsData(String id) { public void saveEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(id);
categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
if (!ObjectUtils.isEmpty(dto)) { if (!ObjectUtils.isEmpty(dto)) {
long recTime; long recTime;
......
...@@ -13,7 +13,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -13,7 +13,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; 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.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
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.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto; import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
...@@ -94,6 +96,8 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -94,6 +96,8 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
@Resource @Resource
private ESEquipmentCategory esEquipmentCategory; private ESEquipmentCategory esEquipmentCategory;
@Resource @Resource
private EsEquipmentDao esEquipmentDao;
@Resource
private TzsServiceFeignClient tzsServiceFeignClient; private TzsServiceFeignClient tzsServiceFeignClient;
@Resource @Resource
private JgVehicleInformationServiceImpl vehicleInformationService; private JgVehicleInformationServiceImpl vehicleInformationService;
...@@ -707,13 +711,23 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -707,13 +711,23 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
* 认领过程中报错,回滚第一步的es数据 * 认领过程中报错,回滚第一步的es数据
*/ */
public void handleClaimFailed(List<String> records) { public void handleClaimFailed(List<String> records) {
if (!records.isEmpty()) { esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
records.forEach(record -> { esEquipmentDao.deleteAll(this.buildEquipData(records));
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record);
if (!ObjectUtils.isEmpty(data)) {
esEquipmentCategory.deleteById(record);
} }
});
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
return records.stream().map(record->{
ESEquipmentInfo esEquipmentInfo = new ESEquipmentInfo();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
} }
private Iterable<? extends ESEquipmentCategoryDto> buildEquipCategoryData(List<String> records) {
return records.stream().map(record->{
ESEquipmentCategoryDto esEquipmentInfo = new ESEquipmentCategoryDto();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
} }
} }
\ No newline at end of file
...@@ -313,6 +313,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -313,6 +313,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
JyjcInspectionResultModel dbResultModel = this.queryBySeq(model.getSequenceNbr()); JyjcInspectionResultModel dbResultModel = this.queryBySeq(model.getSequenceNbr());
// 更新使用信息、检验信息、技术参数 // 更新使用信息、检验信息、技术参数
Set<String> records = this.updateTechParamAndInspectInfo(dbResultModel, jybgFile); Set<String> records = this.updateTechParamAndInspectInfo(dbResultModel, jybgFile);
sendDataRefreshMsg(records);
return dbResultModel; return dbResultModel;
} }
......
...@@ -30,7 +30,7 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> { ...@@ -30,7 +30,7 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
int updateOtherInfo(String supervisorCode, String editStatus); int updateOtherInfo(String supervisorCode, String editStatus);
Map<String, Object> selectDataById(String id); Map<String, Object> selectJgAllViewDataById(String id);
CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode); CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode);
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE ibjoi."RECORD" = #{record} WHERE ibjoi."RECORD" = #{record}
</select> </select>
<select id="selectDataById" resultType="java.util.Map"> <select id="selectJgAllViewDataById" resultType="java.util.Map">
SELECT "SEQUENCE_NBR", SELECT "SEQUENCE_NBR",
"REC_DATE", "REC_DATE",
"CREATE_DATE", "CREATE_DATE",
......
...@@ -1664,7 +1664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1664,7 +1664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override @Override
public void checkEsData(String id) { public void checkEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(id);
categoryOtherInfoMapper.updateEsStatus(id); categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id); Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id);
......
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