From 06ebc2a4ea18a0326d16f2e09e5cd8f96d4d90fd Mon Sep 17 00:00:00 2001 From: yangwei <867012372@qq.com> Date: Tue, 6 May 2025 17:38:22 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=201=E3=80=81=E5=A2=9E=E5=8A=A0=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E7=AE=A1=E7=90=86=E6=9F=A5=E8=AF=A2=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E2=91=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/controller/DeviceController.java | 4 +-- .../controller/system/AiLabelController.java | 11 +++++++ .../system/service/IAiLabelService.java | 2 ++ .../service/impl/AiLabelServiceImpl.java | 33 +++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceController.java b/dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceController.java index bd1ca9d..139af62 100644 --- a/dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceController.java +++ b/dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceController.java @@ -119,7 +119,7 @@ public class DeviceController { * @param deviceSn * @return */ - @PutMapping("/devices/{device_sn}") + @PutMapping("/{workspace_id}/devices/{device_sn}") @Operation(summary = "更新设备信息。", description = "更新设备信息。") public HttpResultResponse updateDevice(@RequestBody DeviceDTO device, @PathVariable("workspace_id") String workspaceId, @@ -136,7 +136,7 @@ public class DeviceController { * @return */ @Operation(summary = "设备离线固件升级任务。", description = "设备离线固件升级任务。") - @PostMapping("/devices/ota") + @PostMapping("/{workspace_id}/devices/ota") public HttpResultResponse createOtaJob(@PathVariable("workspace_id") String workspaceId, @RequestBody List upgradeDTOS) { return deviceService.createDeviceOtaJob(workspaceId, upgradeDTOS); diff --git a/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java b/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java index babe5c3..2a3b69d 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java +++ b/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java @@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.dromara.common.idempotent.annotation.RepeatSubmit; @@ -56,6 +57,16 @@ public class AiLabelController extends BaseController { return aiLabelService.allList(); } + /** + * 下拉框集合 + */ + @GetMapping("/{postCode}/list") + public List listPostCodeLabel(@PathVariable("postCode") String postCode) { + return aiLabelService.selectLabelByList(postCode); + } + + + /** * 导出ai 识别类型列表 diff --git a/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelService.java b/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelService.java index 5a1f009..ede3b27 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelService.java +++ b/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelService.java @@ -74,4 +74,6 @@ public interface IAiLabelService { List queryListByLabel(List labelIds); String getFlowCode(String labelCode); + + List selectLabelByList(String postCode); } diff --git a/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java b/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java index 60ee64f..19cdee1 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java @@ -1,5 +1,6 @@ package org.dromara.system.service.impl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; @@ -9,6 +10,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; +import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; +import org.dromara.system.domain.vo.AiLabelPostVo; +import org.dromara.system.domain.vo.SysPostVo; +import org.dromara.system.service.IAiLabelPostService; +import org.dromara.system.service.ISysPostService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.dromara.system.domain.bo.AiLabelBo; import org.dromara.system.domain.vo.AiLabelVo; @@ -20,6 +27,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.stream.Collectors; /** * ai 识别类型Service业务层处理 @@ -33,6 +41,12 @@ public class AiLabelServiceImpl implements IAiLabelService { private final AiLabelMapper baseMapper; + @Autowired + private ISysPostService sysPostService; + + @Autowired + private IAiLabelPostService aiLabelPostService; + /** * 查询ai 识别类型 * @@ -148,4 +162,23 @@ public class AiLabelServiceImpl implements IAiLabelService { public String getFlowCode(String labelCode) { return this.baseMapper.selectOne(new LambdaQueryWrapper().eq(AiLabel::getLabelEn, labelCode)).getFlowCode(); } + + @Override + public List selectLabelByList(String postCode) { + SysPostVo sysPostVo = sysPostService.selectLableByList(postCode,null); + if(sysPostVo != null){ + List postVoList = aiLabelPostService.queryListByLabel(sysPostVo.getPostId()); + return postVoList.stream() + .map(aiLabel -> { + AiLabelVo aiLabelVo = new AiLabelVo(); + aiLabelVo.setLabelId(aiLabel.getLabelId()); + aiLabelVo.setLabelEn(aiLabel.getLabelEn()); + aiLabelVo.setLabelCn(aiLabel.getLabelCn()); + aiLabelVo.setAiName(aiLabel.getAiName()); + return aiLabelVo; + }) + .collect(Collectors.toList()); + } + return ListUtil.empty(); + } }