fix[project]: 修改手动更新待办数据

This commit is contained in:
2026-03-26 09:20:39 +08:00
parent 8dbeb3c504
commit dae7447443

View File

@@ -67,6 +67,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -4471,16 +4472,20 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
if (cacheCheckResponse != null) {
return cacheCheckResponse;
}
if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
String[] timeArray = calculateTimeRange(lyricTodoInterval);
startTime = timeArray[0];
endTime = timeArray[1];
List<SpdmDemandVo> demandVoList = demandMapper.getAllList();
if (CollectionUtils.isEmpty(demandVoList)) {
return SdmResponse.success();
}
List<String> demandCodeList = demandVoList.stream().map(SpdmDemandVo::getDemandCode).toList();
if (CollectionUtils.isEmpty(demandCodeList)) {
return SdmResponse.success();
}
// 查询原始待办数据
List<LyricVTodoEmulationInfoDM> todoInfoList = lyricVTodoInfoService.lambdaQuery()
.in(LyricVTodoEmulationInfoDM::getTodoId, demandCodeList)
.eq(LyricVTodoEmulationInfoDM::getRelevanceTask, DemandTypeEnum.FINITE_ELEMENT_SIMULATION.getName())
.ge(LyricVTodoEmulationInfoDM::getCreateTime, startTime)
.le(LyricVTodoEmulationInfoDM::getCreateTime, endTime)
.list();
if (CollectionUtils.isEmpty(todoInfoList)) {
log.info("手动未查询到{}到{}的待同步的待办数据", startTime, endTime);
@@ -4497,11 +4502,6 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
));
Map<Long, LyricVTodoEmulationInfoDM> todoMap = todoInfoList.stream().collect(Collectors.toMap(LyricVTodoEmulationInfoDM::getTodoId, Function.identity()));
List<SpdmDemandVo> demandVoList = demandMapper.getListByTime(startTime,endTime,tenantId);
if (CollectionUtils.isEmpty(demandVoList)) {
return SdmResponse.success();
}
List<SimulationDemand> needToUpdateDemandList = new ArrayList<>();
for (SpdmDemandVo spdmDemandVo : demandVoList) {
String demandCode = spdmDemandVo.getDemandCode();
@@ -4513,6 +4513,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
continue;
}
// 对比是否待办信息有变化
// 对比状态是否有变化
SimulationDemand simulationDemand = compareDemandInfo(spdmDemandVo,lyricVTodoEmulationInfoDM);
if (ObjectUtils.isNotEmpty(simulationDemand)) {
needToUpdateDemandList.add(simulationDemand);
@@ -4538,11 +4539,17 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
}
private SimulationDemand compareDemandInfo(SpdmDemandVo spdmDemandVo, LyricVTodoEmulationInfoDM lyricVTodoEmulationInfoDM) {
SimulationDemand simulationDemand = new SimulationDemand();
String[] ignoreFields = {"description", "demandStatus"};
// 对比是否待办信息有变化
if (StringUtils.isNotBlank(spdmDemandVo.getDescription()) && !spdmDemandVo.getDescription().equals(lyricVTodoEmulationInfoDM.getDescribes())) {
SimulationDemand simulationDemand = new SimulationDemand();
BeanUtils.copyProperties(spdmDemandVo,simulationDemand);
return simulationDemand;
simulationDemand.setDescription(lyricVTodoEmulationInfoDM.getDescribes());
}
// 对比状态是否有变化
if (StringUtils.isNotBlank(spdmDemandVo.getDemandStatus()) && !spdmDemandVo.getDemandStatus().equals(lyricVTodoEmulationInfoDM.getStatus())) {
simulationDemand.setDemandStatus(lyricVTodoEmulationInfoDM.getStatus());
}
BeanUtils.copyProperties(spdmDemandVo,simulationDemand,ignoreFields);
return null;
}