Commit f4b84b1f authored by 刘林's avatar 刘林

fix(jg):设备管理页面左侧树调整

parent dbd649f0
......@@ -136,4 +136,16 @@ public class ZLDPStatisticsController {
public ResponseModel<List<EquCategoryVo>> getEquCategoryTree(@RequestBody DPFilterParamForDetailDto paramDto){
return ResponseHelper.buildResponse(statisticsService.getEquCategoryList(paramDto.getTreeValue()));
}
/**
* 设备八大类列表树
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备八大类列表树", notes = "设备八大类列表树")
@GetMapping(value = "/equipTree")
public ResponseModel<Object> equipTree(@RequestParam(value = "type", required = false) String type) {
return ResponseHelper.buildResponse(statisticsService.equipTree(type));
}
}
......@@ -12,12 +12,14 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics;
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.statistcs.biz.utils.JsonUtils;
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.enums.EquipmentClassifityEnum;
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;
......@@ -37,6 +39,8 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
......@@ -71,6 +75,9 @@ public class ZLDPStatisticsServiceImpl {
// 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT";
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, EquipmentCategoryMapper equipmentCategoryMapper) {
this.screenMapper = screenMapper;
this.iDataDictionaryService = iDataDictionaryService;
......@@ -1036,4 +1043,26 @@ public class ZLDPStatisticsServiceImpl {
.map(dto -> new EquCategoryVo(dto.getName(), dto.getCode(), null))
.collect(Collectors.toList());
}
public List<Map<String, Object>> equipTree(String type) {
List<Map<String, Object>> menus = new ArrayList<>();
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
List<Map<String, Object>> mapList;
if (ValidationUtil.isEmpty(type)) {
mapList = resourceJson.get(EquipmentClassifityEnum.BDLS.getCode());
} else {
if ("QTBF".equals(type)) {
type = "superviseBusiness";
}
mapList = resourceJson.get(type) == null ? resourceJson.get(EquipmentClassifityEnum.BDLS.getCode()) : resourceJson.get(type);
}
for (Map map : mapList) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("instanceName", map.get("name"));
resultMap.put("instanceId", map.get("code"));
resultMap.put("image", map.get("imageUrl"));
menus.add(resultMap);
}
return menus;
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
public class JsonUtils {
//将json文件转化为Map<list<Map<>>>
public static Map getResourceJson(Resource resource) {
String json = null;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败");
}
return JSONObject.parseObject(json, Map.class);
}
}
......@@ -35,28 +35,6 @@
"type": "vehicle"
},
{
"name": "大型游乐设施",
"code": "6000",
"image": "upload/tzs/common/image/总览游乐设施.png",
"imageUrl": "upload/tzs/common/image/监管游乐设施.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "rides"
},
{
"name": "客运索道",
"code": "9000",
"image": "upload/tzs/common/image/总览索道.png",
"imageUrl": "upload/tzs/common/image/监管索道.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "ropeway"
},
{
"name": "锅炉",
"code": "1000",
"image": "upload/tzs/common/image/总览锅炉.png",
......@@ -90,15 +68,26 @@
"type": "pipeline"
},
{
"name": "气瓶",
"code": "2300",
"image": "upload/tzs/common/image/总览压力容器.png",
"imageUrl": "upload/tzs/common/image/监管压力容器.png",
"name": "大型游乐设施",
"code": "6000",
"image": "upload/tzs/common/image/总览游乐设施.png",
"imageUrl": "upload/tzs/common/image/监管游乐设施.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "rides"
},
{
"name": "客运索道",
"code": "9000",
"image": "upload/tzs/common/image/总览索道.png",
"imageUrl": "upload/tzs/common/image/监管索道.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "cylinder"
"type": "ropeway"
}
],
"__other__": "监管业务使用",
......
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