记得上下班打卡 | git大法好,push需谨慎

Commit 20228fdb authored by 胡佳晨's avatar 胡佳晨

修改 只要活动上线即可显示

parent f347a304
...@@ -58,16 +58,17 @@ public class SmileVProjectListVo implements Serializable, Cloneable { ...@@ -58,16 +58,17 @@ public class SmileVProjectListVo implements Serializable, Cloneable {
this.setAddress(source.getAddress()); this.setAddress(source.getAddress());
this.setImg(source.getImg()); this.setImg(source.getImg());
this.setApplyStatus(applyStatus); this.setApplyStatus(applyStatus);
LocalDateTime now = LocalDateTime.now(); // LocalDateTime now = LocalDateTime.now();
LocalDateTime ldtStart = LocalDateTime.parse(source.getTimeStart(), DTF_YMD_HMS); // LocalDateTime ldtStart = LocalDateTime.parse(source.getTimeStart(), DTF_YMD_HMS);
LocalDateTime ldtEnd = LocalDateTime.parse(source.getTimeEnd(), DTF_YMD_HMS); // LocalDateTime ldtEnd = LocalDateTime.parse(source.getTimeEnd(), DTF_YMD_HMS);
if (now.isAfter(ldtEnd)) {
this.setProjectStatus(2);
} else if (now.isBefore(ldtStart)) {
this.setProjectStatus(0);
}else{
this.setProjectStatus(1); this.setProjectStatus(1);
} // if (now.isAfter(ldtEnd)) {
// this.setProjectStatus(2);
// } else if (now.isBefore(ldtStart)) {
// this.setProjectStatus(0);
// }else{
// this.setProjectStatus(1);
// }
return this; return this;
} }
......
...@@ -50,28 +50,29 @@ public class SmileVolunteerServerImpl implements SmileVolunteersService { ...@@ -50,28 +50,29 @@ public class SmileVolunteerServerImpl implements SmileVolunteersService {
// } // }
} }
List<Integer> sortList = Arrays.asList(1,0,2); List<Integer> sortList = Arrays.asList(1,0,2);
voList = voList.stream().sorted(Comparator.comparing(SmileVProjectListVo::getProjectStatus,(x,y)-> { // voList = voList.stream().sorted(Comparator.comparing(SmileVProjectListVo::getProjectStatus,(x,y)-> {
if(x == null && y != null){ // if(x == null && y != null){
return 1; // return 1;
}else if(x !=null && y == null){ // }else if(x !=null && y == null){
return -1; // return -1;
}else if(x == null && y == null){ // }else if(x == null && y == null){
return -1; // return -1;
} else { // } else {
for(Integer sort : sortList){ // for(Integer sort : sortList){
if(sort.equals(x) || sort.equals(y)){ // if(sort.equals(x) || sort.equals(y)){
if(x.equals(y)){ // if(x.equals(y)){
return 0; // return 0;
}else if(sort.equals(x)){ // }else if(sort.equals(x)){
return -1; // return -1;
}else{ // }else{
return 1; // return 1;
} // }
} // }
} // }
return 0; // return 0;
} // }
}).thenComparing(SmileVProjectListVo::getTimeStart)).collect(Collectors.toList()); // }).thenComparing(SmileVProjectListVo::getTimeStart)).collect(Collectors.toList());
voList = voList.stream().sorted(Comparator.comparing(SmileVProjectListVo::getTimeStart)).collect(Collectors.toList());
return ResponseDto.success(voList); return ResponseDto.success(voList);
} }
......
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