Commit 6f4e6112 authored by chenhao's avatar chenhao

提交代码

parent 9779c339
...@@ -999,59 +999,30 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -999,59 +999,30 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception { public Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> equipmentTypeList =null; List<EquipmentCategory> equipmentTypeList =null;
if (redisUtils.hasKey(equipTypeAndCount)) { // if (redisUtils.hasKey(equipTypeAndCount)) {
equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(equipTypeAndCount)), EquipmentCategory.class); // equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(equipTypeAndCount)), EquipmentCategory.class);
} else { // } else {
List<EquipmentCategory> responseList = this.typeList(); List<EquipmentCategory> responseList = this.typeList();
if(responseList == null || responseList.size()<1) { if(responseList == null || responseList.size()<1) {
return null; return null;
} }
equipmentTypeList = responseList.stream().filter(i->!"20000000".equals(i.getCode()) && "2".equals(i.getIndustryCode())).collect(Collectors.toList()); equipmentTypeList = responseList.stream().filter(i->!i.getCode().startsWith("2") && "2".equals(i.getIndustryCode())).collect(Collectors.toList());
redisUtils.set(equipTypeAndCount, equipmentTypeList); // }
} return typeListTree(equipmentTypeList,bizOrgCode,SourceTypeEnum.EQUIPMENT);
getCountToChildren(equipmentTypeList,bizOrgCode);
return equipmentTypeList;
} }
public Object getCountToChildren(List<EquipmentCategory> children,String bizOrgCode) throws Exception {
for (EquipmentCategory equipmentCategory : children) {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, SourceTypeEnum.EQUIPMENT, equipmentCategory.getCode());
equipmentCategory.setCount(Double.parseDouble(num+""));
List<EquipmentCategory> childrenList =equipmentCategory.getChildren();
if(childrenList!=null && childrenList.size()>0) {
getCountToChildren(childrenList,bizOrgCode);
}
}
return children;
}
public Object getCarTypeAndCount(String bizOrgCode) throws Exception { public Object getCarTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> equipmentTypeList =null; List<EquipmentCategory> equipmentTypeList =null;
if (redisUtils.hasKey(carTypeAndCount)) { // if (redisUtils.hasKey(carTypeAndCount)) {
equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(carTypeAndCount)), EquipmentCategory.class); // equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(carTypeAndCount)), EquipmentCategory.class);
} else { // } else {
List<EquipmentCategory> responseList = this.typeList(); List<EquipmentCategory> responseList = this.typeList();
if(responseList == null || responseList.size()<1) { if(responseList == null || responseList.size()<1) {
return null; return null;
} }
equipmentTypeList = responseList.stream().filter(i->"20000000".equals(i.getCode()) && "2".equals(i.getIndustryCode())).collect(Collectors.toList()); equipmentTypeList = responseList.stream().filter(i->i.getCode().startsWith("2") && "2".equals(i.getIndustryCode())).collect(Collectors.toList());
redisUtils.set(carTypeAndCount, equipmentTypeList); // }
} return typeListTree(equipmentTypeList,bizOrgCode,SourceTypeEnum.CAR);
getCountToChildren(equipmentTypeList,bizOrgCode);
return equipmentTypeList;
}
public Object getCarCountToChildren(List<EquipmentCategory> children,String bizOrgCode) throws Exception {
for (EquipmentCategory equipmentCategory : children) {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, SourceTypeEnum.CAR, equipmentCategory.getCode());
equipmentCategory.setCount(Double.parseDouble(num+""));
List<EquipmentCategory> childrenList =equipmentCategory.getChildren();
if(childrenList!=null && childrenList.size()>0) {
getCarCountToChildren(childrenList,bizOrgCode);
}
}
return children;
} }
...@@ -1059,9 +1030,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1059,9 +1030,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public List<EquipmentCategory> typeList() { public List<EquipmentCategory> typeList() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode)); .getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode));
return equipmentCategorys;
}
public List<EquipmentCategory> typeListTree(List<EquipmentCategory> equipmentCategorys,String bizOrgCode,SourceTypeEnum sourceTypeEnum) {
List<EquipmentCategory> list = new ArrayList<>(); List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>(); Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> { equipmentCategorys.forEach(action -> {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
action.setCount(Double.parseDouble(num+""));
if (action.getParentId() == null) { if (action.getParentId() == null) {
list.add(action); list.add(action);
} else { } else {
...@@ -1079,6 +1055,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1079,6 +1055,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
getChildren(list, tmpMap); getChildren(list, tmpMap);
return list; return list;
} }
private void getChildren(List<EquipmentCategory> list, Map<String, List<EquipmentCategory>> tmpMap) { private void getChildren(List<EquipmentCategory> list, Map<String, List<EquipmentCategory>> tmpMap) {
for (EquipmentCategory equipmentCategory : list) { for (EquipmentCategory equipmentCategory : list) {
if (tmpMap.get(equipmentCategory.getId().toString()) != null if (tmpMap.get(equipmentCategory.getId().toString()) != null
......
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