Commit ae80aae0 authored by suhuiguang's avatar suhuiguang

fix(设备创建) :es双写优化

1.写es移动到最后执行
parent 5ba6d6ed
......@@ -639,6 +639,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
taskModelDto.setModel(conveterTaskMessageDTO(jgChangeRegistrationReform));
commonServiceImpl.buildTaskModel(Collections.singletonList(taskModelDto));
}
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationReform));
this.getBaseMapper().updateById(jgChangeRegistrationReform);
} else {
jgChangeRegistrationReform.setAuditPassDate(new Date());
jgChangeRegistrationReform.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
......@@ -672,11 +675,24 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 创建设备履历
this.createResume(jgChangeRegistrationReform, taskV2Model.getRoutePath());
}
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationReform));
this.getBaseMapper().updateById(jgChangeRegistrationReform);
// 清除施工单位信息
this.clearUscInfoEs(jgChangeRegistrationReform);
this.sendDataRefreshMsg(jgChangeRegistrationReform);
}
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationReform));
this.getBaseMapper().updateById(jgChangeRegistrationReform);
}
private void clearUscInfoEs(JgChangeRegistrationReform reform) {
// es
List<JgChangeRegistrationReformEq> reformEqs = jgChangeRegistrationReformEqMapper.selectList(new LambdaQueryWrapper<JgChangeRegistrationReformEq>().eq(JgChangeRegistrationReformEq::getEquipTransferId, reform.getSequenceNbr()));
Iterable<ESEquipmentCategoryDto> esEquipmentCategoryDtos = esEquipmentCategory.findAllById(reformEqs.stream().map(JgChangeRegistrationReformEq::getEquId).collect(Collectors.toList()));
esEquipmentCategoryDtos.forEach(esEquipmentCategoryDto -> {
esEquipmentCategoryDto.setUSC_UNIT_NAME(null);
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(null);
});
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
/**
......@@ -747,17 +763,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
.set(IdxBizJgProjectContraption::getUscUnitCreditCode, null)
.set(IdxBizJgProjectContraption::getUscUnitName, null)
.update();
// es
List<JgChangeRegistrationReformEq> reformEqs = jgChangeRegistrationReformEqMapper.selectList(new LambdaQueryWrapper<JgChangeRegistrationReformEq>().eq(JgChangeRegistrationReformEq::getEquipTransferId, reform.getSequenceNbr()));
reformEqs.forEach(reformEq -> {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(reformEq.getEquId());
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSC_UNIT_NAME(null);
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(null);
esEquipmentCategory.save(esEquipmentCategoryDto);
}
});
}
private void clearUscWInfo(JgChangeRegistrationReform reform) {
......@@ -769,14 +774,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
updateWrapper.set(IdxBizJgUseInfo::getUSC_UNIT_CREDIT_CODE, null);
updateWrapper.set(IdxBizJgUseInfo::getUSC_UNIT_NAME, null);
idxBizJgUseInfoService.update(updateWrapper);
// es清空
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(reformEq.getEquId());
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSC_UNIT_NAME(null);
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(null);
esEquipmentCategory.save(esEquipmentCategoryDto);
}
});
}
......
......@@ -18,6 +18,8 @@ import com.yeejoin.amos.boot.biz.common.enums.TcmUnitTypeEnum;
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.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.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
......@@ -51,6 +53,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
......@@ -83,6 +86,7 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistration
* @date 2023-12-20
*/
@Service
@Slf4j
public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChangeRegistrationTransferDto, JgChangeRegistrationTransfer, JgChangeRegistrationTransferMapper> implements IJgChangeRegistrationTransferService, ICompensateFlowDataOfRedis<JgChangeRegistrationTransfer> {
private static final String PROCESS_DEFINITION_KEY = "changeRegistrationTransfer";
private static final String TABLE_PAGE_ID = "changeRegistrationTransfer";
......@@ -152,7 +156,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private CommonMapper commonMapper;
private ESEquipmentCategory esEquipmentCategory;
/**
* 新增移装变更登记
......@@ -527,9 +531,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//执行流程
ProcessTaskDTO complete = icmWorkflowService.completeOrReject(taskId, dto, operate);
workflowResult = commonService.buildWorkFlowInfo(Collections.singletonList(complete)).get(0);
delRepeatUseEquipData(transfer);
// 更新下一步执行人
this.updateExecuteIds(instanceId, transfer, operate, workflowResult);
delRepeatUseEquipData(transfer);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -730,11 +734,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
private void repeatUsedEquipCheck(List<Long> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.registrationRepeatUsedCheck(String.valueOf(equipMap), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
......@@ -752,6 +751,11 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
}
private void repeatUsedEquipCheck(List<Long> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.registrationRepeatUsedCheck(String.valueOf(equipMap), companyCode));
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(
e -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
......@@ -851,6 +855,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
}
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationTransfer));
this.getBaseMapper().updateById(jgChangeRegistrationTransfer);
} else {
jgChangeRegistrationTransfer.setAuditPassDate(new Date());
jgChangeRegistrationTransfer.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
......@@ -862,7 +869,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
JgRegistrationHistory historyData = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>()
.eq(JgRegistrationHistory::getCurrentDocumentId, jgChangeRegistrationTransfer.getApplyNo())
.eq(JgRegistrationHistory::getIsDelete, false));
this.updateByFlowEnd(jgChangeRegistrationTransfer.getSequenceNbr().toString(), historyData);
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = this.updateByFlowEnd(jgChangeRegistrationTransfer.getSequenceNbr().toString(), historyData);
HashMap<String, Object> map = new HashMap<>();
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
......@@ -877,10 +884,13 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
this.sendDataRefreshMsg(jgChangeRegistrationTransfer);
// 创建设备履历
this.createResume( jgChangeRegistrationTransfer, taskV2Model.getRoutePath());
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationTransfer));
this.getBaseMapper().updateById(jgChangeRegistrationTransfer);
if(!esEquipmentCategoryDtos.isEmpty()){
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
}
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgChangeRegistrationTransfer));
this.getBaseMapper().updateById(jgChangeRegistrationTransfer);
}
private void createResume(JgChangeRegistrationTransfer jgChangeRegistrationTransfer, String routePath) {
......@@ -1019,14 +1029,14 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*
* @param sequenceNbr 移装变更单Id
*/
public void updateByFlowEnd(String sequenceNbr, JgRegistrationHistory historyData) {
public List<ESEquipmentCategoryDto> updateByFlowEnd(String sequenceNbr, JgRegistrationHistory historyData) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgChangeRegistrationTransfer transfer = this.getBaseMapper().selectById(sequenceNbr);
LambdaQueryWrapper<JgChangeRegistrationTransferEq> lambda = new QueryWrapper<JgChangeRegistrationTransferEq>().lambda();
lambda.eq(JgChangeRegistrationTransferEq::getEquipTransferId, sequenceNbr);
List<JgChangeRegistrationTransferEq> transferEqList = jgChangeRegistrationTransferEqService.getBaseMapper().selectList(lambda);
List<String> useRegistrationCodeList = new ArrayList<>(Collections.emptyList());
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
if (!CollectionUtils.isEmpty(transferEqList)) {
AtomicReference<String> useRegistrationCode = new AtomicReference<>("");
AtomicBoolean isUpdateRegistrationCode = new AtomicBoolean(false);
......@@ -1067,7 +1077,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//替换历史数据表和设备使用表
this.replacementHistoryData(device.getEquId(), transfer, historyData, supervisoryCode, code96333);
//更新使用注册登记证编号及ES中的信息
this.updateRegisterInfoAndEsData(device.getEquId(), historyData, useRegistrationCode.get(), supervisoryCode, code96333, isUpdateRegistrationCode);
ESEquipmentCategoryDto equipmentCategoryDto = this.updateRegisterInfoAndEsData(device.getEquId(), historyData, useRegistrationCode.get(), supervisoryCode, code96333, isUpdateRegistrationCode);
esEquipmentCategoryDtos.add(equipmentCategoryDto);
//修改各类告知列表,置为废弃
this.updateInvalidStatusByHistory(device.getEquId(), device.getEquipTransferId());
//修改证管理表数据
......@@ -1085,6 +1096,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
transfer.setRegPersonName(reginParams.getUserModel().getUserName());
transfer.setUseRegistrationCode(String.join(",", useRegistrationCodeList));
this.updateTransferByBaseInfo(transfer);
return esEquipmentCategoryDtos;
}
private void updateUseRegistrationManage(JgChangeRegistrationTransferEq device, JgChangeRegistrationTransfer transfer, JgRegistrationHistory historyData, String useRegistrationCode, boolean isUpdateRegistrationCode) {
......@@ -1334,8 +1346,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param useRegistrationCode 使用注册登记证编号
* @param isUpdateRegistrationCode 是否更新使用登记证编号
*/
public void updateRegisterInfoAndEsData(String equId, JgRegistrationHistory newData, String useRegistrationCode,
String supervisoryCode, String code96333, AtomicBoolean isUpdateRegistrationCode) {
public ESEquipmentCategoryDto updateRegisterInfoAndEsData(String equId, JgRegistrationHistory newData, String useRegistrationCode,
String supervisoryCode, String code96333, AtomicBoolean isUpdateRegistrationCode) {
//更新使用注册登记证编号
if (isUpdateRegistrationCode.get()) {
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(equId, useRegistrationCode);
......@@ -1418,8 +1430,14 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
map1.put("CODE96333", code96333);
}
resultMap.put(equId, map1);
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(equId);
if(optional.isPresent()){
ESEquipmentCategoryDto categoryDto = optional.get();
BeanUtil.copyProperties(map1, categoryDto, true);
return categoryDto;
}
log.error("办理业务的设备: {},在es中不存在", equId);
throw new BadRequest("设备数据不存在");
}
//更新移装变更基本信息
......
......@@ -53,6 +53,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.*;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
......@@ -82,6 +83,7 @@ import static java.util.stream.Collectors.toSet;
* @date 2023-12-25
*/
@Service
@Slf4j
public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, JgEnableDisable, JgEnableDisableMapper> implements IJgEnableDisableService, ICompensateFlowDataOfRedis<JgEnableDisable> {
......@@ -587,7 +589,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
// 执行工作流并返回组装好的工作流信息
WorkflowResultDto workflowResultDto = getWorkflowResultDto(operate, comment, jgEnableDisable);
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
jgEnableDisable.setPromoter(reginParams.getUserModel().getUserId());
TaskV2Model taskV2Model = new TaskV2Model();
if ("0".equals(operate)) {
......@@ -606,7 +608,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
BeanUtils.copyProperties(jgEnableDisable, taskMessageDto);
taskMap.put("model", jgEnableDisable);
// 更新业务数据
updateInfoOther(jgEnableDisable);
esEquipmentCategoryDtos = updateInfoOther(jgEnableDisable);
// 保存json历史数据
commonService.saveOrUpdateHistory(this.getRegistrationClass(jgEnableDisable), map, null, jgEnableDisable.getSequenceNbr().toString());
TaskV2Model taskV2Model1 = commonService.updateTaskModel(taskMap);
......@@ -679,6 +681,9 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgEnableDisable));
this.delRepeatUseEquipData(jgEnableDisable);
if(!esEquipmentCategoryDtos.isEmpty()){
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -731,7 +736,8 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE));
}
private void updateInfoOther(JgEnableDisable jgEnableDisable) {
private List<ESEquipmentCategoryDto> updateInfoOther(JgEnableDisable jgEnableDisable) {
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
// 1.更新设备的使用信息:启用->停用,停用->启用
LambdaQueryWrapper<JgEnableDisableEq> lambdaEq = new QueryWrapper<JgEnableDisableEq>().lambda();
lambdaEq.eq(JgEnableDisableEq::getEnableDisableApplyId, jgEnableDisable.getSequenceNbr());
......@@ -749,7 +755,8 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
wrapper.eq(IdxBizJgUseInfo::getRecord, jgEnableDisableEq.getEquId());
idxBizJgUseInfoMapper.update(idxBizJgUseInfo, wrapper);
// 2.更新设备的es数据的状态:启用->停用,停用->启用
updateEquipEsData(jgEnableDisableEq, idxBizJgUseInfo);
ESEquipmentCategoryDto equipmentCategoryDto = updateEquipEsData(jgEnableDisableEq, idxBizJgUseInfo);
esEquipmentCategoryDtos.add(equipmentCategoryDto);
});
String useRegistrationCodeStr = jgEnableDisable.getUseRegistrationCode();
List<String> useRegistrationCodeList = Optional.ofNullable(useRegistrationCodeStr)
......@@ -765,18 +772,19 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
.in(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCodeList)
.update();
}
return esEquipmentCategoryDtos;
}
private void updateEquipEsData(JgEnableDisableEq jgScrapCancelEq, IdxBizJgUseInfo idxBizJgUseInfo) {
Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("EQU_STATE", idxBizJgUseInfo.getEquState());
resultMap.put(jgScrapCancelEq.getEquId(), map1);
try {
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
} catch (Exception e) {
log.error("更新es失败", e.getCause());
private ESEquipmentCategoryDto updateEquipEsData(JgEnableDisableEq jgScrapCancelEq, IdxBizJgUseInfo idxBizJgUseInfo) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(jgScrapCancelEq.getEquId());
if(optional.isPresent()){
ESEquipmentCategoryDto dto = optional.get();
dto.setEQU_STATE(Integer.parseInt(idxBizJgUseInfo.getEquState()));
return dto;
}
log.error("办理使用登记的设备{},在es中不存在", jgScrapCancelEq.getEquId());
throw new BadRequest("设备数据不存在");
}
......
......@@ -73,6 +73,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static java.util.stream.Collectors.toSet;
......@@ -1032,11 +1033,13 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 执行流程
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办
updateExecuteIds(equList, instanceId, id, operate, processTaskDTO);
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = updateExecuteIds(equList, instanceId, id, operate, processTaskDTO);
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgScrapCancel));
this.delRepeatUseEquipData(jgScrapCancel);
if(!esEquipmentCategoryDtos.isEmpty()){
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BadRequest e) {
......@@ -1058,7 +1061,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
.build();
}
public void updateExecuteIds(String equList, String instanceId, Long sequenceNbr, String operate, ProcessTaskDTO processTaskDTO) {
public List<ESEquipmentCategoryDto> updateExecuteIds(String equList, String instanceId, Long sequenceNbr, String operate, ProcessTaskDTO processTaskDTO) {
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
List<String> roleListNext = new ArrayList<>();
List<String> roleListAll = new ArrayList<>();
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
......@@ -1107,13 +1111,28 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 更新代办
TaskV2Model taskV2Model = updateTaskModel(scrapCancelDto, operate);
// 修改业务信息
updateInfoOther(jgScrapCancel, taskV2Model.getRoutePath());
List<String> records = updateInfoOther(jgScrapCancel, taskV2Model.getRoutePath());
esEquipmentCategoryDtos = this.buildEsData(records, jgScrapCancel);
// 发送数据变更消息
this.sendDataRefreshMsg(jgScrapCancel);
// 创建设备履历
this.createResume(jgScrapCancel, taskV2Model.getRoutePath());
}
this.getBaseMapper().updateById(jgScrapCancel);
return esEquipmentCategoryDtos;
}
private List<ESEquipmentCategoryDto> buildEsData(List<String> records, JgScrapCancel jgScrapCancel) {
Iterable<ESEquipmentCategoryDto> equipmentCategoryDtos = esEquipmentCategory.findAllById(records);
Integer equState;
if (CancelTypeEnum.SCRAPPED.getCode().equals(jgScrapCancel.getCancelType())) {
equState = EquipmentEnum.BAOFEI.getCode();
} else {
equState = EquipmentEnum.ZHUXIAO.getCode();
}
Integer finalEquState = equState;
equipmentCategoryDtos.forEach(e-> e.setEQU_STATE(finalEquState));
return StreamSupport.stream(equipmentCategoryDtos.spliterator(), false).collect(Collectors.toList());
}
private void createResume(JgScrapCancel jgScrapCancel, String routePath) {
......@@ -1142,7 +1161,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE));
}
private void updateInfoOther(JgScrapCancel jgScrapCancel, String routePath) {
private List<String> updateInfoOther(JgScrapCancel jgScrapCancel, String routePath) {
LambdaQueryWrapper<JgScrapCancelEq> lambdaEq = new LambdaQueryWrapper<>();
lambdaEq.eq(JgScrapCancelEq::getEquipTransferId, jgScrapCancel.getSequenceNbr());
lambdaEq.select(JgScrapCancelEq::getEquId, JgScrapCancelEq::getUseRegistrationCode);
......@@ -1233,6 +1252,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
jgScrapCancel.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
jgScrapCancel.setAuditPassDate(new Date());
return equipIds;
}
private void updateProjectContraption(String projectContraptionId) {
......
......@@ -1240,6 +1240,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
buildTask(jgUseRegistration, workflowResultDto);
}
}
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
} else {
// 流程结束
jgUseRegistration.setStatus(taskCode);
......@@ -1334,6 +1336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
List<String> records = new ArrayList<>();
List<JgResumeInfoDto> resumeList = new ArrayList<>();
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
if (!CollectionUtils.isEmpty(equipmentLists)) {
// 装置更新管道的技术参数、设计信息、安装信息
if (jgProjectContraption != null) {
......@@ -1365,7 +1368,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
// 批量收集的结果
HashMap<String, Map<String, Object>> allEsData = new HashMap<>();
List<JgCertificateChangeRecordEq> jgCertificateChangeRecordEqBatchList = new ArrayList<>();
for (int i = 0; i < equipmentLists.size(); i++) {
Map<String, Object> equipment = equipmentLists.get(i);
......@@ -1391,9 +1393,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// equipment.put("inspectOrgName", mapData.getOrDefault("inspectOrgName", ""));
// equipment.put("inspectConclusion", inspectConclusionName);
// 更新设备信息 && 生成使用登记证编号 && 同步es
HashMap<String, Map<String, Object>> esDataMap = this.processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model,
ESEquipmentCategoryDto esData = this.processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model,
jsonObject, flag.get(), useRegistrationCode, equipment, isMerge);
allEsData.putAll(esDataMap);
esEquipmentCategoryDtos.add(esData);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, equId);
......@@ -1406,10 +1408,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());//产品编号
jgCertificateChangeRecordEqBatchList.add(changeRecordEq);
}
// 循环结束后,统一批量更新ES
if (!allEsData.isEmpty()) {
tzsServiceFeignClient.commonUpdateEsDataByIds(allEsData);
}
if (!jgCertificateChangeRecordEqBatchList.isEmpty()){
jgCertificateChangeRecordEqMapper.insertBatchSomeColumn(jgCertificateChangeRecordEqBatchList,BATCH_SIZE);
}
......@@ -1440,10 +1438,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新历史表:下次检验日期、检验机构名称、检验结论在压力管道、气瓶时更新子表单的数据
jgRegistrationHistory.setChangeData(JSON.toJSONString(mapData));
jgRegistrationHistoryService.updateById(jgRegistrationHistory);
this.getBaseMapper().updateById(jgUseRegistration);
this.publish2CalGrade(jgUseRegistration, records);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
// 循环结束后,统一批量更新ES
if (!esEquipmentCategoryDtos.isEmpty()) {
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
}
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
}
/**
......@@ -1823,6 +1825,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
buildTask(jgUseRegistration, workflowResultDto);
}
}
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
} else {
//如果是特殊的历史设备需要更新安装信息和维保信息
String dataSource = jsonObject.getString("DATA_SOURCE");
......@@ -1859,10 +1863,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新代办
TaskV2Model taskV2Model = updateAgency(jgUseRegistration);
HashMap<String, Map<String, Object>> esDataMap = processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model,
jsonObject, Boolean.FALSE, null, mapData, Boolean.FALSE);
tzsServiceFeignClient.commonUpdateEsDataByIds(esDataMap);
Optional.ofNullable(registerInfo).ifPresent(info -> {
// 生成证书管理表记录
generateRegistrationManage(jgUseRegistration, registerInfo, Boolean.FALSE, null);
......@@ -1881,10 +1881,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
certificateChangeRecordEqService.save(changeRecordEq);
this.createResume(jgUseRegistration, registerInfo.getRecord(), taskV2Model.getRoutePath());
});
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
// 更新es
ESEquipmentCategoryDto esData = processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model, jsonObject, Boolean.FALSE, null, mapData, Boolean.FALSE);
esEquipmentCategory.save(esData);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_USAGE_REGISTRATION.name(), Sets.newHashSet(registerInfo.getRecord()), EquipCreateOrEditEvent.EquipType.equip));
}
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
return jgUseRegistration;
}
......@@ -1902,7 +1905,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.build());
}
private HashMap<String, Map<String, Object>> processMapData(Long sequenceNbr, JSONObject mapData, JgUseRegistration jgUseRegistration,
private ESEquipmentCategoryDto processMapData(Long sequenceNbr, JSONObject mapData, JgUseRegistration jgUseRegistration,
JgRegistrationHistory jgRegistrationHistory, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo,
TaskV2Model taskV2Model, JSONObject jsonObject, Boolean flag, String useRegistrationCode,
Map<String, Object> equipment, boolean isMerge) {
......@@ -2051,50 +2054,56 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return codeUtil.generateEquipmentCode(codeGenerateDto);
}
public HashMap<String, Map<String, Object>> updateEsData(String usePlace, JSONObject dataMap, IdxBizJgOtherInfo otherInfo, IdxBizJgUseInfo useInfo,
public ESEquipmentCategoryDto updateEsData(String usePlace, JSONObject dataMap, IdxBizJgOtherInfo otherInfo, IdxBizJgUseInfo useInfo,
JgUseRegistration jgUseRegistration, JSONObject jsonObject) {
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
// 属地监管部门拆分
String orgBranch = (String) dataMap.getOrDefault("orgBranchCode", "_");
String[] split = orgBranch.split("_");
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("CODE96333", otherInfo.getCode96333());
param.put("USE_UNIT_CREDIT_CODE", dataMap.get("useUnitCreditCode"));
param.put("USE_UNIT_NAME", dataMap.get("useUnitName"));
param.put("ADDRESS", dataMap.getOrDefault("address", ""));
param.put("USE_PLACE", usePlace);
param.put("STATUS", "已认领");
param.put("EQU_STATE", Arrays.asList("1", "2").contains(jgUseRegistration.getRegType())
&& useInfo.getEquState() != null ? useInfo.getEquState() : 1);
// 更新es的下次检验日期
param.put("NEXT_INSPECT_DATE", this.castDate2TimeStr(dataMap.getString("nextInspectDate")));
param.put("USE_INNER_CODE", useInfo.getUseInnerCode());
param.put("IS_INTO_MANAGEMENT", true);
param.put("USE_PLACE_CODE", jsonObject == null ? "" :
String.join("#",String.valueOf(jsonObject.getOrDefault("province", "")), String.valueOf(jsonObject.getOrDefault("city", "")),
String.valueOf(jsonObject.getOrDefault("county", "")), String.valueOf(jsonObject.getOrDefault("factoryUseSiteStreet", "")))
);
param.put("USE_SITE_CODE", jsonObject == null ? "" : String.valueOf(jsonObject.getOrDefault("usePlace", "")));
param.put("ORG_BRANCH_CODE", split[0]);
param.put("ORG_BRANCH_NAME", split[1]);
param.put("USC_UNIT_CREDIT_CODE", "");
param.put("USC_UNIT_NAME", "");
param.put("EQU_CODE", dataMap.get("equCode"));
param.put("USE_ORG_CODE", jgUseRegistration.getUseRegistrationCode());
param.put("CYLINDER_CATEGORY", dataMap.get("cylinderCategory"));
if((!ObjectUtils.isEmpty(carNumber))) {
param.put("CAR_NUMBER", dataMap.get("carNumber"));
}
objMap.put((String) dataMap.get("equipId"), param);
// tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
return objMap;
}
public void updateEsData2(String usePlace, JSONObject dataMap, IdxBizJgOtherInfo otherInfo, IdxBizJgUseInfo useInfo,
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById((String) dataMap.get("equipId"));
if(optional.isPresent()){
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
// 属地监管部门拆分
String orgBranch = (String) dataMap.getOrDefault("orgBranchCode", "_");
String[] split = orgBranch.split("_");
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("CODE96333", otherInfo.getCode96333());
param.put("USE_UNIT_CREDIT_CODE", dataMap.get("useUnitCreditCode"));
param.put("USE_UNIT_NAME", dataMap.get("useUnitName"));
param.put("ADDRESS", dataMap.getOrDefault("address", ""));
param.put("USE_PLACE", usePlace);
param.put("STATUS", "已认领");
param.put("EQU_STATE", Arrays.asList("1", "2").contains(jgUseRegistration.getRegType())
&& useInfo.getEquState() != null ? useInfo.getEquState() : 1);
// 更新es的下次检验日期
param.put("NEXT_INSPECT_DATE", this.castDate2TimeStr(dataMap.getString("nextInspectDate")));
param.put("USE_INNER_CODE", useInfo.getUseInnerCode());
param.put("IS_INTO_MANAGEMENT", true);
param.put("USE_PLACE_CODE", jsonObject == null ? "" :
String.join("#",String.valueOf(jsonObject.getOrDefault("province", "")), String.valueOf(jsonObject.getOrDefault("city", "")),
String.valueOf(jsonObject.getOrDefault("county", "")), String.valueOf(jsonObject.getOrDefault("factoryUseSiteStreet", "")))
);
param.put("USE_SITE_CODE", jsonObject == null ? "" : String.valueOf(jsonObject.getOrDefault("usePlace", "")));
param.put("ORG_BRANCH_CODE", split[0]);
param.put("ORG_BRANCH_NAME", split[1]);
param.put("USC_UNIT_CREDIT_CODE", "");
param.put("USC_UNIT_NAME", "");
param.put("EQU_CODE", dataMap.get("equCode"));
param.put("USE_ORG_CODE", jgUseRegistration.getUseRegistrationCode());
param.put("CYLINDER_CATEGORY", dataMap.get("cylinderCategory"));
if((!ObjectUtils.isEmpty(carNumber))) {
param.put("CAR_NUMBER", dataMap.get("carNumber"));
}
ESEquipmentCategoryDto categoryDto = optional.get();
BeanUtil.copyProperties(param, categoryDto, true);
return categoryDto;
}
log.error("办理使用登记的设备{},在es中不存在", dataMap.get("equipId"));
throw new BadRequest("设备数据不存在");
}
public ESEquipmentCategoryDto updateEsData2(String usePlace, JSONObject dataMap, IdxBizJgOtherInfo otherInfo, IdxBizJgUseInfo useInfo,
JgUseRegistration jgUseRegistration, JSONObject jsonObject) {
if (otherInfo != null) {
Optional<ESEquipmentCategoryDto> op = esEquipmentCategory.findById((String) dataMap.get("equipId"));
if(op.isPresent()){
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
......@@ -2129,9 +2138,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
param.put("USE_ORG_CODE", jgUseRegistration.getUseRegistrationCode());
param.put("CYLINDER_CATEGORY", dataMap.get("cylinderCategory"));
param.put("FACTORY_NUM", MapUtil.getStr(dataMap, "factoryNum"));
objMap.put((String) dataMap.get("equipId"), param);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
ESEquipmentCategoryDto categoryDto = op.get();
BeanUtil.copyProperties(param, categoryDto, true);
return categoryDto;
}
log.error("办理使用登记的设备{},在es中不存在", dataMap.get("equipId"));
throw new BadRequest("设备数据不存在");
}
private Long castDate2TimeStr(String nextInspectDate) {
......@@ -4360,6 +4372,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JgUseRegistrationEq jgUseRegistrationEq = new JgUseRegistrationEq();
jgUseRegistrationEq.setEquId(equipId);
jgRelationEquipMapper.update(jgUseRegistrationEq, lambda);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
} else {
//新增暂存
if(!Arrays.asList("tempSubmit", "tempEdit").contains(submitType)){
......@@ -4546,7 +4560,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
this.createCode(map, jgUseRegistration, registerInfo, useInfo, otherInfo);
map.put("equCode", equCode);
// 更新es
this.updateEsData2(usePlace, map, otherInfo, useInfo, jgUseRegistration, map);
ESEquipmentCategoryDto equipmentCategoryDto = this.updateEsData2(usePlace, map, otherInfo, useInfo, jgUseRegistration, map);
this.updateById(jgUseRegistration);
// 设备安装信息更新
......@@ -4573,9 +4587,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.build());
}
esEquipmentCategory.save(equipmentCategoryDto);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
}
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
......
......@@ -2178,6 +2178,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
}
List<ESEquipmentCategoryDto> esEquipmentCategoryDtos = new ArrayList<>();
// 更新关联气瓶信息
if (!CollectionUtils.isEmpty(equipmentLists)) {
List<JgVehicleInformationEq> equipList = new ArrayList<>();
......@@ -2239,7 +2240,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
if(!Arrays.asList("temp", "tempEdit").contains(submitType)){
this.updateEquipInfo(vehicleInformation, registerInfo, otherInfo, String.valueOf(x.get("record")));
// 更新es
this.updateEquipEsData(vehicleInformation, otherInfo, registerInfo, String.valueOf(x.get("record")), useInfo);
ESEquipmentCategoryDto equipmentCategoryDto = this.updateEquipEsData(vehicleInformation, otherInfo, registerInfo, String.valueOf(x.get("record")), useInfo);
esEquipmentCategoryDtos.add(equipmentCategoryDto);
}
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
......@@ -2261,6 +2263,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
Set<String> recordSet = equipmentLists.stream()
.map(v -> (String) v.get("record"))
.collect(Collectors.toSet());
if(!esEquipmentCategoryDtos.isEmpty()){
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
}
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
return Collections.singletonList(vehicleInformation);
}
......@@ -2572,26 +2577,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.createCode(jgVehicleInformation, registerInfo, otherInfo);
}
private void updateEquipEsData(JgVehicleInformation jgVehicleInformation, IdxBizJgOtherInfo otherInfo,
private ESEquipmentCategoryDto updateEquipEsData(JgVehicleInformation jgVehicleInformation, IdxBizJgOtherInfo otherInfo,
IdxBizJgRegisterInfo registerInfo, String equId ,IdxBizJgUseInfo useInfo) {
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("USE_UNIT_CREDIT_CODE", jgVehicleInformation.getUseUnitCreditCode());
param.put("USE_UNIT_NAME", jgVehicleInformation.getUseUnitName());
//param.put("ADDRESS", otherInfo.get);
param.put("USE_PLACE", jgVehicleInformation.getUseUnitAddress());
param.put("STATUS", "已认领");
param.put("EQU_STATE", Optional.ofNullable(useInfo.getEquState())
.orElse(EquipmentEnum.ZAIYONG.getCode().toString()));
param.put("IS_INTO_MANAGEMENT", true);
param.put("ORG_BRANCH_CODE", jgVehicleInformation.getOrgBranchCode());
param.put("ORG_BRANCH_NAME", jgVehicleInformation.getOrgBranchName());
param.put("EQU_CODE", registerInfo.getEquCode());
param.put("USE_ORG_CODE", jgVehicleInformation.getUseRegistrationCode());
objMap.put(equId, param);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
Optional<ESEquipmentCategoryDto> op = esEquipmentCategory.findById((String) equId);
if(op.isPresent()){
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("USE_UNIT_CREDIT_CODE", jgVehicleInformation.getUseUnitCreditCode());
param.put("USE_UNIT_NAME", jgVehicleInformation.getUseUnitName());
param.put("USE_PLACE", jgVehicleInformation.getUseUnitAddress());
param.put("STATUS", "已认领");
param.put("EQU_STATE", Optional.ofNullable(useInfo.getEquState())
.orElse(EquipmentEnum.ZAIYONG.getCode().toString()));
param.put("IS_INTO_MANAGEMENT", true);
param.put("ORG_BRANCH_CODE", jgVehicleInformation.getOrgBranchCode());
param.put("ORG_BRANCH_NAME", jgVehicleInformation.getOrgBranchName());
param.put("EQU_CODE", registerInfo.getEquCode());
param.put("USE_ORG_CODE", jgVehicleInformation.getUseRegistrationCode());
ESEquipmentCategoryDto categoryDto = op.get();
BeanUtil.copyProperties(param, categoryDto, true);
return categoryDto;
}
log.error("办理车用使用登记的设备{},在es中不存在", equId);
throw new BadRequest("设备数据不存在");
}
@Override
......
......@@ -397,11 +397,20 @@ public class CommonServiceImpl {
}
return "no";
}
public void updateEquipNextInspectDate(JyjcInspectionResultModel model, String record) {
updateEsInspectDate(record, model.getNextInspectionDate());
public void updateEquipNextInspectDateBatch(Date nextInspectionDate, List<String> records) {
if (nextInspectionDate != null) {
Iterable<ESEquipmentCategoryDto> equipmentCategoryDtos = esEquipmentCategory.findAllById(records);
equipmentCategoryDtos.forEach(esEquipmentCategoryDto->{
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(nextInspectionDate.getTime());
});
esEquipmentCategory.saveAll(equipmentCategoryDtos);
}
}
public void updateEquipNextInspectDate(JyjcInspectionResult model, String record) {
updateEsInspectDate(record, model.getNextInspectionDate());
}
......
......@@ -372,8 +372,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
// 3.更新使用信息表,最新检验信息
useInfoMapper.updateByRecord(record, model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
// 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(model, record);
});
// 更新装置的汇总的管道长度
calAndWriteTotalPipelineLength(model.getEquipUnicode());
......@@ -405,10 +403,10 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
// 3.更新使用信息表最新的检验信息
useInfoMapper.updateByRecord(model.getEquipUnicode(), model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
// 4.es更新下次检验日期
commonService.updateEquipNextInspectDate(model, model.getEquipUnicode());
records.add(model.getEquipUnicode());
}
// 4.es更新下次检验日期
commonService.updateEquipNextInspectDateBatch(model.getNextInspectionDate(), new ArrayList<>(records));
return records;
}
......
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