From 63dec7ef93efa8b683f8d82fb9ee8a9c66916179 Mon Sep 17 00:00:00 2001 From: zch <765536121@qq.com> Date: Sat, 28 Feb 2026 17:22:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8F=91=E5=B8=83=E6=99=BA=E7=AE=97=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=BC=98=E5=8C=96=E9=80=BB=E8=BE=91=202.=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=99=BA=E7=AE=97=E9=87=8D=E5=90=AF=E9=80=BB=E8=BE=91?= =?UTF-8?q?=203.=E4=BC=98=E5=8C=96=E6=99=BA=E7=AE=97=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduling/ServiceVersionStatusTask.java | 4 +-- .../impl/ZSServiceVersionServiceImpl.java | 29 ++++++++++++++++++- .../ZSServiceVersionMapper.xml | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ServiceVersionStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ServiceVersionStatusTask.java index c19c2e35..040a78c0 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ServiceVersionStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ServiceVersionStatusTask.java @@ -182,10 +182,10 @@ public class ServiceVersionStatusTask { // 4. 如果url有值,则将url写入对应的数据中,然后更新数据库 if (taskStatusInfo != null) { String url = taskStatusInfo.get("url").toString(); - if (url != null && !url.isEmpty()) { + String status = taskStatusInfo.get("status").toString(); + if (url != null && url.startsWith("https://")) { version.setUrl(url); } - String status = taskStatusInfo.get("status").toString(); version.setRunState(capitalizeFirstLetter(status)); serviceVersionMapper.updateVersion(version); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ZSServiceVersionServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ZSServiceVersionServiceImpl.java index 03d6bc39..493a35b0 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ZSServiceVersionServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ZSServiceVersionServiceImpl.java @@ -147,7 +147,24 @@ public class ZSServiceVersionServiceImpl implements ServiceVersionService { @Override public void updateVersion(ServiceVersionDTO versionDTO) throws Exception { - + ServiceVersionZs version = zsServiceVersionMapper.getVersionById(versionDTO.getId()); + String result = version.getResult(); + String url = zsServiceVersionUrl + "/api/v1/reSubmitTask"; + Map response = restTemplate.postForObject(url, JsonUtils.jsonToMap(result), Map.class); + if (response == null || (int)response.get("code") != 200) { + throw new Exception("Failed to restart task: " + response.get("msg")); + } + + // 提取jobSetID + Map data = (Map) response.get("data"); + if (data != null && data.containsKey("jobSetID")) { + String jobSetID = (String) data.get("jobSetID"); + version.setJobSetId(jobSetID); + // 更新数据库 + version.setRunState("Completed"); + version.setUrl(null); + zsServiceVersionMapper.updateVersion(version); + } } @Override @@ -157,7 +174,17 @@ public class ZSServiceVersionServiceImpl implements ServiceVersionService { @Override public void stopServiceVersion(Long id) throws Exception { + ServiceVersionZs version = zsServiceVersionMapper.getVersionById(id); + String url = zsServiceVersionUrl + "/api/v1/stopInferenceTask"; + Map request = new HashMap<>(); + request.put("localJobID", "1"); + request.put("jobSetID", version.getJobSetId()); + Map response = restTemplate.postForObject(url, request, Map.class); + if (response == null || (int)response.get("code") != 200) { + throw new Exception("Failed to stop task: " + response.get("msg")); + } + zsServiceVersionMapper.stopServiceVersion(id); } @Override diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ZSServiceVersionMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ZSServiceVersionMapper.xml index 412cf832..cc4185ae 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ZSServiceVersionMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ZSServiceVersionMapper.xml @@ -179,7 +179,7 @@ - update service_version_zs set run_state = 'stopped' where id = #{id} + update service_version_zs set run_state = 'Stopped' where id = #{id}