|
|
@@ -43,8 +43,9 @@ public class PatentService {
|
|
|
|
|
|
public Page<Patent> all(PageQuery pageQuery) {
|
|
|
Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 1, 13, 24, 25, 26)).stream()
|
|
|
- .collect(Collectors.toMap(Setting::getId, Setting::getName));
|
|
|
- return patentRepo.findAll(JpaUtils.toSpecification(pageQuery, Patent.class), JpaUtils.toPageRequest(pageQuery))
|
|
|
+ .collect(Collectors.toMap(Setting::getId, Setting::getName));
|
|
|
+ Page<Patent> page = patentRepo.findAll(JpaUtils.toSpecification(pageQuery, Patent.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
+ return page
|
|
|
.map(cd -> {
|
|
|
cd.setIndustryName(settingMap.get(cd.getIndustryClass()));
|
|
|
if (cd.getPatentTypeId() != null) {
|
|
|
@@ -64,23 +65,23 @@ public class PatentService {
|
|
|
public Patent get(Long id) {
|
|
|
Patent patent = patentRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
patent.setIndustryName(settingRepo.findById(patent.getIndustryClass())
|
|
|
- .orElseThrow(new BusinessException("无记录"))
|
|
|
- .getName());
|
|
|
+ .orElseThrow(new BusinessException("无记录"))
|
|
|
+ .getName());
|
|
|
|
|
|
if (patent.getPatentTypeId() != null) {
|
|
|
patent.setPatentType(settingRepo.findById(patent.getPatentTypeId())
|
|
|
- .orElseThrow(new BusinessException("无记录"))
|
|
|
- .getName());
|
|
|
+ .orElseThrow(new BusinessException("无记录"))
|
|
|
+ .getName());
|
|
|
}
|
|
|
if (patent.getLawStatusId() != null) {
|
|
|
patent.setLawStatus(settingRepo.findById(patent.getLawStatusId())
|
|
|
- .orElseThrow(new BusinessException("无记录"))
|
|
|
- .getName());
|
|
|
+ .orElseThrow(new BusinessException("无记录"))
|
|
|
+ .getName());
|
|
|
}
|
|
|
if (patent.getTradingMethodId() != null) {
|
|
|
patent.setTradingMethod(settingRepo.findById(patent.getTradingMethodId())
|
|
|
- .orElseThrow(new BusinessException("无记录"))
|
|
|
- .getName());
|
|
|
+ .orElseThrow(new BusinessException("无记录"))
|
|
|
+ .getName());
|
|
|
}
|
|
|
return patent;
|
|
|
}
|
|
|
@@ -89,9 +90,9 @@ public class PatentService {
|
|
|
Patent record = patentRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
|
|
|
Information information = Information.builder()
|
|
|
- .receiveUserId(record.getUserId())
|
|
|
- .isRead(false)
|
|
|
- .build();
|
|
|
+ .receiveUserId(record.getUserId())
|
|
|
+ .isRead(false)
|
|
|
+ .build();
|
|
|
|
|
|
if (pass) {
|
|
|
record.setStatus(ApplyStatus.PASS);
|
|
|
@@ -125,7 +126,7 @@ public class PatentService {
|
|
|
List<Patent> patents = new ArrayList<>();
|
|
|
int index = 0;
|
|
|
Map<String, Long> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 1, 13, 24, 25, 26)).stream()
|
|
|
- .collect(Collectors.toMap(Setting::getName, Setting::getId));
|
|
|
+ .collect(Collectors.toMap(Setting::getName, Setting::getId));
|
|
|
Map<String, OwnerType> typeMap = new HashMap<>();
|
|
|
typeMap.put("企事业单位", OwnerType.ENTERPRISES_AND_INSTITUTIONS);
|
|
|
typeMap.put("高校院所", OwnerType.UNIVERSITIES_AND_INSTITUTES);
|