Commit 5396937a authored by tianbo's avatar tianbo

大屏-ZL-增加根据设备种类查询设备类别列表接口

parent 1fc11ebf
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZLDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
......@@ -119,4 +120,16 @@ public class ZLDPStatisticsController {
return ResponseHelper.buildResponse(statisticsService.viewEquipPage(paramDto));
}
/**
* 根据设备种类code获取设备类别下拉
*
* @param equListCode 设备种类code
* @return 设备类别列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquCategoryList")
@ApiOperation(httpMethod = "GET", value = "根据设备种类code获取设备类别下拉", notes = "根据设备种类code获取设备类别下拉")
public ResponseModel<List<EquCategoryVo>> getEquCategoryTree(String equListCode){
return ResponseHelper.buildResponse(statisticsService.getEquCategoryList(equListCode));
}
}
......@@ -2,11 +2,11 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics;
......@@ -14,9 +14,13 @@ import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
......@@ -37,6 +41,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -51,30 +56,28 @@ public class ZLDPStatisticsServiceImpl {
private static final String EQU_STATE = "EQU_STATE";
private static final String LEVEL = "company";
private ZLStatisticsMapper screenMapper;
private final ZLStatisticsMapper screenMapper;
private DataDictionaryServiceImpl iDataDictionaryService;
private final DataDictionaryServiceImpl iDataDictionaryService;
private AlertStatisticsMapper alertStatisticsMapper;
private final AlertStatisticsMapper alertStatisticsMapper;
private RestHighLevelClient restHighLevelClient;
private final RestHighLevelClient restHighLevelClient;
private StCommonServiceImpl stCommonService;
private final StCommonServiceImpl stCommonService;
private RedisUtils redisUtils;
private final EquipmentCategoryMapper equipmentCategoryMapper;
// 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT";
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, RedisUtils redisUtils) {
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, EquipmentCategoryMapper equipmentCategoryMapper) {
this.screenMapper = screenMapper;
this.iDataDictionaryService = iDataDictionaryService;
this.alertStatisticsMapper = alertStatisticsMapper;
this.restHighLevelClient = restHighLevelClient;
this.stCommonService = stCommonService;
this.redisUtils = redisUtils;
this.equipmentCategoryMapper = equipmentCategoryMapper;
}
......@@ -999,4 +1002,18 @@ public class ZLDPStatisticsServiceImpl {
}
return result;
}
public List<EquCategoryVo> getEquCategoryList(String equListCode) {
EquipmentCategory equList = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, equListCode));
if (ValidationUtil.isEmpty(equList)) {
return Lists.newArrayList();
}
List<EquipmentCategory> equipmentCategoryList = equipmentCategoryMapper.selectList(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getParentId, equList.getId()));
if (ValidationUtil.isEmpty(equipmentCategoryList)) {
return Lists.newArrayList();
}
return equipmentCategoryList.stream()
.map(dto -> new EquCategoryVo(dto.getName(), dto.getCode()))
.collect(Collectors.toList());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment