|
@@ -1,13 +1,13 @@
|
|
|
package com.izouma.wenlvju.service;
|
|
package com.izouma.wenlvju.service;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.izouma.wenlvju.domain.Record;
|
|
import com.izouma.wenlvju.domain.Record;
|
|
|
|
|
+import com.izouma.wenlvju.domain.RecordSpecialty;
|
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
|
-import com.izouma.wenlvju.dto.RecordExcelDTO;
|
|
|
|
|
-import com.izouma.wenlvju.exception.BusinessException;
|
|
|
|
|
import com.izouma.wenlvju.repo.RecordRepo;
|
|
import com.izouma.wenlvju.repo.RecordRepo;
|
|
|
|
|
+import com.izouma.wenlvju.repo.RecordSpecialtyRepo;
|
|
|
import com.izouma.wenlvju.utils.JpaUtils;
|
|
import com.izouma.wenlvju.utils.JpaUtils;
|
|
|
import jodd.util.StringUtil;
|
|
import jodd.util.StringUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -15,16 +15,19 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
public class RecordService {
|
|
public class RecordService {
|
|
|
|
|
|
|
|
- private RecordRepo recordRepo;
|
|
|
|
|
|
|
+ private RecordRepo recordRepo;
|
|
|
|
|
+ private RecordSpecialtyRepo recordSpecialtyRepo;
|
|
|
|
|
|
|
|
public Page<Record> all(PageQuery pageQuery) {
|
|
public Page<Record> all(PageQuery pageQuery) {
|
|
|
return recordRepo.findAll(JpaUtils.toSpecification(pageQuery, Record.class), JpaUtils.toPageRequest(pageQuery));
|
|
return recordRepo.findAll(JpaUtils.toSpecification(pageQuery, Record.class), JpaUtils.toPageRequest(pageQuery));
|
|
@@ -51,17 +54,11 @@ public class RecordService {
|
|
|
}, JpaUtils.toPageRequest(pageQuery));
|
|
}, JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public Record addSupervisor(Long id, Long userId) {
|
|
|
|
|
-// Record record = recordRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
|
|
-// record.setSupervisorUserId(userId);
|
|
|
|
|
-// return recordRepo.save(record);
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
展示今天的所有备案
|
|
展示今天的所有备案
|
|
|
*/
|
|
*/
|
|
|
- public List<Record> byToday( String district){
|
|
|
|
|
|
|
+ public List<Record> byToday(String district) {
|
|
|
LocalDate now = LocalDate.now();
|
|
LocalDate now = LocalDate.now();
|
|
|
return recordRepo.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
|
return recordRepo.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
List<Predicate> and = new ArrayList<>();
|
|
List<Predicate> and = new ArrayList<>();
|
|
@@ -73,4 +70,18 @@ public class RecordService {
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ 导出
|
|
|
|
|
+ */
|
|
|
|
|
+ public void excel(List<Record> data) throws IOException {
|
|
|
|
|
+ List<Long> ids = data.stream().map(Record::getId).collect(Collectors.toList());
|
|
|
|
|
+ if (CollUtil.isEmpty(ids)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<RecordSpecialty> specialties = recordSpecialtyRepo.findAllByRecordIdIn(ids);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|