|
|
@@ -1,5 +1,8 @@
|
|
|
package com.izouma.wenlvju.service;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.izouma.wenlvju.domain.Record;
|
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
|
import com.izouma.wenlvju.dto.RecordExcelDTO;
|
|
|
@@ -12,6 +15,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -41,8 +45,17 @@ public class RecordService {
|
|
|
query.remove("organizer");
|
|
|
}
|
|
|
|
|
|
+ Object examinationTime = query.get("examinationTime");
|
|
|
+ LocalDate date = null;
|
|
|
+ if (examinationTime != null) {
|
|
|
+ date = Convert.toLocalDateTime(examinationTime).toLocalDate();
|
|
|
+ query.remove("examinationTime");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
String finalAgency = examinationAgency;
|
|
|
String finalOrganizer = organizer;
|
|
|
+ LocalDate finalDate = date;
|
|
|
return recordRepo.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
List<Predicate> and = JpaUtils.toPredicates(pageQuery, Record.class, root, criteriaQuery, criteriaBuilder);
|
|
|
if (StringUtil.isNotBlank(finalAgency)) {
|
|
|
@@ -51,6 +64,10 @@ public class RecordService {
|
|
|
if (StringUtil.isNotBlank(finalOrganizer)) {
|
|
|
and.add(criteriaBuilder.like(root.get("organizer"), "%" + finalOrganizer + "%"));
|
|
|
}
|
|
|
+ if (ObjectUtil.isNotEmpty(finalDate)) {
|
|
|
+ and.add(criteriaBuilder.lessThanOrEqualTo(root.get("examinationStartTime"), finalDate));
|
|
|
+ and.add(criteriaBuilder.greaterThanOrEqualTo(root.get("examinationEndTime"), finalDate));
|
|
|
+ }
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
}, JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|