public List<TbRemouldAirVO> airQueryByMap (List<TbRemouldAirVO> airVO ,Map<String, String> map) {标签:map,return,记录,get,equals,查询,过滤,new,airVO From: https://www.cnblogs.com/sensenh/p/17485929.html
//1.改造时间
if (!StringUtils.isEmpty(map.get("remouldTimeAir"))) {
airVO = airVO.stream().filter(x -> Objects.equals(x.getRemouldTimeAir(), map.get("remouldTimeAir"))).collect(Collectors.toList());
}
//2.纳入情况
if (!StringUtils.isEmpty(map.get("conditionAir"))) {
airVO = airVO.stream().filter(x -> {
String conditionAir = String.valueOf(x.getConditionAir());
String conditionAir1 = map.get("conditionAir");
return conditionAir.equals(conditionAir1);
}).collect(Collectors.toList());
}
//3.1.铁路局计划金额预算
if(!StringUtils.isEmpty(map.get("budgutTypeAir"))) {
if ("1".equals(map.get("budgutTypeAir"))) {
airVO = airVO.stream().filter(x -> x.getRailBudgetAir() != null).filter(x -> {
int symbol = x.getRailBudgetAir().compareTo(new BigDecimal("0"));
if (symbol > 0 && !"".equals(map.get("beginBudgetAir")) && !"".equals(map.get("endBudgetAir"))) {
int begin = x.getRailBudgetAir().compareTo(new BigDecimal(map.get("beginBudgetAir")));
int end = x.getRailBudgetAir().compareTo(new BigDecimal(map.get("endBudgetAir")));
return (begin >= 0 && end <= 0);
} else {
return false;
}
}).collect(Collectors.toList());
}
//3.2.合资公司计划金额预算
else if ("2".equals(map.get("budgutTypeAir"))) {
airVO = airVO.stream().filter(x -> x.getComBudgetAir() != null).filter(x -> {
int symbol = x.getComBudgetAir().compareTo(new BigDecimal("0"));
if (symbol > 0 && !"".equals(map.get("beginBudgetAir")) && !"".equals(map.get("endBudgetAir"))) {
int begin = x.getComBudgetAir().compareTo(new BigDecimal(map.get("beginBudgetAir")));
int end = x.getComBudgetAir().compareTo(new BigDecimal(map.get("endBudgetAir")));
return (begin >= 0 && end <= 0);
}else {
return false;
}
}).collect(Collectors.toList());
}
//3.3.地方政府计划金额
else if ("3".equals(map.get("budgutTypeAir"))) {
airVO = airVO.stream().filter(x -> x.getGovBudgetAir() != null).filter(x -> {
int symbol = x.getGovBudgetAir().compareTo(new BigDecimal("0"));
if (symbol > 0 && !"".equals(map.get("beginBudgetAir")) && !"".equals(map.get("endBudgetAir"))) {
int begin = x.getGovBudgetAir().compareTo(new BigDecimal(map.get("beginBudgetAir")));
int end = x.getGovBudgetAir().compareTo(new BigDecimal(map.get("endBudgetAir")));
return (begin >= 0 && end <= 0);
} else {
return false;
}
}).collect(Collectors.toList());
}
}
//4.类型
if (!StringUtils.isEmpty(map.get("typeAir"))) {
airVO = airVO.stream().filter(x -> {
String type = String.valueOf(x.getTypeAir());
String typeAir = map.get("typeAir");
return type.equals(typeAir);
}).collect(Collectors.toList());
}
//5.计划方式
if (!StringUtils.isEmpty(map.get("planAir"))) {
airVO = airVO.stream().filter(x -> {
String planAir = String.valueOf(x.getPlanAir());
String planAir1 = map.get("planAir");
return planAir.equals(planAir1);
}).collect(Collectors.toList());
}
//6创建时间
if (!StringUtils.isEmpty(map.get("createTimeAir"))) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
Date completiontime = format.parse(map.get("createTimeAir"));
String format2 = format.format(completiontime);
airVO = airVO.stream().filter(x -> {
try {
Date createTimeAir = x.getCreateTimeAir();
String format1 = format.format(createTimeAir);
return format1.equals(format2);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
).collect(Collectors.toList());
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
return airVO;
}