|
|
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -36,13 +37,13 @@ public class StatisticService {
|
|
|
private final ExpertRepo expertRepo;
|
|
|
private final PurchaseRepo purchaseRepo;
|
|
|
private final SuccessCaseRepo successCaseRepo;
|
|
|
+ private final CopyrightRepo copyrightRepo;
|
|
|
private final CopyrightDemandRepo copyrightDemandRepo;
|
|
|
- private final LogoDemandRepo logoDemandRepo;
|
|
|
private final PatentDemandRepo patentDemandRepo;
|
|
|
private final TechProductDemandRepo techProductDemandRepo;
|
|
|
private final FundingRepo fundingRepo;
|
|
|
- private final CopyrightRepo copyrightRepo;
|
|
|
private final LogoRepo logoRepo;
|
|
|
+ private final LogoDemandRepo logoDemandRepo;
|
|
|
private final PatentRepo patentRepo;
|
|
|
private final ServiceProviderRepo serviceProviderRepo;
|
|
|
private final TechnicalManagerRepo technicalManagerRepo;
|
|
|
@@ -50,29 +51,29 @@ public class StatisticService {
|
|
|
|
|
|
|
|
|
public Map<String, Long> getTotal() {
|
|
|
- // long policy = policyLawRepo.countByCategory(ResourceCategory.POLICY);
|
|
|
- long policy = expertRepo.count();
|
|
|
- long law = policyLawRepo.countByCategory(ResourceCategory.LAW);
|
|
|
- long intellectualProperty = patentRepo
|
|
|
- .count();
|
|
|
- long technology = digitalRepo.countByType(DigitalType.TECHNOLOGY);
|
|
|
- long product = digitalRepo.countByType(DigitalType.PRODUCT);
|
|
|
- long company = companyRepo.count();
|
|
|
- long expert = expertRepo.count();
|
|
|
- long purchase = purchaseRepo.count();
|
|
|
- long successCase = successCaseRepo.count();
|
|
|
-
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
- map.put("policy", policy);
|
|
|
- map.put("law", law);
|
|
|
- map.put("intellectualProperty", intellectualProperty);
|
|
|
- map.put("technology", technology);
|
|
|
- map.put("product", product);
|
|
|
- map.put("company", company);
|
|
|
- map.put("expert", expert);
|
|
|
- map.put("purchase", purchase);
|
|
|
- map.put("successCase", successCase);
|
|
|
|
|
|
+ map.put("intellectualProperty", patentRepo.count()
|
|
|
+ + patentDemandRepo.count()
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.DECLASSIFICATION)
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.GENERAL)
|
|
|
+ + intellectualPropertyRepo.count());
|
|
|
+ map.put("logo", logoRepo.count() + logoDemandRepo.count() + successCaseRepo.countByCategory(CaseCategory.LOGO));
|
|
|
+ map.put("copyright", copyrightRepo.countByTypeIn(Arrays.asList(CopyrightType.COPY, CopyrightType.SERVICE))
|
|
|
+ + copyrightDemandRepo.countByTypeIn(Arrays.asList(CopyrightType.COPY, CopyrightType.SERVICE))
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.COPYRIGHT));
|
|
|
+ map.put("softCopyright", copyrightRepo.countByType(CopyrightType.SOFT)
|
|
|
+ + copyrightDemandRepo.countByType(CopyrightType.SOFT)
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.SOFT_COPYRIGHT));
|
|
|
+ map.put("technology", digitalRepo.countByType(DigitalType.TECHNOLOGY)
|
|
|
+ + technologyProductRepo.countByTpType(TpType.TECHNOLOGY)
|
|
|
+ + techProductDemandRepo.countByTpType(TpType.TECHNOLOGY)
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.TECHNOLOGY));
|
|
|
+ map.put("product", digitalRepo.countByType(DigitalType.PRODUCT)
|
|
|
+ + technologyProductRepo.countByTpType(TpType.PRODUCT)
|
|
|
+ + techProductDemandRepo.countByTpType(TpType.PRODUCT)
|
|
|
+ + successCaseRepo.countByCategory(CaseCategory.PRODUCT));
|
|
|
+ map.put("technicalManager", technicalManagerRepo.count());
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@@ -93,24 +94,24 @@ public class StatisticService {
|
|
|
startAt = now.minusDays(value);
|
|
|
|
|
|
Map<CopyrightType, Long> copyright = copyrightDemandRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(CopyrightDemand::getType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(CopyrightDemand::getType, Collectors.counting()));
|
|
|
Map<Object, Long> map = new HashMap<>(copyright);
|
|
|
|
|
|
long logo = logoDemandRepo.countByCreatedAtGreaterThanEqual(startAt);
|
|
|
map.put("LOGO", logo);
|
|
|
|
|
|
Map<CaseType, Long> patent = patentDemandRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getCaseType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(PatentDemand::getCaseType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getCaseType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(PatentDemand::getCaseType, Collectors.counting()));
|
|
|
map.putAll(patent);
|
|
|
|
|
|
Map<TpType, Long> tech = techProductDemandRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getTpType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(TechProductDemand::getTpType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getTpType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(TechProductDemand::getTpType, Collectors.counting()));
|
|
|
map.putAll(tech);
|
|
|
|
|
|
long funding = fundingRepo.countByCreatedAtGreaterThanEqual(startAt);
|
|
|
@@ -134,24 +135,24 @@ public class StatisticService {
|
|
|
startAt = now.minusDays(value);
|
|
|
|
|
|
Map<CopyrightType, Long> copyright = copyrightRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(Copyright::getType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(Copyright::getType, Collectors.counting()));
|
|
|
Map<Object, Long> map = new HashMap<>(copyright);
|
|
|
|
|
|
long logo = logoRepo.countByCreatedAtGreaterThanEqual(startAt);
|
|
|
map.put("LOGO", logo);
|
|
|
|
|
|
Map<CaseType, Long> patent = patentRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getCaseType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(Patent::getCaseType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getCaseType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(Patent::getCaseType, Collectors.counting()));
|
|
|
map.putAll(patent);
|
|
|
|
|
|
Map<TpType, Long> tech = technologyProductRepo.findAll()
|
|
|
- .stream()
|
|
|
- .filter(demand -> ObjectUtil.isNotNull(demand.getTpType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
- .collect(Collectors.groupingBy(TechnologyProduct::getTpType, Collectors.counting()));
|
|
|
+ .stream()
|
|
|
+ .filter(demand -> ObjectUtil.isNotNull(demand.getTpType()) && !startAt.isAfter(demand.getCreatedAt()))
|
|
|
+ .collect(Collectors.groupingBy(TechnologyProduct::getTpType, Collectors.counting()));
|
|
|
map.putAll(tech);
|
|
|
|
|
|
long service = serviceProviderRepo.countByCreatedAtGreaterThanEqual(startAt);
|