Commit 80ae584f authored by kongfm's avatar kongfm

BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17

parent 42c16f34
...@@ -316,8 +316,9 @@ public class WaterResourceDto extends BaseDto { ...@@ -316,8 +316,9 @@ public class WaterResourceDto extends BaseDto {
@ExcelIgnore @ExcelIgnore
@ApiModelProperty("设施分类id") @ApiModelProperty("设施分类id")
private Long equipCategoryId; private Long equipCategoryId;
// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
@ApiModelProperty("设施分类名称") @ApiModelProperty("设施分类名称")
@ExplicitConstraint(indexNum = 45, sourceClass = RoleNameExplicitConstraint.class, method = "getEquipCategory")
@ExcelProperty(value = "设施分类名称", index = 45) @ExcelProperty(value = "设施分类名称", index = 45)
private String equipCategoryName; private String equipCategoryName;
......
...@@ -213,4 +213,11 @@ public interface EquipFeignClient { ...@@ -213,4 +213,11 @@ public interface EquipFeignClient {
@RequestMapping(value = "/building/getAllBuilding", method = RequestMethod.GET) @RequestMapping(value = "/building/getAllBuilding", method = RequestMethod.GET)
ResponseModel<List<LinkedHashMap<String, Object>>> getAllBuilding(); ResponseModel<List<LinkedHashMap<String, Object>>> getAllBuilding();
/**
* 查询所有建筑的数据字典// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
* @return
*/
@RequestMapping(value = "equipment-category/tree/{type}", method = RequestMethod.GET)
ResponseModel<List<LinkedHashMap<String, Object>>> getEquipmentCategory(@PathVariable String type);
} }
...@@ -156,6 +156,9 @@ public class DataSourcesImpl implements DataSources { ...@@ -156,6 +156,9 @@ public class DataSourcesImpl implements DataSources {
case "getDutyArea": case "getDutyArea":
str =getDutyArea(); str =getDutyArea();
break; break;
case "getEquipCategory":
str =getEquipCategory();
break;
} }
} }
return str; return str;
...@@ -377,4 +380,48 @@ public class DataSourcesImpl implements DataSources { ...@@ -377,4 +380,48 @@ public class DataSourcesImpl implements DataSources {
String[] str = areaList.toArray(new String[buildingList.size()]); String[] str = areaList.toArray(new String[buildingList.size()]);
return str; return str;
} }
/**
* 获取设施分类// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
* @return
*/
private String[] getEquipCategory() {
String type = "1";
ResponseModel<List<LinkedHashMap<String, Object>>> response = equipFeignClient.getEquipmentCategory(type);
// 筛选第一层
String categoryCode = "90000000";
List<LinkedHashMap<String, Object>> categoryList = response.getResult();
// 筛选第二层
String fireCode = "93000000";
List<LinkedHashMap<String, Object>> fireList = Lists.newArrayList();
// 筛选第三层
String waterCode = "93060000";
List<LinkedHashMap<String, Object>> waterList = Lists.newArrayList();
List<LinkedHashMap<String, Object>> category = Lists.newArrayList();
List<String> resultList = Lists.newArrayList();
for(LinkedHashMap<String, Object> t :categoryList) {
if(categoryCode.equals(t.get("code").toString())){
fireList = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
// 筛选第二层
for(LinkedHashMap<String, Object> t : fireList) {
if(fireCode.equals(t.get("code").toString())){
waterList = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
// 筛选第三层
for(LinkedHashMap<String, Object> t : waterList) {
if(waterCode.equals(t.get("code").toString())){
category = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
category.forEach(t -> {
resultList.add(t.get("name") + "@" + t.get("id"));
});
String[] str = resultList.toArray(new String[category.size()]);
return str;
}
} }
...@@ -798,6 +798,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -798,6 +798,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
item.setType(type[0]); item.setType(type[0]);
item.setTypeCode(type[1]); item.setTypeCode(type[1]);
} }
// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
if (item.getEquipCategoryName() != null) {
String[] equipCategory = item.getEquipCategoryName().split("@");
item.setEquipCategoryName(equipCategory[0]);
item.setEquipCategoryId(Long.parseLong(equipCategory[1]));
}
item = Bean.toPo(getCurrentInfo(), item); item = Bean.toPo(getCurrentInfo(), item);
waterResourceServiceImpl.importByExcel(item); waterResourceServiceImpl.importByExcel(item);
}); });
......
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