diff --git a/1-sql/2025-12-24/project/simulation_demand.sql b/1-sql/2025-12-24/project/simulation_demand.sql
new file mode 100644
index 00000000..e36a4d7c
--- /dev/null
+++ b/1-sql/2025-12-24/project/simulation_demand.sql
@@ -0,0 +1,2 @@
+ALTER TABLE simulation_demand ADD demandSource varchar(12) NULL COMMENT '需求来源:自建、同步';
+ALTER TABLE simulation_demand ADD contentHash varchar(64) NULL COMMENT 'hash值,同步待办时判断是否需要更新';
\ No newline at end of file
diff --git a/1-sql/2025-12-24/project/simulation_node.sql b/1-sql/2025-12-24/project/simulation_node.sql
new file mode 100644
index 00000000..55d3efaa
--- /dev/null
+++ b/1-sql/2025-12-24/project/simulation_node.sql
@@ -0,0 +1,2 @@
+ALTER TABLE simulation_node ADD projectId INT NULL COMMENT '利元亨项目id';
+ALTER TABLE simulation_node ADD projectSource varchar(16) NULL COMMENT '项目来源:自建、同步';
\ No newline at end of file
diff --git a/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVProjectBatchToDM.java b/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVProjectBatchToDM.java
index 5e99951f..c9ac58d7 100644
--- a/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVProjectBatchToDM.java
+++ b/outbridge/src/main/java/com/sdm/outbridge/entity/LyricVProjectBatchToDM.java
@@ -19,7 +19,7 @@ public class LyricVProjectBatchToDM {
@Schema(description = "项目ID")
// 字段名与表字段一致,@TableField可省略,也可以保留(显式指定)
@TableField(value = "project_id")
- private String project_id; // 改为下划线命名,与表字段完全一致
+ private String projectId; // 改为下划线命名,与表字段完全一致
@Schema(description = "批次名称")
@TableField(value = "batch")
diff --git a/project/pom.xml b/project/pom.xml
index 072990a6..3c91e766 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -100,17 +100,17 @@
-
- org.quartz-scheduler
- quartz
- 2.5.0
-
-
-
- org.springframework
- spring-context-support
- 6.1.14
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/src/main/java/com/sdm/project/config/QuartzConfig.java b/project/src/main/java/com/sdm/project/config/QuartzConfig.java
index bce6a0a2..5fb1e3dd 100644
--- a/project/src/main/java/com/sdm/project/config/QuartzConfig.java
+++ b/project/src/main/java/com/sdm/project/config/QuartzConfig.java
@@ -1,43 +1,43 @@
-package com.sdm.project.config;
-
-import com.sdm.project.factory.CustomJobFactory;
-import org.quartz.Scheduler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-
-/**
- * 适配Spring 6.1.14的Quartz配置类
- * 关键:通过SchedulerFactoryBean实例获取Scheduler,而非静态方法
- */
-@Configuration
-public class QuartzConfig {
-
- // 注入自定义的Job工厂
- @Autowired
- private CustomJobFactory customJobFactory;
-
- /**
- * 创建SchedulerFactoryBean(Quartz的核心工厂类)
- */
- @Bean
- public SchedulerFactoryBean schedulerFactoryBean() {
- SchedulerFactoryBean factoryBean = new SchedulerFactoryBean();
- // 可选:设置Quartz属性(如线程池大小、集群配置等)
- // Properties props = new Properties();
- // props.put("org.quartz.threadPool.threadCount", "10");
- // factoryBean.setQuartzProperties(props);
- factoryBean.setJobFactory(customJobFactory);
- return factoryBean;
- }
-
- /**
- * 注入Scheduler实例(从factoryBean中获取,适配Spring 6非静态方法)
- */
- @Bean
- public Scheduler scheduler(SchedulerFactoryBean schedulerFactoryBean) {
- // 这里调用的是实例方法getScheduler(),而非静态方法
- return schedulerFactoryBean.getScheduler();
- }
-}
\ No newline at end of file
+//package com.sdm.project.config;
+//
+//import com.sdm.project.factory.CustomJobFactory;
+//import org.quartz.Scheduler;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+//
+///**
+// * 适配Spring 6.1.14的Quartz配置类
+// * 关键:通过SchedulerFactoryBean实例获取Scheduler,而非静态方法
+// */
+//@Configuration
+//public class QuartzConfig {
+//
+// // 注入自定义的Job工厂
+// @Autowired
+// private CustomJobFactory customJobFactory;
+//
+// /**
+// * 创建SchedulerFactoryBean(Quartz的核心工厂类)
+// */
+// @Bean
+// public SchedulerFactoryBean schedulerFactoryBean() {
+// SchedulerFactoryBean factoryBean = new SchedulerFactoryBean();
+// // 可选:设置Quartz属性(如线程池大小、集群配置等)
+// // Properties props = new Properties();
+// // props.put("org.quartz.threadPool.threadCount", "10");
+// // factoryBean.setQuartzProperties(props);
+// factoryBean.setJobFactory(customJobFactory);
+// return factoryBean;
+// }
+//
+// /**
+// * 注入Scheduler实例(从factoryBean中获取,适配Spring 6非静态方法)
+// */
+// @Bean
+// public Scheduler scheduler(SchedulerFactoryBean schedulerFactoryBean) {
+// // 这里调用的是实例方法getScheduler(),而非静态方法
+// return schedulerFactoryBean.getScheduler();
+// }
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/controller/MultiJobController.java b/project/src/main/java/com/sdm/project/controller/MultiJobController.java
index 51aa3890..3a48ef2d 100644
--- a/project/src/main/java/com/sdm/project/controller/MultiJobController.java
+++ b/project/src/main/java/com/sdm/project/controller/MultiJobController.java
@@ -1,90 +1,90 @@
-package com.sdm.project.controller;
-
-import com.sdm.common.common.SdmResponse;
-import com.sdm.project.job.ProjectSyncJob;
-import com.sdm.project.job.TodoSyncJob;
-import com.sdm.project.manager.MultiJobManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cloud.context.config.annotation.RefreshScope;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.quartz.SchedulerException;
-
-import java.text.ParseException;
-import java.util.Collections;
-
-/**
- * 手动管理多Job的接口
- */
-@RestController
-@RefreshScope
-public class MultiJobController {
-
- @Autowired
- private MultiJobManager multiJobManager;
-
- private static final String TODO_SYNC_JOB_NAME = "todoSyncJob";
-
- private static final String PROJECT_SYNC_JOB_NAME = "projectSyncJob";
-
- @Value("${scheduler.todo}")
- private String schedulerTodoTime;
-
- @Value("${scheduler.project}")
- private String schedulerProjectTime;
-
- // 暂停指定分组的Job(比如暂停数据同步任务:/pauseJob/dataSyncGroup)
- @GetMapping("/pauseJob/{jobGroup}")
- public String pauseJob(@PathVariable String jobGroup) {
- try {
- multiJobManager.pauseJobGroup(jobGroup);
- return "已暂停分组[" + jobGroup + "]的所有任务";
- } catch (SchedulerException e) {
- return "暂停失败:" + e.getMessage();
- }
- }
-
- // 恢复指定分组的Job
- @GetMapping("/resumeJob/{jobGroup}")
- public String resumeJob(@PathVariable String jobGroup) {
- try {
- multiJobManager.resumeJobGroup(jobGroup);
- return "已恢复分组[" + jobGroup + "]的所有任务";
- } catch (SchedulerException e) {
- return "恢复失败:" + e.getMessage();
- }
- }
-
- // 删除指定分组的Job
- @GetMapping("/deleteJob")
- public String deleteJob(@RequestParam String jobGroup) {
- try {
- multiJobManager.deleteJobGroup(jobGroup);
- return "已删除分组[" + jobGroup + "]的所有任务";
- } catch (SchedulerException e) {
- return "删除失败:" + e.getMessage();
- }
- }
-
- // 新增指定分组的Job
- @GetMapping("/createJob")
- public SdmResponse createJob(@RequestParam String jobGroup) {
- try {
- multiJobManager.deleteJobGroup(jobGroup);
- if (TODO_SYNC_JOB_NAME.equals(jobGroup)) {
- multiJobManager.createJob(TodoSyncJob.class,jobGroup, Collections.singletonList(schedulerTodoTime.replaceAll("\\.",":")));
- }else {
- multiJobManager.createJob(ProjectSyncJob.class,jobGroup, Collections.singletonList(schedulerProjectTime.replaceAll("\\.",":")));
- }
- return SdmResponse.success("创建" + jobGroup + "任务成功");
- } catch (SchedulerException e) {
- return SdmResponse.failed("创建" + jobGroup + "任务失败");
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
\ No newline at end of file
+//package com.sdm.project.controller;
+//
+//import com.sdm.common.common.SdmResponse;
+//import com.sdm.project.job.ProjectSyncJob;
+//import com.sdm.project.job.TodoSyncJob;
+//import com.sdm.project.manager.MultiJobManager;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.cloud.context.config.annotation.RefreshScope;
+//import org.springframework.web.bind.annotation.GetMapping;
+//import org.springframework.web.bind.annotation.PathVariable;
+//import org.springframework.web.bind.annotation.RequestParam;
+//import org.springframework.web.bind.annotation.RestController;
+//import org.quartz.SchedulerException;
+//
+//import java.text.ParseException;
+//import java.util.Collections;
+//
+///**
+// * 手动管理多Job的接口
+// */
+//@RestController
+//@RefreshScope
+//public class MultiJobController {
+//
+// @Autowired
+// private MultiJobManager multiJobManager;
+//
+// private static final String TODO_SYNC_JOB_NAME = "todoSyncJob";
+//
+// private static final String PROJECT_SYNC_JOB_NAME = "projectSyncJob";
+//
+// @Value("${scheduler.todo}")
+// private String schedulerTodoTime;
+//
+// @Value("${scheduler.project}")
+// private String schedulerProjectTime;
+//
+// // 暂停指定分组的Job(比如暂停数据同步任务:/pauseJob/dataSyncGroup)
+// @GetMapping("/pauseJob/{jobGroup}")
+// public String pauseJob(@PathVariable String jobGroup) {
+// try {
+// multiJobManager.pauseJobGroup(jobGroup);
+// return "已暂停分组[" + jobGroup + "]的所有任务";
+// } catch (SchedulerException e) {
+// return "暂停失败:" + e.getMessage();
+// }
+// }
+//
+// // 恢复指定分组的Job
+// @GetMapping("/resumeJob/{jobGroup}")
+// public String resumeJob(@PathVariable String jobGroup) {
+// try {
+// multiJobManager.resumeJobGroup(jobGroup);
+// return "已恢复分组[" + jobGroup + "]的所有任务";
+// } catch (SchedulerException e) {
+// return "恢复失败:" + e.getMessage();
+// }
+// }
+//
+// // 删除指定分组的Job
+// @GetMapping("/deleteJob")
+// public String deleteJob(@RequestParam String jobGroup) {
+// try {
+// multiJobManager.deleteJobGroup(jobGroup);
+// return "已删除分组[" + jobGroup + "]的所有任务";
+// } catch (SchedulerException e) {
+// return "删除失败:" + e.getMessage();
+// }
+// }
+//
+// // 新增指定分组的Job
+// @GetMapping("/createJob")
+// public SdmResponse createJob(@RequestParam String jobGroup) {
+// try {
+// multiJobManager.deleteJobGroup(jobGroup);
+// if (TODO_SYNC_JOB_NAME.equals(jobGroup)) {
+// multiJobManager.createJob(TodoSyncJob.class,jobGroup, Collections.singletonList(schedulerTodoTime.replaceAll("\\.",":")));
+// }else {
+// multiJobManager.createJob(ProjectSyncJob.class,jobGroup, Collections.singletonList(schedulerProjectTime.replaceAll("\\.",":")));
+// }
+// return SdmResponse.success("创建" + jobGroup + "任务成功");
+// } catch (SchedulerException e) {
+// return SdmResponse.failed("创建" + jobGroup + "任务失败");
+// } catch (ParseException e) {
+// throw new RuntimeException(e);
+// }
+// }
+//
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/controller/SimulationLyricNodeController.java b/project/src/main/java/com/sdm/project/controller/SimulationLyricNodeController.java
index b4de7b22..c46cae08 100644
--- a/project/src/main/java/com/sdm/project/controller/SimulationLyricNodeController.java
+++ b/project/src/main/java/com/sdm/project/controller/SimulationLyricNodeController.java
@@ -3,6 +3,7 @@ package com.sdm.project.controller;
import com.sdm.common.common.SdmResponse;
import com.sdm.outbridge.mode.GetProcessDataReq;
import com.sdm.project.model.req.PushReportReq;
+import com.sdm.project.model.req.ep.EpProjectQueryReq;
import com.sdm.project.service.ILyricInternalService;
import com.sdm.project.service.ISimulationLyricNodeService;
import io.swagger.v3.oas.annotations.Operation;
@@ -117,5 +118,16 @@ public class SimulationLyricNodeController {
return lyricInternalService.queryProjectInfo(projectId);
}
+ /**
+ * 查询EP项目列表
+ *
+ * @return
+ */
+ @PostMapping("/queryProjectInfoList")
+ @Operation(summary = "查询EP项目列表", description = "查询EP项目列表")
+ public SdmResponse queryProjectInfoList(@RequestBody EpProjectQueryReq req) {
+ return lyricInternalService.queryProjectInfoList(req);
+ }
+
}
diff --git a/project/src/main/java/com/sdm/project/factory/CustomJobFactory.java b/project/src/main/java/com/sdm/project/factory/CustomJobFactory.java
index 995f51a5..e2c8afc8 100644
--- a/project/src/main/java/com/sdm/project/factory/CustomJobFactory.java
+++ b/project/src/main/java/com/sdm/project/factory/CustomJobFactory.java
@@ -1,30 +1,30 @@
-package com.sdm.project.factory;
-
-import org.quartz.spi.TriggerFiredBundle;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
-import org.springframework.scheduling.quartz.AdaptableJobFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * 自定义Job工厂:让Quartz的Job能注入Spring的Service
- */
-@Component
-public class CustomJobFactory extends AdaptableJobFactory {
-
- // 注入Spring的自动装配工厂(核心:用于给Job实例注入依赖)
- @Autowired
- private AutowireCapableBeanFactory autowireCapableBeanFactory;
-
- /**
- * 重写创建Job实例的方法:创建后交给Spring完成依赖注入
- */
- @Override
- protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
- // 1. 让Quartz创建Job实例
- Object jobInstance = super.createJobInstance(bundle);
- // 2. 关键:让Spring为Job实例注入依赖(Service等)
- autowireCapableBeanFactory.autowireBean(jobInstance);
- return jobInstance;
- }
-}
\ No newline at end of file
+//package com.sdm.project.factory;
+//
+//import org.quartz.spi.TriggerFiredBundle;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+//import org.springframework.scheduling.quartz.AdaptableJobFactory;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * 自定义Job工厂:让Quartz的Job能注入Spring的Service
+// */
+//@Component
+//public class CustomJobFactory extends AdaptableJobFactory {
+//
+// // 注入Spring的自动装配工厂(核心:用于给Job实例注入依赖)
+// @Autowired
+// private AutowireCapableBeanFactory autowireCapableBeanFactory;
+//
+// /**
+// * 重写创建Job实例的方法:创建后交给Spring完成依赖注入
+// */
+// @Override
+// protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
+// // 1. 让Quartz创建Job实例
+// Object jobInstance = super.createJobInstance(bundle);
+// // 2. 关键:让Spring为Job实例注入依赖(Service等)
+// autowireCapableBeanFactory.autowireBean(jobInstance);
+// return jobInstance;
+// }
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/job/ProjectSyncJob.java b/project/src/main/java/com/sdm/project/job/ProjectSyncJob.java
index de8d9abe..aea68be8 100644
--- a/project/src/main/java/com/sdm/project/job/ProjectSyncJob.java
+++ b/project/src/main/java/com/sdm/project/job/ProjectSyncJob.java
@@ -1,31 +1,31 @@
-package com.sdm.project.job;
-
-import com.sdm.project.service.impl.LyricInternalServiceImpl;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDateTime;
-
-/**
- * 自定义定时任务执行逻辑
- */
-@Component
-public class ProjectSyncJob implements Job {
-
- @Autowired
- private LyricInternalServiceImpl lyricInternalService;
-
- /**
- * 核心执行方法:这里写你需要定时执行的代码
- */
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- String triggerTime = context.getTrigger().getDescription();
- System.out.println("【项目】定时任务执行成功!触发时间:" + triggerTime + ",当前系统时间:" + LocalDateTime.now());
- lyricInternalService.getProjectList();
- }
-
-}
\ No newline at end of file
+//package com.sdm.project.job;
+//
+//import com.sdm.project.service.impl.LyricInternalServiceImpl;
+//import org.quartz.Job;
+//import org.quartz.JobExecutionContext;
+//import org.quartz.JobExecutionException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.time.LocalDateTime;
+//
+///**
+// * 自定义定时任务执行逻辑
+// */
+//@Component
+//public class ProjectSyncJob implements Job {
+//
+// @Autowired
+// private LyricInternalServiceImpl lyricInternalService;
+//
+// /**
+// * 核心执行方法:这里写你需要定时执行的代码
+// */
+// @Override
+// public void execute(JobExecutionContext context) throws JobExecutionException {
+// String triggerTime = context.getTrigger().getDescription();
+// System.out.println("【项目】定时任务执行成功!触发时间:" + triggerTime + ",当前系统时间:" + LocalDateTime.now());
+// lyricInternalService.getProjectList();
+// }
+//
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/job/TodoSyncJob.java b/project/src/main/java/com/sdm/project/job/TodoSyncJob.java
index 246254eb..ced7cc96 100644
--- a/project/src/main/java/com/sdm/project/job/TodoSyncJob.java
+++ b/project/src/main/java/com/sdm/project/job/TodoSyncJob.java
@@ -1,32 +1,32 @@
-package com.sdm.project.job;
-
-import com.sdm.outbridge.mode.GetProcessDataReq;
-import com.sdm.project.service.impl.LyricInternalServiceImpl;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDateTime;
-
-/**
- * 自定义定时任务执行逻辑
- */
-@Component
-public class TodoSyncJob implements Job {
-
- @Autowired
- private LyricInternalServiceImpl lyricInternalService;
-
- /**
- * 核心执行方法:这里写你需要定时执行的代码
- */
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- String triggerTime = context.getTrigger().getDescription();
- System.out.println("【待办】定时任务执行成功!触发时间:" + triggerTime + ",当前系统时间:" + LocalDateTime.now());
- lyricInternalService.getTodoList();
- }
-
-}
\ No newline at end of file
+//package com.sdm.project.job;
+//
+//import com.sdm.outbridge.mode.GetProcessDataReq;
+//import com.sdm.project.service.impl.LyricInternalServiceImpl;
+//import org.quartz.Job;
+//import org.quartz.JobExecutionContext;
+//import org.quartz.JobExecutionException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.time.LocalDateTime;
+//
+///**
+// * 自定义定时任务执行逻辑
+// */
+//@Component
+//public class TodoSyncJob implements Job {
+//
+// @Autowired
+// private LyricInternalServiceImpl lyricInternalService;
+//
+// /**
+// * 核心执行方法:这里写你需要定时执行的代码
+// */
+// @Override
+// public void execute(JobExecutionContext context) throws JobExecutionException {
+// String triggerTime = context.getTrigger().getDescription();
+// System.out.println("【待办】定时任务执行成功!触发时间:" + triggerTime + ",当前系统时间:" + LocalDateTime.now());
+// lyricInternalService.getTodoList();
+// }
+//
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/manager/MultiJobManager.java b/project/src/main/java/com/sdm/project/manager/MultiJobManager.java
index 7af9ef72..c8650274 100644
--- a/project/src/main/java/com/sdm/project/manager/MultiJobManager.java
+++ b/project/src/main/java/com/sdm/project/manager/MultiJobManager.java
@@ -1,100 +1,100 @@
-package com.sdm.project.manager;
-
-import org.quartz.*;
-import org.quartz.impl.matchers.GroupMatcher;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cloud.context.config.annotation.RefreshScope;
-import org.springframework.stereotype.Component;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 通用定时任务管理类:支持管理多个不同的Job
- */
-@Component
-public class MultiJobManager {
-
- @Autowired
- private Scheduler scheduler;
-
-
- /**
- * 创建指定Job的定时任务
- * @param jobClass 要执行的Job类(比如DataSyncJob.class、MessagePushJob.class)
- * @param jobGroup Job分组(区分不同Job,比如"dataSyncGroup"、"messagePushGroup")
- * @param timeList 执行时间数组(如["15:00:00","16:00:00"])
- */
- public void createJob(Class extends Job> jobClass, String jobGroup, List timeList) throws SchedulerException, ParseException {
- // 遍历时间数组,为当前Job创建多个定时触发器
- for (String time : timeList) {
- // 1. 校验时间格式
- if (!time.matches("^\\d{2}:\\d{2}:\\d{2}$")) {
- throw new IllegalArgumentException("时间格式错误:" + time + ",请使用HH:mm:ss格式");
- }
-
- // 2. 拆分时分秒,构建Cron表达式
- String[] timeParts = time.split(":");
- int second = Integer.parseInt(timeParts[2]);
- int minute = Integer.parseInt(timeParts[1]);
- int hour = Integer.parseInt(timeParts[0]);
- String cronExpression = String.format("%d %d %d * * ?", second, minute, hour);
-
- // 3. 构建JobDetail(绑定指定的Job类,唯一标识:jobName=时间+分组,jobGroup=传入的分组)
- String jobName = jobGroup + "_" + time;
- JobDetail jobDetail = JobBuilder.newJob(jobClass)
- .withIdentity(jobName, jobGroup) // 唯一标识:名称+分组,区分不同Job的任务
- .build();
-
- // 4. 构建Trigger(触发器)
- Trigger trigger = TriggerBuilder.newTrigger()
- .withIdentity("trigger_" + jobName, jobGroup)
- .withDescription(time)
- .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression))
- .build();
-
- // 5. 注册任务到调度器
- scheduler.scheduleJob(jobDetail, trigger);
- System.out.println("成功创建任务:[" + jobGroup + "] 每日" + time + "执行,Cron:" + cronExpression);
- }
- }
-
- /**
- * 停止指定分组的所有Job
- * @param jobGroup Job分组(如"dataSyncGroup")
- */
- public void pauseJobGroup(String jobGroup) throws SchedulerException {
- scheduler.pauseJobs(GroupMatcher.jobGroupEquals(jobGroup));
- System.out.println("已暂停分组[" + jobGroup + "]的所有任务");
- }
-
- /**
- * 启动指定分组的所有Job
- * @param jobGroup Job分组
- */
- public void resumeJobGroup(String jobGroup) throws SchedulerException {
- scheduler.resumeJobs(GroupMatcher.jobGroupEquals(jobGroup));
- System.out.println("已恢复分组[" + jobGroup + "]的所有任务");
- }
-
- /**
- * 删除指定分组的所有Job
- * @param jobGroup Job分组
- */
- public void deleteJobGroup(String jobGroup) throws SchedulerException {
- // 1. 获取指定分组下的所有TriggerKey(返回Set)
- Set triggerKeySet = scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(jobGroup));
- // 2. 将Set转换为List(使用Stream流,简洁高效)
- List triggerKeyList = new ArrayList<>(triggerKeySet);
- // 3. 取消触发器(此时需要List参数)
- scheduler.unscheduleJobs(triggerKeyList);
- // 4. 删除指定分组下的所有Job(getJobKeys返回Set,但deleteJobs支持Collection,List/Set都可以)
- Set jobKeySet = scheduler.getJobKeys(GroupMatcher.jobGroupEquals(jobGroup));
- scheduler.deleteJobs(new ArrayList<>(jobKeySet));
- System.out.println("已删除分组[" + jobGroup + "]的所有任务");
- }
-
-}
\ No newline at end of file
+//package com.sdm.project.manager;
+//
+//import org.quartz.*;
+//import org.quartz.impl.matchers.GroupMatcher;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.cloud.context.config.annotation.RefreshScope;
+//import org.springframework.stereotype.Component;
+//import java.text.ParseException;
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.Set;
+//import java.util.stream.Collectors;
+//
+///**
+// * 通用定时任务管理类:支持管理多个不同的Job
+// */
+//@Component
+//public class MultiJobManager {
+//
+// @Autowired
+// private Scheduler scheduler;
+//
+//
+// /**
+// * 创建指定Job的定时任务
+// * @param jobClass 要执行的Job类(比如DataSyncJob.class、MessagePushJob.class)
+// * @param jobGroup Job分组(区分不同Job,比如"dataSyncGroup"、"messagePushGroup")
+// * @param timeList 执行时间数组(如["15:00:00","16:00:00"])
+// */
+// public void createJob(Class extends Job> jobClass, String jobGroup, List timeList) throws SchedulerException, ParseException {
+// // 遍历时间数组,为当前Job创建多个定时触发器
+// for (String time : timeList) {
+// // 1. 校验时间格式
+// if (!time.matches("^\\d{2}:\\d{2}:\\d{2}$")) {
+// throw new IllegalArgumentException("时间格式错误:" + time + ",请使用HH:mm:ss格式");
+// }
+//
+// // 2. 拆分时分秒,构建Cron表达式
+// String[] timeParts = time.split(":");
+// int second = Integer.parseInt(timeParts[2]);
+// int minute = Integer.parseInt(timeParts[1]);
+// int hour = Integer.parseInt(timeParts[0]);
+// String cronExpression = String.format("%d %d %d * * ?", second, minute, hour);
+//
+// // 3. 构建JobDetail(绑定指定的Job类,唯一标识:jobName=时间+分组,jobGroup=传入的分组)
+// String jobName = jobGroup + "_" + time;
+// JobDetail jobDetail = JobBuilder.newJob(jobClass)
+// .withIdentity(jobName, jobGroup) // 唯一标识:名称+分组,区分不同Job的任务
+// .build();
+//
+// // 4. 构建Trigger(触发器)
+// Trigger trigger = TriggerBuilder.newTrigger()
+// .withIdentity("trigger_" + jobName, jobGroup)
+// .withDescription(time)
+// .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression))
+// .build();
+//
+// // 5. 注册任务到调度器
+// scheduler.scheduleJob(jobDetail, trigger);
+// System.out.println("成功创建任务:[" + jobGroup + "] 每日" + time + "执行,Cron:" + cronExpression);
+// }
+// }
+//
+// /**
+// * 停止指定分组的所有Job
+// * @param jobGroup Job分组(如"dataSyncGroup")
+// */
+// public void pauseJobGroup(String jobGroup) throws SchedulerException {
+// scheduler.pauseJobs(GroupMatcher.jobGroupEquals(jobGroup));
+// System.out.println("已暂停分组[" + jobGroup + "]的所有任务");
+// }
+//
+// /**
+// * 启动指定分组的所有Job
+// * @param jobGroup Job分组
+// */
+// public void resumeJobGroup(String jobGroup) throws SchedulerException {
+// scheduler.resumeJobs(GroupMatcher.jobGroupEquals(jobGroup));
+// System.out.println("已恢复分组[" + jobGroup + "]的所有任务");
+// }
+//
+// /**
+// * 删除指定分组的所有Job
+// * @param jobGroup Job分组
+// */
+// public void deleteJobGroup(String jobGroup) throws SchedulerException {
+// // 1. 获取指定分组下的所有TriggerKey(返回Set)
+// Set triggerKeySet = scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(jobGroup));
+// // 2. 将Set转换为List(使用Stream流,简洁高效)
+// List triggerKeyList = new ArrayList<>(triggerKeySet);
+// // 3. 取消触发器(此时需要List参数)
+// scheduler.unscheduleJobs(triggerKeyList);
+// // 4. 删除指定分组下的所有Job(getJobKeys返回Set,但deleteJobs支持Collection,List/Set都可以)
+// Set jobKeySet = scheduler.getJobKeys(GroupMatcher.jobGroupEquals(jobGroup));
+// scheduler.deleteJobs(new ArrayList<>(jobKeySet));
+// System.out.println("已删除分组[" + jobGroup + "]的所有任务");
+// }
+//
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/manager/MultiJobStartupRunner.java b/project/src/main/java/com/sdm/project/manager/MultiJobStartupRunner.java
index 62769e95..7e770ca8 100644
--- a/project/src/main/java/com/sdm/project/manager/MultiJobStartupRunner.java
+++ b/project/src/main/java/com/sdm/project/manager/MultiJobStartupRunner.java
@@ -1,48 +1,48 @@
-package com.sdm.project.manager;
-
-import com.sdm.project.job.ProjectSyncJob;
-import com.sdm.project.job.TodoSyncJob;
-import com.sdm.project.model.entity.SimulationProjectSchedulerConfig;
-import com.sdm.project.model.entity.SimulationTodoSchedulerConfig;
-import com.sdm.project.service.ISimulationProjectSchedulerConfigService;
-import com.sdm.project.service.ISimulationTodoSchedulerConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.stereotype.Component;
-
-import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * 应用启动时自动初始化两个Job
- */
-@Component
-public class MultiJobStartupRunner implements CommandLineRunner {
-
- private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
-
- @Autowired
- private MultiJobManager multiJobManager;
-
- @Value("${scheduler.todo}")
- private String schedulerTodoTime;
-
- @Value("${scheduler.project}")
- private String schedulerProjectTime;
-
- @Override
- public void run(String... args) throws Exception {
- // ========== 初始化第一个Job:待办同步任务 ==========
- schedulerTodoTime = schedulerTodoTime.replaceAll("\\.",":");
- schedulerProjectTime = schedulerProjectTime.replaceAll("\\.",":");
- multiJobManager.createJob(TodoSyncJob.class, "todoSyncJob", Collections.singletonList(schedulerTodoTime));
-
- // ========== 初始化第二个Job:项目同步任务 ==========
- multiJobManager.createJob(ProjectSyncJob.class, "projectSyncJob", Collections.singletonList(schedulerProjectTime));
-
- System.out.println("应用启动成功!已初始化两个Job:待办同步任务、项目同步任务");
- }
-}
\ No newline at end of file
+//package com.sdm.project.manager;
+//
+//import com.sdm.project.job.ProjectSyncJob;
+//import com.sdm.project.job.TodoSyncJob;
+//import com.sdm.project.model.entity.SimulationProjectSchedulerConfig;
+//import com.sdm.project.model.entity.SimulationTodoSchedulerConfig;
+//import com.sdm.project.service.ISimulationProjectSchedulerConfigService;
+//import com.sdm.project.service.ISimulationTodoSchedulerConfigService;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.boot.CommandLineRunner;
+//import org.springframework.stereotype.Component;
+//
+//import java.time.format.DateTimeFormatter;
+//import java.util.Arrays;
+//import java.util.Collections;
+//import java.util.List;
+//
+///**
+// * 应用启动时自动初始化两个Job
+// */
+//@Component
+//public class MultiJobStartupRunner implements CommandLineRunner {
+//
+// private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
+//
+// @Autowired
+// private MultiJobManager multiJobManager;
+//
+// @Value("${scheduler.todo}")
+// private String schedulerTodoTime;
+//
+// @Value("${scheduler.project}")
+// private String schedulerProjectTime;
+//
+// @Override
+// public void run(String... args) throws Exception {
+// // ========== 初始化第一个Job:待办同步任务 ==========
+// schedulerTodoTime = schedulerTodoTime.replaceAll("\\.",":");
+// schedulerProjectTime = schedulerProjectTime.replaceAll("\\.",":");
+// multiJobManager.createJob(TodoSyncJob.class, "todoSyncJob", Collections.singletonList(schedulerTodoTime));
+//
+// // ========== 初始化第二个Job:项目同步任务 ==========
+// multiJobManager.createJob(ProjectSyncJob.class, "projectSyncJob", Collections.singletonList(schedulerProjectTime));
+//
+// System.out.println("应用启动成功!已初始化两个Job:待办同步任务、项目同步任务");
+// }
+//}
\ No newline at end of file
diff --git a/project/src/main/java/com/sdm/project/model/entity/SimulationNode.java b/project/src/main/java/com/sdm/project/model/entity/SimulationNode.java
index b1bf057d..fc7c3280 100644
--- a/project/src/main/java/com/sdm/project/model/entity/SimulationNode.java
+++ b/project/src/main/java/com/sdm/project/model/entity/SimulationNode.java
@@ -146,4 +146,10 @@ public class SimulationNode implements Serializable {
@TableField("approval_status")
private String approvalStatus;
+ @TableField("projectId")
+ private Integer projectId;
+
+ @TableField("projectSource")
+ private String projectSource;
+
}
diff --git a/project/src/main/java/com/sdm/project/model/req/SpdmAddDemandReq.java b/project/src/main/java/com/sdm/project/model/req/SpdmAddDemandReq.java
index 1061fae1..d4e42bb1 100644
--- a/project/src/main/java/com/sdm/project/model/req/SpdmAddDemandReq.java
+++ b/project/src/main/java/com/sdm/project/model/req/SpdmAddDemandReq.java
@@ -123,6 +123,14 @@ public class SpdmAddDemandReq extends BaseEntity {
@JsonProperty(value = "aMemberList")
private String aMemberList;
+ /**
+ * hash值,同步待办时判断是否需要更新
+ */
+ private String contentHash;
+ /**
+ * hash值,同步待办时判断是否需要更新
+ */
+ private String demandSource;
}
diff --git a/project/src/main/java/com/sdm/project/model/req/SpdmProjectNodeEditReq.java b/project/src/main/java/com/sdm/project/model/req/SpdmProjectNodeEditReq.java
index 385d74c2..7c0f5b01 100644
--- a/project/src/main/java/com/sdm/project/model/req/SpdmProjectNodeEditReq.java
+++ b/project/src/main/java/com/sdm/project/model/req/SpdmProjectNodeEditReq.java
@@ -133,4 +133,8 @@ public class SpdmProjectNodeEditReq extends BaseEntity {
private List extras;
private String englishName;
private String parentId;
+
+ private Integer projectId;
+
+ private String projectSource = "";
}
diff --git a/project/src/main/java/com/sdm/project/model/req/ep/EpProjectQueryReq.java b/project/src/main/java/com/sdm/project/model/req/ep/EpProjectQueryReq.java
new file mode 100644
index 00000000..3cc829a4
--- /dev/null
+++ b/project/src/main/java/com/sdm/project/model/req/ep/EpProjectQueryReq.java
@@ -0,0 +1,21 @@
+package com.sdm.project.model.req.ep;
+
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class EpProjectQueryReq {
+
+ private String projectNum;
+
+ private String projectName;
+
+ private String difficultyType;
+
+ private Integer current;
+
+ private Integer pageSize;
+
+}
diff --git a/project/src/main/java/com/sdm/project/model/vo/SpdmDemandVo.java b/project/src/main/java/com/sdm/project/model/vo/SpdmDemandVo.java
index 916c25d0..97bffff4 100644
--- a/project/src/main/java/com/sdm/project/model/vo/SpdmDemandVo.java
+++ b/project/src/main/java/com/sdm/project/model/vo/SpdmDemandVo.java
@@ -124,4 +124,9 @@ public class SpdmDemandVo extends BaseEntity {
@JsonProperty(value = "aMemberList")
private List aMemberList;
+ /**
+ * hash值,同步待办时判断是否需要更新
+ */
+ private String demandSource;
+
}
diff --git a/project/src/main/java/com/sdm/project/model/vo/SpdmNodeVo.java b/project/src/main/java/com/sdm/project/model/vo/SpdmNodeVo.java
index 3b30714c..f5bb68c0 100644
--- a/project/src/main/java/com/sdm/project/model/vo/SpdmNodeVo.java
+++ b/project/src/main/java/com/sdm/project/model/vo/SpdmNodeVo.java
@@ -97,4 +97,7 @@ public class SpdmNodeVo extends BaseEntity {
private String parentId;
+ private Integer projectId;
+
+ private String projectSource;
}
diff --git a/project/src/main/java/com/sdm/project/service/ILyricInternalService.java b/project/src/main/java/com/sdm/project/service/ILyricInternalService.java
index ad19abd7..959758fa 100644
--- a/project/src/main/java/com/sdm/project/service/ILyricInternalService.java
+++ b/project/src/main/java/com/sdm/project/service/ILyricInternalService.java
@@ -3,6 +3,7 @@ package com.sdm.project.service;
import com.sdm.common.common.SdmResponse;
import com.sdm.outbridge.mode.GetProcessDataReq;
import com.sdm.project.model.req.PushReportReq;
+import com.sdm.project.model.req.ep.EpProjectQueryReq;
import org.springframework.web.bind.annotation.RequestParam;
public interface ILyricInternalService {
@@ -13,6 +14,10 @@ public interface ILyricInternalService {
SdmResponse getTodoList();
+ SdmResponse getTodoListByProjectNum(String projectNum);
+
+ SdmResponse getMainPlanListByProjectId(Integer projectId,String projectUuid);
+
SdmResponse getProjectList();
SdmResponse queryProjectPdt(String projectId,Integer current,Integer size);
@@ -24,4 +29,7 @@ public interface ILyricInternalService {
SdmResponse queryProjectBatch(String projectId,Integer current,Integer size);
SdmResponse queryProjectInfo(String projectId);
+
+ SdmResponse queryProjectInfoList(EpProjectQueryReq req);
+
}
diff --git a/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java
index 1e9d9b83..331b088c 100644
--- a/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java
+++ b/project/src/main/java/com/sdm/project/service/impl/LyricInternalServiceImpl.java
@@ -1,6 +1,8 @@
package com.sdm.project.service.impl;
import com.alibaba.fastjson2.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.common.ThreadLocalContext;
import com.sdm.common.entity.enums.DirTypeEnum;
@@ -10,6 +12,7 @@ import com.sdm.common.entity.req.data.CreateDirReq;
import com.sdm.common.entity.req.data.UpdatePermissionReq;
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
import com.sdm.common.utils.FilesUtil;
+import com.sdm.common.utils.PageUtils;
import com.sdm.common.utils.RandomUtil;
import com.sdm.outbridge.entity.*;
import com.sdm.outbridge.mode.GetProcessDataReq;
@@ -22,6 +25,7 @@ import com.sdm.project.model.req.PushReportReq;
import com.sdm.project.model.req.SpdmAddDemandReq;
import com.sdm.project.model.req.SpdmDemandExtraReq;
import com.sdm.project.model.req.SpdmDemandRelateMemberReq;
+import com.sdm.project.model.req.ep.EpProjectQueryReq;
import com.sdm.project.model.vo.SpdmDemandVo;
import com.sdm.project.service.ILyricInternalService;
import com.sdm.project.service.INodeService;
@@ -38,12 +42,12 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import static com.sdm.project.service.impl.NodeServiceImpl.SYNC_PROJECT_SOURCE;
+
@Service
@Slf4j
public class LyricInternalServiceImpl implements ILyricInternalService {
@@ -118,6 +122,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
/**
* 判断字符串是否可以安全转换为int类型
+ *
* @param str 待判断的字符串
* @return true-可以安全转换,false-不可以
*/
@@ -154,15 +159,302 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
@Override
public SdmResponse getTodoList() {
- // 查询第三方接口视图获取待办列表(需求)
- // 获取当天 0 点 0 分 0 秒
- LocalDateTime startTime = LocalDateTime.now().with(LocalTime.MIN);
- // 获取当前时间
- LocalDateTime endTime = LocalDateTime.now();
+ List nodeList = nodeService.lambdaQuery().eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).list();
+ if (CollectionUtils.isEmpty(nodeList)) {
+ log.info("getTodoList中nodeList为空");
+ return SdmResponse.success();
+ }
+ List nodeCodeList = nodeList.stream().map(SimulationNode::getNodeCode).toList();
+ log.info("nodeCodeList为:{}", nodeCodeList);
+ if (CollectionUtils.isEmpty(nodeCodeList)) {
+ log.info("getTodoList中nodeCodeList为空");
+ return SdmResponse.success();
+ }
// 查询
- List todoInfoList = lyricVTodoInfoService.lambdaQuery().ge(LyricVTodoEmulationInfoDM::getCreateTime, startTime).le(LyricVTodoEmulationInfoDM::getCreateTime, endTime)
+ List todoInfoList = lyricVTodoInfoService.lambdaQuery().in(LyricVTodoEmulationInfoDM::getProject, nodeCodeList)
.list();
// 过滤掉数据库中已经有的需求
+ if (CollectionUtils.isEmpty(todoInfoList)) {
+ log.info("未手动同步到待办");
+ return SdmResponse.success();
+ }
+ log.info("手动同步到{}条待办", todoInfoList.size());
+ List allDemandList = demandMapper.getAllList();
+ log.info("allDemandList:{}", allDemandList);
+ if (CollectionUtils.isNotEmpty(allDemandList)) {
+ List demandCodeList = allDemandList.stream().map(SpdmDemandVo::getDemandCode).toList();
+ todoInfoList = todoInfoList.stream().filter(todoInfo -> !demandCodeList.contains(String.valueOf(todoInfo.getTodoId()))).toList();
+ if (CollectionUtils.isEmpty(todoInfoList)) {
+ log.info("本次手动同步到的待办都已经进行过同步");
+ return SdmResponse.success();
+ }
+ }
+ Long tenantId = ThreadLocalContext.getTenantId();
+ Long jobNumber = ThreadLocalContext.getUserId();
+ String uuid;
+ String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
+ for (LyricVTodoEmulationInfoDM emulation : todoInfoList) {
+ try {
+ List extras = new ArrayList<>();
+ List allMemberList = new ArrayList<>();
+ // 需求的基础属性
+ SpdmAddDemandReq spdmAddDemandReq = new SpdmAddDemandReq();
+ uuid = RandomUtil.generateString(32);
+ spdmAddDemandReq.setUuid(uuid);
+ spdmAddDemandReq.setDemandName(emulation.getEmulationDemand());
+ if (ObjectUtils.isNotEmpty(emulation.getTodoId())) {
+ spdmAddDemandReq.setDemandCode(String.valueOf(emulation.getTodoId()));
+ }
+ spdmAddDemandReq.setDemandType(emulation.getEmulationType());
+ spdmAddDemandReq.setDemandStatus("0");
+ spdmAddDemandReq.setAchieveStatus("0");
+ spdmAddDemandReq.setProgress(0);
+ spdmAddDemandReq.setBeginTime(emulation.getPlanStartTime());
+ spdmAddDemandReq.setEndTime(emulation.getClosedTime());
+ spdmAddDemandReq.setProjectId(emulation.getProject());
+ spdmAddDemandReq.setPhaseId(emulation.getProjectStage());
+ spdmAddDemandReq.setDemandSource(SYNC_PROJECT_SOURCE);
+ // 需求的额外属性
+ SpdmDemandExtraReq extraReq1 = new SpdmDemandExtraReq();
+ extraReq1.setDemandId(uuid);
+ extraReq1.setPropertyName("emulationResult");
+ extraReq1.setPropertyValue(emulation.getEmulationResult());
+ extras.add(extraReq1);
+ SpdmDemandExtraReq extraReq2 = new SpdmDemandExtraReq();
+ extraReq2.setDemandId(uuid);
+ extraReq2.setPropertyName("robotBrand");
+ extraReq2.setPropertyValue(emulation.getRobotBrand());
+ extras.add(extraReq2);
+ SpdmDemandExtraReq extraReq3 = new SpdmDemandExtraReq();
+ extraReq3.setDemandId(uuid);
+ extraReq3.setPropertyName("axis");
+ extraReq3.setPropertyValue(emulation.getAxis());
+ extras.add(extraReq3);
+ SpdmDemandExtraReq extraReq4 = new SpdmDemandExtraReq();
+ extraReq4.setDemandId(uuid);
+ extraReq4.setPropertyName("beatRequirements");
+ extraReq4.setPropertyValue(emulation.getBeatRequirements());
+ extras.add(extraReq4);
+ SpdmDemandExtraReq extraReq5 = new SpdmDemandExtraReq();
+ extraReq5.setDemandId(uuid);
+ extraReq5.setPropertyName("threeDimensionalReposito");
+ extraReq5.setPropertyValue(emulation.getThreeDimensionalRepositoryPath());
+ extras.add(extraReq5);
+ SpdmDemandExtraReq extraReq6 = new SpdmDemandExtraReq();
+ extraReq6.setDemandId(uuid);
+ extraReq6.setPropertyName("resultPath");
+ extraReq6.setPropertyValue(emulation.getResultPath());
+ extras.add(extraReq6);
+ SpdmDemandExtraReq extraReq7 = new SpdmDemandExtraReq();
+ extraReq7.setDemandId(uuid);
+ extraReq7.setPropertyName("resultDescribe");
+ extraReq7.setPropertyValue(emulation.getResultDescribe());
+ extras.add(extraReq7);
+ SpdmDemandExtraReq extraReq8 = new SpdmDemandExtraReq();
+ extraReq8.setDemandId(uuid);
+ extraReq8.setPropertyName("analysisType");
+ extraReq8.setPropertyValue(emulation.getAnalysisType());
+ extras.add(extraReq8);
+ SpdmDemandExtraReq extraReq11 = new SpdmDemandExtraReq();
+ extraReq11.setDemandId(uuid);
+ extraReq11.setPropertyName("software");
+ extraReq11.setPropertyValue(emulation.getSoftware());
+ extras.add(extraReq11);
+ SpdmDemandExtraReq extraReq12 = new SpdmDemandExtraReq();
+ extraReq12.setDemandId(uuid);
+ extraReq12.setPropertyName("type");
+ extraReq12.setPropertyValue(emulation.getType());
+ extras.add(extraReq12);
+ SpdmDemandExtraReq extraReq13 = new SpdmDemandExtraReq();
+ extraReq13.setDemandId(uuid);
+ extraReq13.setPropertyName("resultFileId");
+ extraReq13.setPropertyValue(emulation.getResultFileId());
+ extras.add(extraReq13);
+ SpdmDemandExtraReq extraReq14 = new SpdmDemandExtraReq();
+ extraReq14.setDemandId(uuid);
+ extraReq14.setPropertyName("difficulty");
+ extraReq14.setPropertyValue(emulation.getDifficulty());
+ extras.add(extraReq14);
+ SpdmDemandExtraReq extraReq15 = new SpdmDemandExtraReq();
+ extraReq15.setDemandId(uuid);
+ extraReq15.setPropertyName("requiredTime");
+ extraReq15.setPropertyValue(emulation.getRequiredTime());
+ extras.add(extraReq15);
+ SpdmDemandExtraReq extraReq20 = new SpdmDemandExtraReq();
+ extraReq20.setDemandId(uuid);
+ extraReq20.setPropertyName("subject");
+ extraReq20.setPropertyValue(emulation.getSubject());
+ extras.add(extraReq20);
+ SpdmDemandExtraReq extraReq21 = new SpdmDemandExtraReq();
+ extraReq21.setDemandId(uuid);
+ extraReq21.setPropertyName("todoNum");
+ extraReq21.setPropertyValue(emulation.getTodoNum());
+ extras.add(extraReq21);
+ SpdmDemandExtraReq extraReq22 = new SpdmDemandExtraReq();
+ extraReq22.setDemandId(uuid);
+ extraReq22.setPropertyName("status");
+ extraReq22.setPropertyValue(emulation.getStatus());
+ extras.add(extraReq22);
+ SpdmDemandExtraReq extraReq26 = new SpdmDemandExtraReq();
+ extraReq26.setDemandId(uuid);
+ extraReq26.setPropertyName("projectName");
+ extraReq26.setPropertyValue(emulation.getProjectName());
+ extras.add(extraReq26);
+ SpdmDemandExtraReq extraReq27 = new SpdmDemandExtraReq();
+ extraReq27.setDemandId(uuid);
+ extraReq27.setPropertyName("projectModel");
+ extraReq27.setPropertyValue(emulation.getProjectModel());
+ extras.add(extraReq27);
+ SpdmDemandExtraReq extraReq28 = new SpdmDemandExtraReq();
+ extraReq28.setDemandId(uuid);
+ extraReq28.setPropertyName("projectType");
+ extraReq28.setPropertyValue(emulation.getProjectType());
+ extras.add(extraReq28);
+ SpdmDemandExtraReq extraReq31 = new SpdmDemandExtraReq();
+ extraReq31.setDemandId(uuid);
+ extraReq31.setPropertyName("stationNum");
+ extraReq31.setPropertyValue(emulation.getStationNum());
+ extras.add(extraReq31);
+ SpdmDemandExtraReq extraReq32 = new SpdmDemandExtraReq();
+ extraReq32.setDemandId(uuid);
+ extraReq32.setPropertyName("planStartTime");
+ extraReq32.setPropertyValue(emulation.getPlanStartTime());
+ extras.add(extraReq32);
+ SpdmDemandExtraReq extraReq33 = new SpdmDemandExtraReq();
+ extraReq33.setDemandId(uuid);
+ extraReq33.setPropertyName("requirementsTime");
+ extraReq33.setPropertyValue(emulation.getRequiredTime());
+ extras.add(extraReq33);
+ SpdmDemandExtraReq extraReq34 = new SpdmDemandExtraReq();
+ extraReq34.setDemandId(uuid);
+ extraReq34.setPropertyName("pausedTime");
+ extraReq34.setPropertyValue(emulation.getPausedTime());
+ extras.add(extraReq34);
+ SpdmDemandExtraReq extraReq35 = new SpdmDemandExtraReq();
+ extraReq35.setDemandId(uuid);
+ extraReq35.setPropertyName("performer");
+ extraReq35.setPropertyValue(emulation.getPerformer());
+ extras.add(extraReq35);
+ SpdmDemandExtraReq extraReq36 = new SpdmDemandExtraReq();
+ extraReq36.setDemandId(uuid);
+ extraReq36.setPropertyName("performerName");
+ extraReq36.setPropertyValue(emulation.getPerformerName());
+ extras.add(extraReq36);
+ SpdmDemandExtraReq extraReq37 = new SpdmDemandExtraReq();
+ extraReq37.setDemandId(uuid);
+ extraReq37.setPropertyName("verifier");
+ extraReq37.setPropertyValue(emulation.getVerifier());
+ extras.add(extraReq37);
+ SpdmDemandExtraReq extraReq39 = new SpdmDemandExtraReq();
+ extraReq39.setDemandId(uuid);
+ extraReq39.setPropertyName("workHourPlan");
+ extraReq39.setPropertyValue(emulation.getWorkHourPlan());
+ extras.add(extraReq39);
+ SpdmDemandExtraReq extraReq40 = new SpdmDemandExtraReq();
+ extraReq40.setDemandId(uuid);
+ extraReq40.setPropertyName("realWorkHour");
+ extraReq40.setPropertyValue(emulation.getRealWorkHour());
+ extras.add(extraReq40);
+ SpdmDemandExtraReq extraReq41 = new SpdmDemandExtraReq();
+ extraReq41.setDemandId(uuid);
+ extraReq41.setPropertyName("standardWorkHour");
+ extraReq41.setPropertyValue(emulation.getStandardWorkHour());
+ extras.add(extraReq41);
+ SpdmDemandExtraReq extraReq42 = new SpdmDemandExtraReq();
+ extraReq42.setDemandId(uuid);
+ extraReq42.setPropertyName("turnDownReason");
+ extraReq42.setPropertyValue(emulation.getTurnDownReason());
+ extras.add(extraReq42);
+
+ // 需求的成员
+ // 仿真负责人
+ String emulationPerformer = emulation.getEmulationPerformer();
+ if (StringUtils.isNotBlank(emulationPerformer)) {
+ SpdmDemandRelateMemberReq pMemberReq = new SpdmDemandRelateMemberReq();
+ pMemberReq.setDemandId(uuid);
+ pMemberReq.setType(0);
+ String pUserId = emulationPerformer.split("-")[0];
+ if (isConvertibleToLong(pUserId)) {
+ pMemberReq.setUserId(Long.valueOf(pUserId));
+ }
+ pMemberReq.setCreateTime(curDateStr);
+ pMemberReq.setCreator(jobNumber);
+ allMemberList.add(pMemberReq);
+ }
+
+ // 仿真执行人
+ String emulationExecutor = emulation.getEmulationExecutor();
+ if (StringUtils.isNotBlank(emulationExecutor)) {
+ SpdmDemandRelateMemberReq eMemberReq = new SpdmDemandRelateMemberReq();
+ eMemberReq.setDemandId(uuid);
+ eMemberReq.setType(1);
+ String eUserId = emulationExecutor.split("-")[0];
+ if (isConvertibleToLong(eUserId)) {
+ eMemberReq.setUserId(Long.valueOf(eUserId));
+ }
+ eMemberReq.setCreateTime(curDateStr);
+ eMemberReq.setCreator(jobNumber);
+ allMemberList.add(eMemberReq);
+ }
+
+ // 3D负责人
+ String threeDimensionalPerformer = emulation.getThreeDimensionalPerformer();
+ if (StringUtils.isNotBlank(emulationExecutor)) {
+ SpdmDemandRelateMemberReq tMemberReq = new SpdmDemandRelateMemberReq();
+ tMemberReq.setDemandId(uuid);
+ tMemberReq.setType(2);
+ String tUserId = threeDimensionalPerformer.split("-")[0];
+ if (isConvertibleToLong(tUserId)) {
+ tMemberReq.setUserId(Long.valueOf(tUserId));
+ }
+ tMemberReq.setCreateTime(curDateStr);
+ tMemberReq.setCreator(jobNumber);
+ allMemberList.add(tMemberReq);
+ }
+ demandMapper.addDemand(spdmAddDemandReq, tenantId, jobNumber);
+ // 更新文件权限
+ UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq();
+ updatePermissionReq.setUserId(jobNumber);
+ updatePermissionReq.setUuid(uuid);
+ Map userPermissions = new HashMap<>();
+ userPermissions.put(jobNumber, FilePermissionEnum.ALL.getValue());
+ updatePermissionReq.setUserPermissions(userPermissions);
+ log.info("手动同步需求时,更新用户权限的参数为:{}", updatePermissionReq);
+ SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
+ log.info("手动同步需求时,更新用户权限的返回值为:{}", updatePermissionResponse);
+ demandMapper.addDemandMember(allMemberList);
+ for (SpdmDemandExtraReq extra : extras) {
+ extra.setCreateTime(curDateStr);
+ extra.setCreator(jobNumber);
+ }
+ demandMapper.addDemandExtra(extras);
+ CreateDirReq createDirReq = new CreateDirReq();
+ createDirReq.setUuId(uuid);
+ createDirReq.setParentUuId(null);
+ createDirReq.setDirName(spdmAddDemandReq.getDemandName());
+ createDirReq.setDirType(DirTypeEnum.PROJECT_NODE_DIR.getValue());
+ log.info("手动同步待办创建需求时,调用创建文件夹的参数为:{}", createDirReq);
+ SdmResponse response = dataFeignClient.createDir(createDirReq);
+ log.info("手动同步代办创建需求时,调用创建文件夹的返回值为:{}", response);
+ } catch (Exception e) {
+ log.error("手动同步代办时有异常:{}", e.getMessage());
+ }
+ }
+ return SdmResponse.success();
+ }
+
+ @Override
+ public SdmResponse getTodoListByProjectNum(String projectNum) {
+ log.info("同步代办时,项目号为:{}", projectNum);
+ if (StringUtils.isBlank(projectNum)) {
+ log.error("同步待办时,项目号不能为空");
+ return SdmResponse.failed("同步待办时,项目号不能为空");
+ }
+ // 查询
+ List todoInfoList = lyricVTodoInfoService.lambdaQuery().eq(LyricVTodoEmulationInfoDM::getProject, projectNum)
+ .list();
+ log.info("同步代办时,todoInfoList:{}", todoInfoList);
+ // 过滤掉数据库中已经有的需求
if (CollectionUtils.isEmpty(todoInfoList)) {
log.info("未同步到待办");
return SdmResponse.success();
@@ -182,389 +474,307 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
String uuid;
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
for (LyricVTodoEmulationInfoDM emulation : todoInfoList) {
- List extras = new ArrayList<>();
- List allMemberList = new ArrayList<>();
- // 需求的基础属性
- SpdmAddDemandReq spdmAddDemandReq = new SpdmAddDemandReq();
- uuid = RandomUtil.generateString(32);
- spdmAddDemandReq.setUuid(uuid);
- spdmAddDemandReq.setDemandName(emulation.getEmulationDemand());
- if (ObjectUtils.isNotEmpty(emulation.getTodoId())) {
- spdmAddDemandReq.setDemandCode(String.valueOf(emulation.getTodoId()));
- }
- spdmAddDemandReq.setDemandType(emulation.getEmulationType());
- spdmAddDemandReq.setDemandStatus("0");
- spdmAddDemandReq.setAchieveStatus("0");
- spdmAddDemandReq.setProgress(0);
- spdmAddDemandReq.setBeginTime(emulation.getPlanStartTime());
- spdmAddDemandReq.setEndTime(emulation.getClosedTime());
- spdmAddDemandReq.setProjectId(emulation.getProject());
- spdmAddDemandReq.setPhaseId(emulation.getProjectStage());
-// demandReqList.add(spdmAddDemandReq);
- // 需求的额外属性
- SpdmDemandExtraReq extraReq1 = new SpdmDemandExtraReq();
- extraReq1.setDemandId(uuid);
- extraReq1.setPropertyName("emulationResult");
- extraReq1.setPropertyValue(emulation.getEmulationResult());
- extras.add(extraReq1);
- SpdmDemandExtraReq extraReq2 = new SpdmDemandExtraReq();
- extraReq2.setDemandId(uuid);
- extraReq2.setPropertyName("robotBrand");
- extraReq2.setPropertyValue(emulation.getRobotBrand());
- extras.add(extraReq2);
- SpdmDemandExtraReq extraReq3 = new SpdmDemandExtraReq();
- extraReq3.setDemandId(uuid);
- extraReq3.setPropertyName("axis");
- extraReq3.setPropertyValue(emulation.getAxis());
- extras.add(extraReq3);
- SpdmDemandExtraReq extraReq4 = new SpdmDemandExtraReq();
- extraReq4.setDemandId(uuid);
- extraReq4.setPropertyName("beatRequirements");
- extraReq4.setPropertyValue(emulation.getBeatRequirements());
- extras.add(extraReq4);
- SpdmDemandExtraReq extraReq5 = new SpdmDemandExtraReq();
- extraReq5.setDemandId(uuid);
- extraReq5.setPropertyName("threeDimensionalReposito");
- extraReq5.setPropertyValue(emulation.getThreeDimensionalRepositoryPath());
- extras.add(extraReq5);
- SpdmDemandExtraReq extraReq6 = new SpdmDemandExtraReq();
- extraReq6.setDemandId(uuid);
- extraReq6.setPropertyName("resultPath");
- extraReq6.setPropertyValue(emulation.getResultPath());
- extras.add(extraReq6);
- SpdmDemandExtraReq extraReq7 = new SpdmDemandExtraReq();
- extraReq7.setDemandId(uuid);
- extraReq7.setPropertyName("resultDescribe");
- extraReq7.setPropertyValue(emulation.getResultDescribe());
- extras.add(extraReq7);
- SpdmDemandExtraReq extraReq8 = new SpdmDemandExtraReq();
- extraReq8.setDemandId(uuid);
- extraReq8.setPropertyName("analysisType");
- extraReq8.setPropertyValue(emulation.getAnalysisType());
- extras.add(extraReq8);
- SpdmDemandExtraReq extraReq9 = new SpdmDemandExtraReq();
- extraReq9.setDemandId(uuid);
- extraReq9.setPropertyName("analysisNum");
- if (ObjectUtils.isNotEmpty(emulation.getAnalysisNum())) {
- extraReq9.setPropertyValue(String.valueOf(emulation.getAnalysisNum()));
- }
- extras.add(extraReq9);
- SpdmDemandExtraReq extraReq10 = new SpdmDemandExtraReq();
- extraReq10.setDemandId(uuid);
- extraReq10.setPropertyName("emulationTime");
- if (ObjectUtils.isNotEmpty(emulation.getEmulationTime())) {
- extraReq10.setPropertyValue(String.valueOf(emulation.getEmulationTime()));
- }
- extras.add(extraReq10);
- SpdmDemandExtraReq extraReq11 = new SpdmDemandExtraReq();
- extraReq11.setDemandId(uuid);
- extraReq11.setPropertyName("software");
- extraReq11.setPropertyValue(emulation.getSoftware());
- extras.add(extraReq11);
- SpdmDemandExtraReq extraReq12 = new SpdmDemandExtraReq();
- extraReq12.setDemandId(uuid);
- extraReq12.setPropertyName("type");
- extraReq12.setPropertyValue(emulation.getType());
- extras.add(extraReq12);
- SpdmDemandExtraReq extraReq13 = new SpdmDemandExtraReq();
- extraReq13.setDemandId(uuid);
- extraReq13.setPropertyName("resultFileId");
- extraReq13.setPropertyValue(emulation.getResultFileId());
- extras.add(extraReq13);
- SpdmDemandExtraReq extraReq14 = new SpdmDemandExtraReq();
- extraReq14.setDemandId(uuid);
- extraReq14.setPropertyName("difficulty");
- extraReq14.setPropertyValue(emulation.getDifficulty());
- extras.add(extraReq14);
- SpdmDemandExtraReq extraReq15 = new SpdmDemandExtraReq();
- extraReq15.setDemandId(uuid);
- extraReq15.setPropertyName("requiredTime");
- extraReq15.setPropertyValue(emulation.getRequiredTime());
- extras.add(extraReq15);
- SpdmDemandExtraReq extraReq16 = new SpdmDemandExtraReq();
- extraReq16.setDemandId(uuid);
- extraReq16.setPropertyName("isLongTerm");
- if (ObjectUtils.isNotEmpty(emulation.getIsLongTerm())) {
- extraReq16.setPropertyValue(String.valueOf(emulation.getIsLongTerm()));
- }
- extras.add(extraReq16);
- SpdmDemandExtraReq extraReq17 = new SpdmDemandExtraReq();
- extraReq17.setDemandId(uuid);
- extraReq17.setPropertyName("animationUse");
- extraReq17.setPropertyValue(emulation.getAnimationUse());
- extras.add(extraReq17);
- SpdmDemandExtraReq extraReq18 = new SpdmDemandExtraReq();
- extraReq18.setDemandId(uuid);
- extraReq18.setPropertyName("limitedUse");
- extraReq18.setPropertyValue(emulation.getLimitedUse());
- extras.add(extraReq18);
- SpdmDemandExtraReq extraReq19 = new SpdmDemandExtraReq();
- extraReq19.setDemandId(uuid);
- extraReq19.setPropertyName("emergencyStatement");
- extraReq19.setPropertyValue(emulation.getEmergencyStatement());
- extras.add(extraReq19);
- SpdmDemandExtraReq extraReq20 = new SpdmDemandExtraReq();
- extraReq20.setDemandId(uuid);
- extraReq20.setPropertyName("subject");
- extraReq20.setPropertyValue(emulation.getSubject());
- extras.add(extraReq20);
- SpdmDemandExtraReq extraReq21 = new SpdmDemandExtraReq();
- extraReq21.setDemandId(uuid);
- extraReq21.setPropertyName("todoNum");
- extraReq21.setPropertyValue(emulation.getTodoNum());
- extras.add(extraReq21);
- SpdmDemandExtraReq extraReq22 = new SpdmDemandExtraReq();
- extraReq22.setDemandId(uuid);
- extraReq22.setPropertyName("status");
- extraReq22.setPropertyValue(emulation.getStatus());
- extras.add(extraReq22);
- SpdmDemandExtraReq extraReq23 = new SpdmDemandExtraReq();
- extraReq23.setDemandId(uuid);
- extraReq23.setPropertyName("describes");
- extraReq23.setPropertyValue(emulation.getDescribes());
- extras.add(extraReq23);
- SpdmDemandExtraReq extraReq24 = new SpdmDemandExtraReq();
- extraReq24.setDemandId(uuid);
- extraReq24.setPropertyName("progress");
- extraReq24.setPropertyValue(emulation.getProgress());
- extras.add(extraReq24);
- SpdmDemandExtraReq extraReq25 = new SpdmDemandExtraReq();
- extraReq25.setDemandId(uuid);
- extraReq25.setPropertyName("progressDescription");
- extraReq25.setPropertyValue(emulation.getProgressDescription());
- extras.add(extraReq25);
- SpdmDemandExtraReq extraReq26 = new SpdmDemandExtraReq();
- extraReq26.setDemandId(uuid);
- extraReq26.setPropertyName("projectName");
- extraReq26.setPropertyValue(emulation.getProjectName());
- extras.add(extraReq26);
- SpdmDemandExtraReq extraReq27 = new SpdmDemandExtraReq();
- extraReq27.setDemandId(uuid);
- extraReq27.setPropertyName("projectModel");
- extraReq27.setPropertyValue(emulation.getProjectModel());
- extras.add(extraReq27);
- SpdmDemandExtraReq extraReq28 = new SpdmDemandExtraReq();
- extraReq28.setDemandId(uuid);
- extraReq28.setPropertyName("projectType");
- extraReq28.setPropertyValue(emulation.getProjectType());
- extras.add(extraReq28);
-// SpdmDemandExtraReq extraReq29 = new SpdmDemandExtraReq();
-// extraReq29.setDemandId(uuid);
-// extraReq29.setPropertyName("produceLine");
-// extraReq29.setPropertyValue("");
-// extras.add(extraReq29);
-// SpdmDemandExtraReq extraReq30 = new SpdmDemandExtraReq();
-// extraReq30.setDemandId(uuid);
-// extraReq30.setPropertyName("produceGroup");
-// extraReq30.setPropertyValue("");
-// extras.add(extraReq30);
- SpdmDemandExtraReq extraReq31 = new SpdmDemandExtraReq();
- extraReq31.setDemandId(uuid);
- extraReq31.setPropertyName("stationNum");
- extraReq31.setPropertyValue(emulation.getStationNum());
- extras.add(extraReq31);
- SpdmDemandExtraReq extraReq32 = new SpdmDemandExtraReq();
- extraReq32.setDemandId(uuid);
- extraReq32.setPropertyName("planStartTime");
- extraReq32.setPropertyValue(emulation.getPlanStartTime());
- extras.add(extraReq32);
- SpdmDemandExtraReq extraReq33 = new SpdmDemandExtraReq();
- extraReq33.setDemandId(uuid);
- extraReq33.setPropertyName("requirementsTime");
- extraReq33.setPropertyValue(emulation.getRequiredTime());
- extras.add(extraReq33);
- SpdmDemandExtraReq extraReq34 = new SpdmDemandExtraReq();
- extraReq34.setDemandId(uuid);
- extraReq34.setPropertyName("pausedTime");
- extraReq34.setPropertyValue(emulation.getPausedTime());
- extras.add(extraReq34);
- SpdmDemandExtraReq extraReq35 = new SpdmDemandExtraReq();
- extraReq35.setDemandId(uuid);
- extraReq35.setPropertyName("performer");
- extraReq35.setPropertyValue(emulation.getPerformer());
- extras.add(extraReq35);
- SpdmDemandExtraReq extraReq36 = new SpdmDemandExtraReq();
- extraReq36.setDemandId(uuid);
- extraReq36.setPropertyName("performerName");
- extraReq36.setPropertyValue(emulation.getPerformerName());
- extras.add(extraReq36);
- SpdmDemandExtraReq extraReq37 = new SpdmDemandExtraReq();
- extraReq37.setDemandId(uuid);
- extraReq37.setPropertyName("verifier");
- extraReq37.setPropertyValue(emulation.getVerifier());
- extras.add(extraReq37);
-// SpdmDemandExtraReq extraReq38 = new SpdmDemandExtraReq();
-// extraReq38.setDemandId(uuid);
-// extraReq38.setPropertyName("introduceBy");
-// extraReq38.setPropertyValue(emulation.getIntroduceBy());
-// extras.add(extraReq38);
- SpdmDemandExtraReq extraReq39 = new SpdmDemandExtraReq();
- extraReq39.setDemandId(uuid);
- extraReq39.setPropertyName("workHourPlan");
- extraReq39.setPropertyValue(emulation.getWorkHourPlan());
- extras.add(extraReq39);
- SpdmDemandExtraReq extraReq40 = new SpdmDemandExtraReq();
- extraReq40.setDemandId(uuid);
- extraReq40.setPropertyName("realWorkHour");
- extraReq40.setPropertyValue(emulation.getRealWorkHour());
- extras.add(extraReq40);
- SpdmDemandExtraReq extraReq41 = new SpdmDemandExtraReq();
- extraReq41.setDemandId(uuid);
- extraReq41.setPropertyName("standardWorkHour");
- extraReq41.setPropertyValue(emulation.getStandardWorkHour());
- extras.add(extraReq41);
- SpdmDemandExtraReq extraReq42 = new SpdmDemandExtraReq();
- extraReq42.setDemandId(uuid);
- extraReq42.setPropertyName("turnDownReason");
- extraReq42.setPropertyValue(emulation.getTurnDownReason());
- extras.add(extraReq42);
-
-
- // 需求的成员
- // 仿真负责人
- String emulationPerformer = emulation.getEmulationPerformer();
- if (StringUtils.isNotBlank(emulationPerformer)) {
- SpdmDemandRelateMemberReq pMemberReq = new SpdmDemandRelateMemberReq();
- pMemberReq.setDemandId(uuid);
- pMemberReq.setType(0);
- String pUserId = emulationPerformer.split("-")[0];
- if (isConvertibleToLong(pUserId)) {
- pMemberReq.setUserId(Long.valueOf(pUserId));
+ try {
+ List extras = new ArrayList<>();
+ List allMemberList = new ArrayList<>();
+ // 需求的基础属性
+ SpdmAddDemandReq spdmAddDemandReq = new SpdmAddDemandReq();
+ uuid = RandomUtil.generateString(32);
+ spdmAddDemandReq.setUuid(uuid);
+ spdmAddDemandReq.setDemandName(emulation.getEmulationDemand());
+ if (ObjectUtils.isNotEmpty(emulation.getTodoId())) {
+ spdmAddDemandReq.setDemandCode(String.valueOf(emulation.getTodoId()));
}
- pMemberReq.setCreateTime(curDateStr);
- pMemberReq.setCreator(jobNumber);
- allMemberList.add(pMemberReq);
- }
+ spdmAddDemandReq.setDemandType(emulation.getEmulationType());
+ spdmAddDemandReq.setDemandStatus("0");
+ spdmAddDemandReq.setAchieveStatus("0");
+ spdmAddDemandReq.setProgress(0);
+ spdmAddDemandReq.setBeginTime(emulation.getPlanStartTime());
+ spdmAddDemandReq.setEndTime(emulation.getClosedTime());
+ spdmAddDemandReq.setProjectId(emulation.getProject());
+ spdmAddDemandReq.setPhaseId(emulation.getProjectStage());
+ spdmAddDemandReq.setDemandSource(SYNC_PROJECT_SOURCE);
+ // 需求的额外属性
+ SpdmDemandExtraReq extraReq1 = new SpdmDemandExtraReq();
+ extraReq1.setDemandId(uuid);
+ extraReq1.setPropertyName("emulationResult");
+ extraReq1.setPropertyValue(emulation.getEmulationResult());
+ extras.add(extraReq1);
+ SpdmDemandExtraReq extraReq2 = new SpdmDemandExtraReq();
+ extraReq2.setDemandId(uuid);
+ extraReq2.setPropertyName("robotBrand");
+ extraReq2.setPropertyValue(emulation.getRobotBrand());
+ extras.add(extraReq2);
+ SpdmDemandExtraReq extraReq3 = new SpdmDemandExtraReq();
+ extraReq3.setDemandId(uuid);
+ extraReq3.setPropertyName("axis");
+ extraReq3.setPropertyValue(emulation.getAxis());
+ extras.add(extraReq3);
+ SpdmDemandExtraReq extraReq4 = new SpdmDemandExtraReq();
+ extraReq4.setDemandId(uuid);
+ extraReq4.setPropertyName("beatRequirements");
+ extraReq4.setPropertyValue(emulation.getBeatRequirements());
+ extras.add(extraReq4);
+ SpdmDemandExtraReq extraReq5 = new SpdmDemandExtraReq();
+ extraReq5.setDemandId(uuid);
+ extraReq5.setPropertyName("threeDimensionalReposito");
+ extraReq5.setPropertyValue(emulation.getThreeDimensionalRepositoryPath());
+ extras.add(extraReq5);
+ SpdmDemandExtraReq extraReq6 = new SpdmDemandExtraReq();
+ extraReq6.setDemandId(uuid);
+ extraReq6.setPropertyName("resultPath");
+ extraReq6.setPropertyValue(emulation.getResultPath());
+ extras.add(extraReq6);
+ SpdmDemandExtraReq extraReq7 = new SpdmDemandExtraReq();
+ extraReq7.setDemandId(uuid);
+ extraReq7.setPropertyName("resultDescribe");
+ extraReq7.setPropertyValue(emulation.getResultDescribe());
+ extras.add(extraReq7);
+ SpdmDemandExtraReq extraReq8 = new SpdmDemandExtraReq();
+ extraReq8.setDemandId(uuid);
+ extraReq8.setPropertyName("analysisType");
+ extraReq8.setPropertyValue(emulation.getAnalysisType());
+ extras.add(extraReq8);
+ SpdmDemandExtraReq extraReq11 = new SpdmDemandExtraReq();
+ extraReq11.setDemandId(uuid);
+ extraReq11.setPropertyName("software");
+ extraReq11.setPropertyValue(emulation.getSoftware());
+ extras.add(extraReq11);
+ SpdmDemandExtraReq extraReq12 = new SpdmDemandExtraReq();
+ extraReq12.setDemandId(uuid);
+ extraReq12.setPropertyName("type");
+ extraReq12.setPropertyValue(emulation.getType());
+ extras.add(extraReq12);
+ SpdmDemandExtraReq extraReq13 = new SpdmDemandExtraReq();
+ extraReq13.setDemandId(uuid);
+ extraReq13.setPropertyName("resultFileId");
+ extraReq13.setPropertyValue(emulation.getResultFileId());
+ extras.add(extraReq13);
+ SpdmDemandExtraReq extraReq14 = new SpdmDemandExtraReq();
+ extraReq14.setDemandId(uuid);
+ extraReq14.setPropertyName("difficulty");
+ extraReq14.setPropertyValue(emulation.getDifficulty());
+ extras.add(extraReq14);
+ SpdmDemandExtraReq extraReq15 = new SpdmDemandExtraReq();
+ extraReq15.setDemandId(uuid);
+ extraReq15.setPropertyName("requiredTime");
+ extraReq15.setPropertyValue(emulation.getRequiredTime());
+ extras.add(extraReq15);
+ SpdmDemandExtraReq extraReq20 = new SpdmDemandExtraReq();
+ extraReq20.setDemandId(uuid);
+ extraReq20.setPropertyName("subject");
+ extraReq20.setPropertyValue(emulation.getSubject());
+ extras.add(extraReq20);
+ SpdmDemandExtraReq extraReq21 = new SpdmDemandExtraReq();
+ extraReq21.setDemandId(uuid);
+ extraReq21.setPropertyName("todoNum");
+ extraReq21.setPropertyValue(emulation.getTodoNum());
+ extras.add(extraReq21);
+ SpdmDemandExtraReq extraReq22 = new SpdmDemandExtraReq();
+ extraReq22.setDemandId(uuid);
+ extraReq22.setPropertyName("status");
+ extraReq22.setPropertyValue(emulation.getStatus());
+ extras.add(extraReq22);
+ SpdmDemandExtraReq extraReq26 = new SpdmDemandExtraReq();
+ extraReq26.setDemandId(uuid);
+ extraReq26.setPropertyName("projectName");
+ extraReq26.setPropertyValue(emulation.getProjectName());
+ extras.add(extraReq26);
+ SpdmDemandExtraReq extraReq27 = new SpdmDemandExtraReq();
+ extraReq27.setDemandId(uuid);
+ extraReq27.setPropertyName("projectModel");
+ extraReq27.setPropertyValue(emulation.getProjectModel());
+ extras.add(extraReq27);
+ SpdmDemandExtraReq extraReq28 = new SpdmDemandExtraReq();
+ extraReq28.setDemandId(uuid);
+ extraReq28.setPropertyName("projectType");
+ extraReq28.setPropertyValue(emulation.getProjectType());
+ extras.add(extraReq28);
+ SpdmDemandExtraReq extraReq31 = new SpdmDemandExtraReq();
+ extraReq31.setDemandId(uuid);
+ extraReq31.setPropertyName("stationNum");
+ extraReq31.setPropertyValue(emulation.getStationNum());
+ extras.add(extraReq31);
+ SpdmDemandExtraReq extraReq32 = new SpdmDemandExtraReq();
+ extraReq32.setDemandId(uuid);
+ extraReq32.setPropertyName("planStartTime");
+ extraReq32.setPropertyValue(emulation.getPlanStartTime());
+ extras.add(extraReq32);
+ SpdmDemandExtraReq extraReq33 = new SpdmDemandExtraReq();
+ extraReq33.setDemandId(uuid);
+ extraReq33.setPropertyName("requirementsTime");
+ extraReq33.setPropertyValue(emulation.getRequiredTime());
+ extras.add(extraReq33);
+ SpdmDemandExtraReq extraReq34 = new SpdmDemandExtraReq();
+ extraReq34.setDemandId(uuid);
+ extraReq34.setPropertyName("pausedTime");
+ extraReq34.setPropertyValue(emulation.getPausedTime());
+ extras.add(extraReq34);
+ SpdmDemandExtraReq extraReq35 = new SpdmDemandExtraReq();
+ extraReq35.setDemandId(uuid);
+ extraReq35.setPropertyName("performer");
+ extraReq35.setPropertyValue(emulation.getPerformer());
+ extras.add(extraReq35);
+ SpdmDemandExtraReq extraReq36 = new SpdmDemandExtraReq();
+ extraReq36.setDemandId(uuid);
+ extraReq36.setPropertyName("performerName");
+ extraReq36.setPropertyValue(emulation.getPerformerName());
+ extras.add(extraReq36);
+ SpdmDemandExtraReq extraReq37 = new SpdmDemandExtraReq();
+ extraReq37.setDemandId(uuid);
+ extraReq37.setPropertyName("verifier");
+ extraReq37.setPropertyValue(emulation.getVerifier());
+ extras.add(extraReq37);
+ SpdmDemandExtraReq extraReq39 = new SpdmDemandExtraReq();
+ extraReq39.setDemandId(uuid);
+ extraReq39.setPropertyName("workHourPlan");
+ extraReq39.setPropertyValue(emulation.getWorkHourPlan());
+ extras.add(extraReq39);
+ SpdmDemandExtraReq extraReq40 = new SpdmDemandExtraReq();
+ extraReq40.setDemandId(uuid);
+ extraReq40.setPropertyName("realWorkHour");
+ extraReq40.setPropertyValue(emulation.getRealWorkHour());
+ extras.add(extraReq40);
+ SpdmDemandExtraReq extraReq41 = new SpdmDemandExtraReq();
+ extraReq41.setDemandId(uuid);
+ extraReq41.setPropertyName("standardWorkHour");
+ extraReq41.setPropertyValue(emulation.getStandardWorkHour());
+ extras.add(extraReq41);
+ SpdmDemandExtraReq extraReq42 = new SpdmDemandExtraReq();
+ extraReq42.setDemandId(uuid);
+ extraReq42.setPropertyName("turnDownReason");
+ extraReq42.setPropertyValue(emulation.getTurnDownReason());
+ extras.add(extraReq42);
- // 仿真执行人
- String emulationExecutor = emulation.getEmulationExecutor();
- if (StringUtils.isNotBlank(emulationExecutor)) {
- SpdmDemandRelateMemberReq eMemberReq = new SpdmDemandRelateMemberReq();
- eMemberReq.setDemandId(uuid);
- eMemberReq.setType(1);
- String eUserId = emulationExecutor.split("-")[0];
- if (isConvertibleToLong(eUserId)) {
- eMemberReq.setUserId(Long.valueOf(eUserId));
+ // 需求的成员
+ // 仿真负责人
+ String emulationPerformer = emulation.getEmulationPerformer();
+ if (StringUtils.isNotBlank(emulationPerformer)) {
+ SpdmDemandRelateMemberReq pMemberReq = new SpdmDemandRelateMemberReq();
+ pMemberReq.setDemandId(uuid);
+ pMemberReq.setType(0);
+ String pUserId = emulationPerformer.split("-")[0];
+ if (isConvertibleToLong(pUserId)) {
+ pMemberReq.setUserId(Long.valueOf(pUserId));
+ }
+ pMemberReq.setCreateTime(curDateStr);
+ pMemberReq.setCreator(jobNumber);
+ allMemberList.add(pMemberReq);
}
- eMemberReq.setCreateTime(curDateStr);
- eMemberReq.setCreator(jobNumber);
- allMemberList.add(eMemberReq);
- }
- // 3D负责人
- String threeDimensionalPerformer = emulation.getThreeDimensionalPerformer();
- if (StringUtils.isNotBlank(emulationExecutor)) {
- SpdmDemandRelateMemberReq tMemberReq = new SpdmDemandRelateMemberReq();
- tMemberReq.setDemandId(uuid);
- tMemberReq.setType(2);
- String tUserId = threeDimensionalPerformer.split("-")[0];
- if (isConvertibleToLong(tUserId)) {
- tMemberReq.setUserId(Long.valueOf(tUserId));
+ // 仿真执行人
+ String emulationExecutor = emulation.getEmulationExecutor();
+ if (StringUtils.isNotBlank(emulationExecutor)) {
+ SpdmDemandRelateMemberReq eMemberReq = new SpdmDemandRelateMemberReq();
+ eMemberReq.setDemandId(uuid);
+ eMemberReq.setType(1);
+ String eUserId = emulationExecutor.split("-")[0];
+ if (isConvertibleToLong(eUserId)) {
+ eMemberReq.setUserId(Long.valueOf(eUserId));
+ }
+ eMemberReq.setCreateTime(curDateStr);
+ eMemberReq.setCreator(jobNumber);
+ allMemberList.add(eMemberReq);
}
- tMemberReq.setCreateTime(curDateStr);
- tMemberReq.setCreator(jobNumber);
- allMemberList.add(tMemberReq);
+
+ // 3D负责人
+ String threeDimensionalPerformer = emulation.getThreeDimensionalPerformer();
+ if (StringUtils.isNotBlank(emulationExecutor)) {
+ SpdmDemandRelateMemberReq tMemberReq = new SpdmDemandRelateMemberReq();
+ tMemberReq.setDemandId(uuid);
+ tMemberReq.setType(2);
+ String tUserId = threeDimensionalPerformer.split("-")[0];
+ if (isConvertibleToLong(tUserId)) {
+ tMemberReq.setUserId(Long.valueOf(tUserId));
+ }
+ tMemberReq.setCreateTime(curDateStr);
+ tMemberReq.setCreator(jobNumber);
+ allMemberList.add(tMemberReq);
+ }
+ demandMapper.addDemand(spdmAddDemandReq, tenantId, jobNumber);
+ // 更新文件权限
+ UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq();
+ updatePermissionReq.setUserId(jobNumber);
+ updatePermissionReq.setUuid(uuid);
+ Map userPermissions = new HashMap<>();
+ userPermissions.put(jobNumber, FilePermissionEnum.ALL.getValue());
+ updatePermissionReq.setUserPermissions(userPermissions);
+ log.info("同步需求时,更新用户权限的参数为:{}", updatePermissionReq);
+ SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
+ log.info("同步需求时,更新用户权限的返回值为:{}", updatePermissionResponse);
+ demandMapper.addDemandMember(allMemberList);
+ for (SpdmDemandExtraReq extra : extras) {
+ extra.setCreateTime(curDateStr);
+ extra.setCreator(jobNumber);
+ }
+ demandMapper.addDemandExtra(extras);
+ CreateDirReq createDirReq = new CreateDirReq();
+ createDirReq.setUuId(uuid);
+ createDirReq.setParentUuId(null);
+ createDirReq.setDirName(spdmAddDemandReq.getDemandName());
+ createDirReq.setDirType(DirTypeEnum.PROJECT_NODE_DIR.getValue());
+ log.info("同步待办创建需求时,调用创建文件夹的参数为:{}", createDirReq);
+ SdmResponse response = dataFeignClient.createDir(createDirReq);
+ log.info("同步代办创建需求时,调用创建文件夹的返回值为:{}", response);
+ } catch (Exception e) {
+ log.error("同步代办时有异常:{}", e.getMessage());
}
- demandMapper.addDemand(spdmAddDemandReq, tenantId, jobNumber);
- // 更新文件权限
- UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq();
- updatePermissionReq.setUserId(jobNumber);
- updatePermissionReq.setUuid(uuid);
- Map userPermissions = new HashMap<>();
- userPermissions.put(jobNumber, FilePermissionEnum.ALL.getValue());
- updatePermissionReq.setUserPermissions(userPermissions);
- log.info("同步需求时,更新用户权限的参数为:{}",updatePermissionReq);
- SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
- log.info("同步需求时,更新用户权限的返回值为:{}",updatePermissionResponse);
- demandMapper.addDemandMember(allMemberList);
- for (SpdmDemandExtraReq extra : extras) {
- extra.setCreateTime(curDateStr);
- extra.setCreator(jobNumber);
- }
- demandMapper.addDemandExtra(extras);
- CreateDirReq createDirReq = new CreateDirReq();
- createDirReq.setUuId(uuid);
- createDirReq.setParentUuId(null);
- createDirReq.setDirName(spdmAddDemandReq.getDemandName());
- createDirReq.setDirType(DirTypeEnum.PROJECT_NODE_DIR.getValue());
- log.info("同步待办创建需求时,调用创建文件夹的参数为:{}", createDirReq);
- SdmResponse response = dataFeignClient.createDir(createDirReq);
- log.info("同步代办创建需求时,调用创建文件夹的返回值为:{}", response);
}
return SdmResponse.success();
}
@Override
- public SdmResponse getProjectList() {
- // 查询第三方接口视图获取项目列表
- List projectInfoList = lyricVProjectToDmService.lambdaQuery().list();
- // 过滤掉数据库中已经有的项目
- if (CollectionUtils.isEmpty(projectInfoList)) {
- log.info("未同步到项目");
- return SdmResponse.success();
- }
- log.info("同步到{}条项目", projectInfoList.size());
- log.info("同步到的项目编号集合为:{}", projectInfoList.stream().map(LyricVProjectToDM::getProjectNum).toList());
- List nodeList = nodeService.lambdaQuery().list();
- if (CollectionUtils.isNotEmpty(nodeList)) {
- List nodeCodeList = nodeList.stream().map(SimulationNode::getNodeCode).toList();
- projectInfoList = projectInfoList.stream().filter(projectInfo -> !nodeCodeList.contains(String.valueOf(projectInfo.getProjectNum()))).toList();
- if (CollectionUtils.isEmpty(projectInfoList)) {
- log.info("本次同步到的项目都已经进行过同步");
- return SdmResponse.success();
- }
+ public SdmResponse getMainPlanListByProjectId(Integer projectId, String projectUuid) {
+ log.info("同步主计划,projectId:{},projectUuid:{}", projectId, projectUuid);
+ if (ObjectUtils.isEmpty(projectId) || ObjectUtils.isEmpty(projectUuid)) {
+ log.error("同步主计划时,项目id和uuid都不能为空");
+ return SdmResponse.failed("同步主计划时,项目id和uuid都不能为空");
}
Long tenantId = ThreadLocalContext.getTenantId();
Long jobNumber = ThreadLocalContext.getUserId();
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
- List projectIdList = projectInfoList.stream().map(LyricVProjectToDM::getId).toList();
+ List mainPlanList = lyricVMainPlanDMService.lambdaQuery().eq(LyricVMainPlanDM::getProjectId, String.valueOf(projectId)).list();
+ log.info("mainPlanList为:{}", mainPlanList);
+ if (CollectionUtils.isEmpty(mainPlanList)) {
+ log.info("mainPlanList为空");
+ return SdmResponse.success();
+ }
+ List nodeList = nodeService.lambdaQuery()
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE)
+ .eq(SimulationNode::getNodeType, NodeTypeEnum.PHASE.getValue())
+ .list();
+ if (CollectionUtils.isNotEmpty(nodeList)) {
+ List nodeNameList = nodeList.stream().map(SimulationNode::getNodeName).toList();
+ log.info("nodeNameList为:{}", nodeNameList);
+ mainPlanList = mainPlanList.stream().filter(planInfo -> !nodeNameList.contains(String.valueOf(planInfo.getSubject()))).toList();
+ if (CollectionUtils.isEmpty(mainPlanList)) {
+ log.info("本次同步到的主计划都已经进行过同步");
+ return SdmResponse.success();
+ }
+ }
+ log.info("同步到的主计划编号集合为:{}", mainPlanList.stream().map(LyricVMainPlanDM::getSubject).toList());
List simulationNodeList = new ArrayList<>();
- for (LyricVProjectToDM newProjectInfo : projectInfoList) {
- String uuid = String.valueOf(newProjectInfo.getId());
+ for (LyricVMainPlanDM newPhaseInfo : mainPlanList) {
+ String uuid = RandomUtil.generateString(32);
SimulationNode simulationNode = new SimulationNode();
- simulationNode.setUuid(String.valueOf(newProjectInfo.getId()));
- simulationNode.setOwnRootNodeUuid(String.valueOf(newProjectInfo.getId()));
- simulationNode.setNodeCode(newProjectInfo.getProjectNum());
- simulationNode.setNodeName(newProjectInfo.getProjectName());
- simulationNode.setNodeType(NodeTypeEnum.PROJECT.getValue());
+ simulationNode.setUuid(uuid);
+ simulationNode.setOwnRootNodeUuid(uuid);
+ simulationNode.setNodeName(StringUtils.isNotBlank(newPhaseInfo.getSubject()) ? newPhaseInfo.getSubject() : "默认阶段");
+ simulationNode.setNodeType(NodeTypeEnum.PHASE.getValue());
simulationNode.setNodeStatus("0");
simulationNode.setNodeLevel(1);
simulationNode.setTenantId(tenantId);
simulationNode.setExeStatus("0");
simulationNode.setCreator(jobNumber);
simulationNode.setCreateTime(curDateStr);
- simulationNode.setTag1(uuid);
- createDir(simulationNode.getUuid(), simulationNode.getNodeType(), null, simulationNode.getNodeName());
- simulationNodeList.add(simulationNode);
- }
- List mainPlanList = lyricVMainPlanDMService.lambdaQuery().in(LyricVMainPlanDM::getProjectId, projectIdList).list();
- if (CollectionUtils.isNotEmpty(mainPlanList)) {
- List nodeNameList = nodeList.stream().map(SimulationNode::getNodeName).toList();
- mainPlanList = mainPlanList.stream().filter(planInfo -> !nodeNameList.contains(String.valueOf(planInfo.getSubject()))).toList();
- if (CollectionUtils.isEmpty(mainPlanList)) {
- log.info("本次同步到的主计划都已经进行过同步");
- return SdmResponse.success();
- }
- log.info("同步到的主计划编号集合为:{}", mainPlanList.stream().map(LyricVMainPlanDM::getSubject).toList());
- for (LyricVMainPlanDM newPhaseInfo : mainPlanList) {
- String uuid = RandomUtil.generateString(32);
- SimulationNode simulationNode = new SimulationNode();
- simulationNode.setUuid(uuid);
- simulationNode.setOwnRootNodeUuid(uuid);
- simulationNode.setNodeName(StringUtils.isNotBlank(newPhaseInfo.getSubject()) ? newPhaseInfo.getSubject() : "默认阶段");
- simulationNode.setNodeType(NodeTypeEnum.PHASE.getValue());
- simulationNode.setNodeStatus("0");
- simulationNode.setNodeLevel(1);
- simulationNode.setTenantId(tenantId);
- simulationNode.setExeStatus("0");
- simulationNode.setCreator(jobNumber);
- simulationNode.setCreateTime(curDateStr);
- Optional nodeOptional = simulationNodeList.stream().filter(node -> node.getOwnRootNodeUuid().equals(newPhaseInfo.getProjectId())).findFirst();
- nodeOptional.ifPresent(node -> simulationNode.setTag1(node.getUuid()));
- simulationNode.setTag2(uuid);
+ simulationNode.setTag1(projectUuid);
+ simulationNode.setTag2(uuid);
+ try {
createDir(simulationNode.getUuid(), simulationNode.getNodeType(), simulationNode.getTag1(), simulationNode.getNodeName());
- simulationNodeList.add(simulationNode);
+ } catch (Exception e) {
+ log.error("同步主计划创建文件夹时有异常:{}", e.getMessage());
}
+ simulationNodeList.add(simulationNode);
}
nodeService.saveBatch(simulationNodeList);
// 更新文件权限
@@ -575,22 +785,129 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
Map userPermissions = new HashMap<>();
userPermissions.put(jobNumber, FilePermissionEnum.ALL.getValue());
updatePermissionReq.setUserPermissions(userPermissions);
- log.info("同步项目阶段时,更新用户权限的参数为:{}",updatePermissionReq);
- SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
- log.info("同步项目阶段时,更新用户权限的返回值为:{}",updatePermissionResponse);
+ log.info("同步主计划时,更新用户权限的参数为:{}", updatePermissionReq);
+ SdmResponse updatePermissionResponse = null;
+ try {
+ updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
+ } catch (Exception e) {
+ log.error("同步主计划更新用户权限时有异常:{}", e.getMessage());
+ }
+ log.info("同步主计划时,更新用户权限的返回值为:{}", updatePermissionResponse);
}
return SdmResponse.success();
}
@Override
- public SdmResponse queryProjectPdt(String projectId,Integer current,Integer size) {
+ public SdmResponse getProjectList() {
+// // 查询第三方接口视图获取项目列表
+// List projectInfoList = lyricVProjectToDmService.lambdaQuery().list();
+// // 过滤掉数据库中已经有的项目
+// if (CollectionUtils.isEmpty(projectInfoList)) {
+// log.info("未同步到项目");
+// return SdmResponse.success();
+// }
+// log.info("同步到{}条项目", projectInfoList.size());
+// log.info("同步到的项目编号集合为:{}", projectInfoList.stream().map(LyricVProjectToDM::getProjectNum).toList());
+// List nodeList = nodeService.lambdaQuery().list();
+// if (CollectionUtils.isNotEmpty(nodeList)) {
+// List nodeCodeList = nodeList.stream().map(SimulationNode::getNodeCode).toList();
+// projectInfoList = projectInfoList.stream().filter(projectInfo -> !nodeCodeList.contains(String.valueOf(projectInfo.getProjectNum()))).toList();
+// if (CollectionUtils.isEmpty(projectInfoList)) {
+// log.info("本次同步到的项目都已经进行过同步");
+// return SdmResponse.success();
+// }
+// }
+// Long tenantId = ThreadLocalContext.getTenantId();
+// Long jobNumber = ThreadLocalContext.getUserId();
+// String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
+// List projectIdList = projectInfoList.stream().map(LyricVProjectToDM::getId).toList();
+// List simulationNodeList = new ArrayList<>();
+// for (LyricVProjectToDM newProjectInfo : projectInfoList) {
+// String uuid = String.valueOf(newProjectInfo.getId());
+// SimulationNode simulationNode = new SimulationNode();
+// simulationNode.setUuid(String.valueOf(newProjectInfo.getId()));
+// simulationNode.setOwnRootNodeUuid(String.valueOf(newProjectInfo.getId()));
+// simulationNode.setNodeCode(newProjectInfo.getProjectNum());
+// simulationNode.setNodeName(newProjectInfo.getProjectName());
+// simulationNode.setNodeType(NodeTypeEnum.PROJECT.getValue());
+// simulationNode.setNodeStatus("0");
+// simulationNode.setNodeLevel(1);
+// simulationNode.setTenantId(tenantId);
+// simulationNode.setExeStatus("0");
+// simulationNode.setCreator(jobNumber);
+// simulationNode.setCreateTime(curDateStr);
+// simulationNode.setTag1(uuid);
+// createDir(simulationNode.getUuid(), simulationNode.getNodeType(), null, simulationNode.getNodeName());
+// simulationNodeList.add(simulationNode);
+// }
+// List mainPlanList = lyricVMainPlanDMService.lambdaQuery().in(LyricVMainPlanDM::getProjectId, projectIdList).list();
+// if (CollectionUtils.isNotEmpty(mainPlanList)) {
+// List nodeNameList = nodeList.stream().map(SimulationNode::getNodeName).toList();
+// mainPlanList = mainPlanList.stream().filter(planInfo -> !nodeNameList.contains(String.valueOf(planInfo.getSubject()))).toList();
+// if (CollectionUtils.isEmpty(mainPlanList)) {
+// log.info("本次同步到的主计划都已经进行过同步");
+// return SdmResponse.success();
+// }
+// log.info("同步到的主计划编号集合为:{}", mainPlanList.stream().map(LyricVMainPlanDM::getSubject).toList());
+// for (LyricVMainPlanDM newPhaseInfo : mainPlanList) {
+// String uuid = RandomUtil.generateString(32);
+// SimulationNode simulationNode = new SimulationNode();
+// simulationNode.setUuid(uuid);
+// simulationNode.setOwnRootNodeUuid(uuid);
+// simulationNode.setNodeName(StringUtils.isNotBlank(newPhaseInfo.getSubject()) ? newPhaseInfo.getSubject() : "默认阶段");
+// simulationNode.setNodeType(NodeTypeEnum.PHASE.getValue());
+// simulationNode.setNodeStatus("0");
+// simulationNode.setNodeLevel(1);
+// simulationNode.setTenantId(tenantId);
+// simulationNode.setExeStatus("0");
+// simulationNode.setCreator(jobNumber);
+// simulationNode.setCreateTime(curDateStr);
+// Optional nodeOptional = simulationNodeList.stream().filter(node -> node.getOwnRootNodeUuid().equals(newPhaseInfo.getProjectId())).findFirst();
+// nodeOptional.ifPresent(node -> simulationNode.setTag1(node.getUuid()));
+// simulationNode.setTag2(uuid);
+// createDir(simulationNode.getUuid(), simulationNode.getNodeType(), simulationNode.getTag1(), simulationNode.getNodeName());
+// simulationNodeList.add(simulationNode);
+// }
+// }
+// nodeService.saveBatch(simulationNodeList);
+// // 更新文件权限
+// for (SimulationNode simulationNode : simulationNodeList) {
+// UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq();
+// updatePermissionReq.setUserId(jobNumber);
+// updatePermissionReq.setUuid(simulationNode.getUuid());
+// Map userPermissions = new HashMap<>();
+// userPermissions.put(jobNumber, FilePermissionEnum.ALL.getValue());
+// updatePermissionReq.setUserPermissions(userPermissions);
+// log.info("同步项目阶段时,更新用户权限的参数为:{}", updatePermissionReq);
+// SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
+// log.info("同步项目阶段时,更新用户权限的返回值为:{}", updatePermissionResponse);
+// }
+ return SdmResponse.success();
+ }
+
+ @Override
+ public SdmResponse queryProjectPdt(String projectId, Integer current, Integer size) {
+ log.info("queryProjectPdt中projectId:{}", projectId);
+ if (StringUtils.isBlank(projectId)) {
+ log.error("queryProjectPdt中projectId为空");
+ return SdmResponse.success();
+ }
+ SimulationNode simulationNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, projectId)
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).one();
+ if (ObjectUtils.isEmpty(simulationNode)) {
+ log.error("queryProjectPdt中simulationNode为空");
+ return SdmResponse.success();
+ }
+ Integer syncProjectId = simulationNode.getProjectId();
+ log.info("queryProjectPdt中syncProjectId:{}", syncProjectId);
+ if (ObjectUtils.isEmpty(syncProjectId)) {
+ log.error("queryProjectPdt中syncProjectId为空");
+ return SdmResponse.success();
+ }
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", new ArrayList<>());
- if (!isConvertibleToInt(projectId)) {
- return SdmResponse.success(jsonObject);
- }
- List list = lyricVPdtDmService.lambdaQuery().eq(LyricVPdtToDM::getProjectId, projectId).list();
- log.info("根据projectId:{},查询到的项目pdt信息为:{}",projectId,list);
+ List list = lyricVPdtDmService.lambdaQuery().eq(LyricVPdtToDM::getProjectId, syncProjectId).list();
+ log.info("根据syncProjectId:{},查询到的项目pdt信息为:{}", syncProjectId, list);
if (CollectionUtils.isEmpty(list)) {
return SdmResponse.success(jsonObject);
}
@@ -606,14 +923,28 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
}
@Override
- public SdmResponse queryMainPlan(String projectId,Integer current,Integer size) {
+ public SdmResponse queryMainPlan(String projectId, Integer current, Integer size) {
+ log.info("queryMainPlan中projectId:{}", projectId);
+ if (StringUtils.isBlank(projectId)) {
+ log.error("queryMainPlan中projectId为空");
+ return SdmResponse.success();
+ }
+ SimulationNode simulationNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, projectId)
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).one();
+ if (ObjectUtils.isEmpty(simulationNode)) {
+ log.error("queryMainPlan中simulationNode为空");
+ return SdmResponse.success();
+ }
+ Integer syncProjectId = simulationNode.getProjectId();
+ log.info("queryMainPlan中syncProjectId:{}", syncProjectId);
+ if (ObjectUtils.isEmpty(syncProjectId)) {
+ log.error("queryMainPlan中syncProjectId为空");
+ return SdmResponse.success();
+ }
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", new ArrayList<>());
- if (!isConvertibleToInt(projectId)) {
- return SdmResponse.success(jsonObject);
- }
- List list = lyricVMainPlanDMService.lambdaQuery().eq(LyricVMainPlanDM::getProjectId, projectId).list();
- log.info("根据projectId:{},查询到的主计划信息为:{}",projectId,list);
+ List list = lyricVMainPlanDMService.lambdaQuery().eq(LyricVMainPlanDM::getProjectId, syncProjectId).list();
+ log.info("根据syncProjectId:{},查询到的主计划信息为:{}", syncProjectId, list);
if (CollectionUtils.isEmpty(list)) {
return SdmResponse.success(jsonObject);
}
@@ -629,11 +960,28 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
}
@Override
- public SdmResponse queryProductionLine(String projectNum,Integer current,Integer size) {
+ public SdmResponse queryProductionLine(String projectNum, Integer current, Integer size) {
+ log.info("queryProductionLine中projectNum:{}", projectNum);
+ if (StringUtils.isBlank(projectNum)) {
+ log.error("queryProductionLine中projectNum为空");
+ return SdmResponse.success();
+ }
+ SimulationNode simulationNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, projectNum)
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).one();
+ if (ObjectUtils.isEmpty(simulationNode)) {
+ log.error("queryProductionLine中simulationNode为空");
+ return SdmResponse.success();
+ }
+ String syncProjectNum = simulationNode.getNodeCode();
+ log.info("queryProductionLine中syncProjectNum:{}", syncProjectNum);
+ if (ObjectUtils.isEmpty(syncProjectNum)) {
+ log.error("queryProductionLine中syncProjectNum为空");
+ return SdmResponse.success();
+ }
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", new ArrayList<>());
- List list = lyricVProductionLineToDmService.lambdaQuery().eq(LyricVProductionLineToDM::getProjectNum, projectNum).list();
- log.info("根据projectNum:{},查询到的产线信息为:{}",projectNum,list);
+ List list = lyricVProductionLineToDmService.lambdaQuery().eq(LyricVProductionLineToDM::getProjectNum, syncProjectNum).list();
+ log.info("根据syncProjectNum:{},查询到的产线信息为:{}", syncProjectNum, list);
if (CollectionUtils.isEmpty(list)) {
return SdmResponse.success(jsonObject);
}
@@ -649,14 +997,28 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
}
@Override
- public SdmResponse queryProjectBatch(String projectId,Integer current,Integer size) {
+ public SdmResponse queryProjectBatch(String projectId, Integer current, Integer size) {
+ log.info("queryProjectBatch中projectId:{}", projectId);
+ if (StringUtils.isBlank(projectId)) {
+ log.error("queryProjectBatch中projectId为空");
+ return SdmResponse.success();
+ }
+ SimulationNode simulationNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, projectId)
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).one();
+ if (ObjectUtils.isEmpty(simulationNode)) {
+ log.error("queryProjectBatch中simulationNode为空");
+ return SdmResponse.success();
+ }
+ Integer syncProjectId = simulationNode.getProjectId();
+ log.info("queryProjectBatch中syncProjectId:{}", syncProjectId);
+ if (ObjectUtils.isEmpty(syncProjectId)) {
+ log.error("queryProjectBatch中syncProjectId为空");
+ return SdmResponse.success();
+ }
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", new ArrayList<>());
- if (!isConvertibleToInt(projectId)) {
- return SdmResponse.success(jsonObject);
- }
- List list = lyricVProjectBatchToDmService.lambdaQuery().eq(LyricVProjectBatchToDM::getProject_id, projectId).list();
- log.info("根据projectId:{},查询到的批次信息为:{}",projectId,list);
+ List list = lyricVProjectBatchToDmService.lambdaQuery().eq(LyricVProjectBatchToDM::getProjectId, projectId).list();
+ log.info("根据projectId:{},查询到的批次信息为:{}", projectId, list);
if (CollectionUtils.isEmpty(list)) {
return SdmResponse.success(jsonObject);
}
@@ -673,14 +1035,40 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
@Override
public SdmResponse queryProjectInfo(String projectId) {
- if (!isConvertibleToInt(projectId)) {
+ log.info("queryProjectInfo中projectId:{}", projectId);
+ if (StringUtils.isBlank(projectId)) {
+ log.error("queryProjectInfo中projectId为空");
return SdmResponse.success();
}
- LyricVProjectToDM projectNode = lyricVProjectToDmService.lambdaQuery().eq(LyricVProjectToDM::getId, projectId).one();
- log.info("根据projectId:{},查询到的项目信息为:{}",projectId,projectNode);
+ SimulationNode simulationNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, projectId)
+ .eq(SimulationNode::getProjectSource, SYNC_PROJECT_SOURCE).one();
+ if (ObjectUtils.isEmpty(simulationNode)) {
+ log.error("queryProjectInfo中simulationNode为空");
+ return SdmResponse.success();
+ }
+ Integer syncProjectId = simulationNode.getProjectId();
+ log.info("queryProjectInfo中syncProjectId:{}", syncProjectId);
+ if (ObjectUtils.isEmpty(syncProjectId)) {
+ log.error("queryProjectInfo中syncProjectId为空");
+ return SdmResponse.success();
+ }
+ LyricVProjectToDM projectNode = lyricVProjectToDmService.lambdaQuery().eq(LyricVProjectToDM::getId, syncProjectId).one();
+ log.info("根据syncProjectId:{},查询到的项目信息为:{}", syncProjectId, projectNode);
return SdmResponse.success(projectNode);
}
+ @Override
+ public SdmResponse queryProjectInfoList(EpProjectQueryReq req) {
+ PageHelper.startPage(req.getCurrent(), req.getPageSize());
+ List projectList = lyricVProjectToDmService.lambdaQuery()
+ .like(StringUtils.isNotBlank(req.getProjectNum()), LyricVProjectToDM::getProjectNum, req.getProjectNum())
+ .like(StringUtils.isNotBlank(req.getProjectName()), LyricVProjectToDM::getProjectName, req.getProjectName())
+ .like(StringUtils.isNotBlank(req.getDifficultyType()), LyricVProjectToDM::getDifficultyType, req.getDifficultyType())
+ .list();
+ PageInfo page = new PageInfo<>(projectList);
+ return PageUtils.getJsonObjectSdmResponse(projectList, page);
+ }
+
@Override
public SdmResponse pushReport(PushReportReq req) {
// 根据文件id下载文件到临时目录
diff --git a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java
index 6ee857d6..d19834b9 100644
--- a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java
+++ b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java
@@ -111,6 +111,11 @@ public class NodeServiceImpl extends ServiceImpl
\ No newline at end of file
diff --git a/project/src/main/resources/mapper/SimulationNodeMapper.xml b/project/src/main/resources/mapper/SimulationNodeMapper.xml
index 33901a39..f9ff442d 100644
--- a/project/src/main/resources/mapper/SimulationNodeMapper.xml
+++ b/project/src/main/resources/mapper/SimulationNodeMapper.xml
@@ -7,13 +7,13 @@
insert into simulation_node
(uuid,ownRootNodeUuid,nodeName,nodeCode,englishName,nodeType,nodeSubType,nodeStatus,parentId,folderId,nodeLevel,beginTime,endTime,finishTime,progress,
- achieveStatus,exe_status,tenantId,description,detailImgUrl,creator,create_time,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10)
+ achieveStatus,exe_status,tenantId,description,detailImgUrl,creator,create_time,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10,projectId,projectSource)
values
(#{addNode.uuid},#{addNode.ownRootNodeUuid},#{addNode.nodeName},#{addNode.nodeCode},#{addNode.englishName},#{addNode.nodeType},#{addNode.nodeSubType},'0',#{addNode.pid},
'',1,#{addNode.beginTime},#{addNode.endTime},'',#{addNode.progressStatus},#{addNode.achieveStatus},#{addNode.exeStatus},#{addNode.tenantId},#{addNode.description},
#{addNode.detailImgUrl},#{addNode.creator},#{addNode.createTime},#{addNode.tag1},#{addNode.tag2},
- #{addNode.tag3},#{addNode.tag4},#{addNode.tag5},#{addNode.tag6},#{addNode.tag7},#{addNode.tag8},#{addNode.tag9},#{addNode.tag10})
+ #{addNode.tag3},#{addNode.tag4},#{addNode.tag5},#{addNode.tag6},#{addNode.tag7},#{addNode.tag8},#{addNode.tag9},#{addNode.tag10},#{addNode.projectId},#{addNode.projectSource})