From a5115a30066847baaf0d85ae8ba802b8f2fd5e58 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 09 九月 2024 18:03:00 +0800
Subject: [PATCH] 设备功能

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devmanage/DevModelServiceImpl.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devmanage/DevModelServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devmanage/DevModelServiceImpl.java
index 29ec88b..7939b42 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devmanage/DevModelServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devmanage/DevModelServiceImpl.java
@@ -1,5 +1,7 @@
 package cn.lihu.jh.module.ecg.service.devmanage;
 
+import cn.lihu.jh.module.system.api.dict.DictDataApi;
+import cn.lihu.jh.module.system.api.dict.dto.DictDataRespDTO;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
@@ -11,6 +13,11 @@
 import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DevModelMapper;
 
 import javax.annotation.Resource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
@@ -26,6 +33,9 @@
 
     @Resource
     private DevModelMapper devModelMapper;
+
+    @Resource
+    private DictDataApi dictDataApi;
 
     @Override
     public Integer createDevModel(DevModelSaveReqVO createReqVO) {
@@ -69,4 +79,34 @@
         return devModelMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public List<OptionVO> getBrandOptions(String devCategory) {
+        List<String> list = devModelMapper.getBrandByCategory(devCategory);
+
+        List<DictDataRespDTO> dictDataRespDTOList = dictDataApi.getDictDataList("ecg_dev_brand");
+        Map<String, String> map = dictDataRespDTOList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
+
+        List<OptionVO> optionVOList = new ArrayList<>();
+        list.forEach(item -> {
+            OptionVO optionVO = new OptionVO();
+            optionVO.setLabel( map.get(item) );
+            optionVO.setValue( item );
+            optionVOList.add( optionVO );
+        });
+        return optionVOList;
+    }
+
+    @Override
+    public List<OptionVO> getBrandModelOptions(String devCategory, String devBrand) {
+        List<String> list = devModelMapper.getModelByCategoryBrand(devCategory, devBrand);
+        List<OptionVO> optionVOList = new ArrayList<>();
+        list.forEach(item -> {
+            OptionVO optionVO = new OptionVO();
+            optionVO.setLabel( item );
+            optionVO.setValue( item );
+            optionVOList.add( optionVO );
+        });
+        return optionVOList;
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3