x1ongzhu 2 жил өмнө
parent
commit
7af2c2a6af

+ 5 - 0
src/main/java/com/izouma/zhirongip/repo/demand/CopyrightDemandRepo.java

@@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.util.Collection;
 import java.util.List;
 
 public interface CopyrightDemandRepo extends JpaRepository<CopyrightDemand, Long>, JpaSpecificationExecutor<CopyrightDemand> {
@@ -22,4 +23,8 @@ public interface CopyrightDemandRepo extends JpaRepository<CopyrightDemand, Long
     void addView(Long id);
 
     List<CopyrightDemand> findAllByNameLikeAndTypeIsNot(String name, CopyrightType type);
+
+    long countByType(CopyrightType type);
+
+    long countByTypeIn(Collection<CopyrightType> types);
 }

+ 3 - 0
src/main/java/com/izouma/zhirongip/repo/demand/TechProductDemandRepo.java

@@ -1,6 +1,7 @@
 package com.izouma.zhirongip.repo.demand;
 
 import com.izouma.zhirongip.domain.demand.TechProductDemand;
+import com.izouma.zhirongip.enums.TpType;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -21,4 +22,6 @@ public interface TechProductDemandRepo extends JpaRepository<TechProductDemand,
     @Modifying
     @Transactional
     void addView(Long id);
+
+    long countByTpType(TpType tpType);
 }

+ 3 - 0
src/main/java/com/izouma/zhirongip/repo/resource/SuccessCaseRepo.java

@@ -1,6 +1,7 @@
 package com.izouma.zhirongip.repo.resource;
 
 import com.izouma.zhirongip.domain.resource.SuccessCase;
+import com.izouma.zhirongip.enums.CaseCategory;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -21,4 +22,6 @@ public interface SuccessCaseRepo extends JpaRepository<SuccessCase, Long>, JpaSp
     @Modifying
     @Transactional
     void addView(Long id);
+
+    long countByCategory(CaseCategory caseCategory);
 }

+ 6 - 0
src/main/java/com/izouma/zhirongip/repo/supply/CopyrightRepo.java

@@ -1,12 +1,14 @@
 package com.izouma.zhirongip.repo.supply;
 
 import com.izouma.zhirongip.domain.supply.Copyright;
+import com.izouma.zhirongip.enums.CopyrightType;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.util.Collection;
 import java.util.List;
 
 public interface CopyrightRepo extends JpaRepository<Copyright, Long>, JpaSpecificationExecutor<Copyright> {
@@ -21,4 +23,8 @@ public interface CopyrightRepo extends JpaRepository<Copyright, Long>, JpaSpecif
     @Modifying
     @Transactional
     void addView(Long id);
+
+    long countByType(CopyrightType type);
+
+    long countByTypeIn(Collection<CopyrightType> types);
 }

+ 2 - 0
src/main/java/com/izouma/zhirongip/repo/supply/TechnologyProductRepo.java

@@ -1,6 +1,7 @@
 package com.izouma.zhirongip.repo.supply;
 
 import com.izouma.zhirongip.domain.supply.TechnologyProduct;
+import com.izouma.zhirongip.enums.TpType;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -26,4 +27,5 @@ public interface TechnologyProductRepo extends JpaRepository<TechnologyProduct,
     @Query(nativeQuery = true, value = "select * from technology_product order by created_at desc limit 5")
     List<TechnologyProduct> top();
 
+    long countByTpType(TpType tpType);
 }

+ 42 - 41
src/main/java/com/izouma/zhirongip/service/StatisticService.java

@@ -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);

+ 6 - 6
src/main/vue/src/views/Dashboard.vue

@@ -20,19 +20,19 @@
                     </div>
                     <div class="text">
                         <div class="text1">商标</div>
-                        <div class="text2">{{ list.technology }}</div>
+                        <div class="text2">{{ list.logo }}</div>
                     </div>
                     <div class="text">
                         <div class="text1">版权</div>
-                        <div class="text2">{{ list.product }}</div>
+                        <div class="text2">{{ list.copyright }}</div>
                     </div>
                     <div class="text">
                         <div class="text1">软著</div>
-                        <div class="text2">{{ list.company }}</div>
+                        <div class="text2">{{ list.softCopyright }}</div>
                     </div>
                     <div class="text">
                         <div class="text1">技术</div>
-                        <div class="text2">{{ list.expert }}</div>
+                        <div class="text2">{{ list.technology }}</div>
                     </div>
                     <!-- <div class="text">
                         <div class="text1">军采信息</div>
@@ -40,11 +40,11 @@
                     </div> -->
                     <div class="text">
                         <div class="text1">产品</div>
-                        <div class="text2">{{ list.successCase }}</div>
+                        <div class="text2">{{ list.product }}</div>
                     </div>
                     <div class="text">
                         <div class="text1">技术经理人</div>
-                        <div class="text2">{{ list.policy }}</div>
+                        <div class="text2">{{ list.technicalManager }}</div>
                     </div>
                 </div>
             </div>

+ 1 - 1
src/main/zhi-rong-web/.eslintrc.js

@@ -17,4 +17,4 @@ module.exports = {
         'vue/no-unused-vars': 'off',
         'vue/no-use-v-if-with-v-for': 'off'
     }
-};
+};

+ 5 - 0
src/main/zhi-rong-web/jsconfig.json

@@ -0,0 +1,5 @@
+{
+    "vueCompilerOptions": {
+        "experimentalCompatMode": 2
+    }
+}

+ 2 - 2
src/main/zhi-rong-web/src/components/page/FilterList.vue

@@ -57,10 +57,10 @@
                 </div>
 
                 <div class="btn-right" v-if="hasAction">
-                    <el-button size="small" type="primary" @click="show = true">
+                    <!-- <el-button size="small" type="primary" @click="show = true">
                         <div class="button_title">信息发布</div>
                         <img src="../../assets/nav_icon_bianjis@3x.png" alt="" class="button_img" />
-                    </el-button>
+                    </el-button> -->
                     <el-button v-if="isDemand" size="small" type="primary" @click="btnEvent">
                         <img src="../../assets/nav_icon_bianjis@3x.png" alt="" class="button_img" />
                         <div class="button_title">需求发布</div>

+ 1 - 1
src/main/zhi-rong-web/src/views/market/Copyright.vue

@@ -126,7 +126,7 @@ export default {
         addInfo(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.type);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.type);
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/CopyrightDemand.vue

@@ -127,7 +127,7 @@ export default {
         btnEvent(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.type);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.type);
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/Logo.vue

@@ -130,7 +130,7 @@ export default {
         addInfo(value) {
             if (value) {
                 // this.$refs.public.init();
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init();
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/LogoDemand.vue

@@ -124,7 +124,7 @@ export default {
         btnEvent(value) {
             if (value) {
                 // this.$refs.public.init();
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init();
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/Patent.vue

@@ -180,7 +180,7 @@ export default {
         addInfo(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.caseType);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.caseType);
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/PatentDemand.vue

@@ -213,7 +213,7 @@ export default {
         addInfo(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.caseType);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.caseType);
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/TechProductDemand.vue

@@ -173,7 +173,7 @@ export default {
         btnEvent(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.tpType);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.tpType);
                 });
             }

+ 1 - 1
src/main/zhi-rong-web/src/views/market/TechnologyProduct.vue

@@ -172,7 +172,7 @@ export default {
         addInfo(value) {
             if (value) {
                 // this.$refs.public.init(this.$route.query.tpType);
-                this.checkLogin(false).then(() => {
+                this.checkLogin(true).then(() => {
                     this.$refs.public.init(this.$route.query.tpType);
                 });
             }