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(); + } }