Browse Source

Merge branch 'dev-zenas-20241018' of wangfan/adweb3-server into master

zhangqiang 2 weeks ago
parent
commit
a79ef396cc

+ 30 - 28
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/seo/service/impl/SeoKeywordsRankServiceImpl.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.adweb.seo.service.impl;
 
-import static org.jeecg.modules.adweb.seo.dto.ComprehensiveStatistics.KeywordRankStats;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.xkcoding.http.util.StringUtil;
@@ -155,23 +154,24 @@ public class SeoKeywordsRankServiceImpl implements ISeoKeywordsRankService {
             comprehensiveStatistics.setPlanLongTailKeywordNum(subscribePlan.getLongTailKeyword());
             comprehensiveStatistics.setPlanOuterLinkNum(subscribePlan.getExternalLinks());
             comprehensiveStatistics.setPlanArticleNum(subscribePlan.getArticle());
-        }
-        // 添加站点数据
-        // 1.获取站点指定词数量
-        List<KeywordRankStats> keywordRankStats =
-                seoKeywordsMapper.getKeywordsRankStats(
-                        siteCode,
-                        Optional.ofNullable(subscribePlan.getTarget()).orElse(10)); // 默认排名前10
-        for (KeywordRankStats rankStats : keywordRankStats) {
-            if (rankStats.getKeywordType() == 1) {
-                // 指定词
-                comprehensiveStatistics.setAppointKeywordNum(rankStats.getKeywordNum());
-                comprehensiveStatistics.setAchievedAppointKeywordNum(
-                        rankStats.getAchievedKeywordNum());
-            } else {
-                comprehensiveStatistics.setLongTailKeywordNum(rankStats.getKeywordNum());
-                comprehensiveStatistics.setAchievedLongTailKeywordNum(
-                        rankStats.getAchievedKeywordNum());
+
+            // 添加站点数据
+            // 1.获取站点指定词数量
+            List<ComprehensiveStatistics.KeywordRankStats> keywordRankStats =
+                    seoKeywordsMapper.getKeywordsRankStats(
+                            siteCode,
+                            Optional.ofNullable(subscribePlan.getTarget()).orElse(10)); // 默认排名前10
+            for (ComprehensiveStatistics.KeywordRankStats rankStats : keywordRankStats) {
+                if (rankStats.getKeywordType() == 1) {
+                    // 指定词
+                    comprehensiveStatistics.setAppointKeywordNum(rankStats.getKeywordNum());
+                    comprehensiveStatistics.setAchievedAppointKeywordNum(
+                            rankStats.getAchievedKeywordNum());
+                } else {
+                    comprehensiveStatistics.setLongTailKeywordNum(rankStats.getKeywordNum());
+                    comprehensiveStatistics.setAchievedLongTailKeywordNum(
+                            rankStats.getAchievedKeywordNum());
+                }
             }
         }
 
@@ -184,18 +184,20 @@ public class SeoKeywordsRankServiceImpl implements ISeoKeywordsRankService {
         AdwebSite siteByCode = adwebSiteService.getSiteByCode(siteCode);
         UserPlanSubscription userPlanSubscription =
                 userPlanSubscriptionService.getCurrentSubscription(siteByCode.getId());
-        // 通过站点获取订阅id
-        List<SeoRankInfoVO> seoRankInfos =
-                this.getSeoRankInfo(siteCode, userPlanSubscription.getId());
         Map map = new HashMap<>();
-        map.put("appointKeyword", seoRankInfos.get(0));
-        map.put("longTailKeyword", seoRankInfos.get(1));
-
-        // TODO - 获取达标时间和剩余服务时间
-        if (userPlanSubscription.getKeywordsAchieveTime() == null) {
-            seoKeywordsSerpMapper.getAchieveDate(siteCode, 10, 10, 10);
+        if (userPlanSubscription != null) {
+            // 通过站点获取订阅id
+            List<SeoRankInfoVO> seoRankInfos =
+                    this.getSeoRankInfo(siteCode, userPlanSubscription.getId());
+            map.put("appointKeyword", seoRankInfos.get(0));
+            map.put("longTailKeyword", seoRankInfos.get(1));
+
+            // TODO - 获取达标时间和剩余服务时间
+            if (userPlanSubscription.getKeywordsAchieveTime() == null) {
+                seoKeywordsSerpMapper.getAchieveDate(siteCode, 10, 10, 10);
+            }
+            map.put("serviceTime", new ServiceTimeVO());
         }
-        map.put("serviceTime", new ServiceTimeVO());
         return map;
     }