add[project]: 手动更新待办数据接口

This commit is contained in:
2026-03-24 09:44:02 +08:00
parent 87edb4dc57
commit f9c744f80b
5 changed files with 96 additions and 0 deletions

View File

@@ -231,5 +231,11 @@ public class SimulationLyricNodeController {
return lyricInternalService.manuallySupplementTodoReport(taskId);
}
@GetMapping("/manuallySupplementTodoInfo")
@Operation(summary = "手动更新待办数据", description = "手动更新待办数据")
public SdmResponse manuallySupplementTodoInfo(@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime) {
return lyricInternalService.manuallySupplementTodoInfo(startTime, endTime);
}
}

View File

@@ -49,4 +49,5 @@ public interface SimulationDemandMapper extends BaseMapper<SimulationDemand> {
List<SpdmDemandVo> getDemandListByProjectId(@Param("nodeId") String nodeId);
List<SpdmDemandVo> getListByTime(@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("tenantId") Long tenantId);
}

View File

@@ -65,4 +65,5 @@ public interface ILyricInternalService {
SdmResponse manuallySupplementTodoReport(String taskId);
SdmResponse manuallySupplementTodoInfo(String startTime, String endTime);
}

View File

@@ -4405,6 +4405,80 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
return SdmResponse.success();
}
@Override
public SdmResponse manuallySupplementTodoInfo(String startTime, String endTime) {
Long tenantId = ThreadLocalContext.getTenantId();
// 缓存校验
SdmResponse cacheCheckResponse = checkSyncCache();
if (cacheCheckResponse != null) {
return cacheCheckResponse;
}
if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
String[] timeArray = calculateTimeRange(lyricTodoInterval);
startTime = timeArray[0];
endTime = timeArray[1];
}
// 查询原始待办数据
List<LyricVTodoEmulationInfoDM> todoInfoList = lyricVTodoInfoService.lambdaQuery()
.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);
return SdmResponse.success();
}
// 根据todoId去重保留首次出现的待办
todoInfoList = todoInfoList.stream()
// 过滤掉todoId为null的数据
.filter(dm -> dm.getSubject() != null)
.collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(LyricVTodoEmulationInfoDM::getSubject))),
ArrayList::new
));
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();
if (!isConvertibleToLong(demandCode)) {
continue;
}
LyricVTodoEmulationInfoDM lyricVTodoEmulationInfoDM = todoMap.get(Long.valueOf(demandCode));
if (ObjectUtils.isEmpty(lyricVTodoEmulationInfoDM)) {
continue;
}
// 对比是否待办信息有变化
SimulationDemand simulationDemand = compareDemandInfo(spdmDemandVo,lyricVTodoEmulationInfoDM);
if (ObjectUtils.isNotEmpty(simulationDemand)) {
needToUpdateDemandList.add(simulationDemand);
}
}
if (CollectionUtils.isEmpty(needToUpdateDemandList)) {
log.info("needToUpdateDemandList为空");
return SdmResponse.success();
}
// 更新待办信息
demandMapper.updateById(needToUpdateDemandList);
return SdmResponse.success();
}
private SimulationDemand compareDemandInfo(SpdmDemandVo spdmDemandVo, LyricVTodoEmulationInfoDM lyricVTodoEmulationInfoDM) {
if (StringUtils.isNotBlank(spdmDemandVo.getDescription()) && !spdmDemandVo.getDescription().equals(lyricVTodoEmulationInfoDM.getDescribes())) {
SimulationDemand simulationDemand = new SimulationDemand();
BeanUtils.copyProperties(spdmDemandVo,simulationDemand);
return simulationDemand;
}
return null;
}
/**
* 项目的当前阶段包含:设计,就是:项目承接主体+结构,否则就是:项目承接主体+技术中心+结构,所对应的人
*

View File

@@ -231,4 +231,18 @@
select * from simulation_demand where project_id = #{nodeId}
</select>
<select id="getListByTime" resultType="com.sdm.project.model.vo.SpdmDemandVo">
select * from simulation_demand where tenant_id = #{tenantId}
<if test="startTime != null and startTime != ''">
<![CDATA[
and STR_TO_DATE(startTime,'%Y-%m-%d %H:%i:%s') >= #{startTime}
]]>
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[
and STR_TO_DATE(endTime,'%Y-%m-%d %H:%i:%s') <= #{endTime}
]]>
</if>
</select>
</mapper>