|
@@ -4,11 +4,11 @@ import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.slodon.b2b2c.core.util.HttpClientUtil;
|
|
import com.slodon.b2b2c.core.util.HttpClientUtil;
|
|
-import com.slodon.b2b2c.investment.bean.bo.*;
|
|
|
|
-import com.slodon.b2b2c.investment.bean.dto.RivalDTO;
|
|
|
|
-import com.slodon.b2b2c.investment.bean.vo.KeyWordPartVO;
|
|
|
|
-import com.slodon.b2b2c.investment.bean.vo.RivalPartVO;
|
|
|
|
-import com.slodon.b2b2c.investment.bean.vo.SuggestionVO;
|
|
|
|
|
|
+import com.slodon.b2b2c.investment.bean.analysis.bo.*;
|
|
|
|
+import com.slodon.b2b2c.investment.bean.analysis.dto.RivalDTO;
|
|
|
|
+import com.slodon.b2b2c.investment.bean.analysis.vo.KeyWordPartVO;
|
|
|
|
+import com.slodon.b2b2c.investment.bean.analysis.vo.RivalPartVO;
|
|
|
|
+import com.slodon.b2b2c.investment.bean.analysis.vo.SuggestionVO;
|
|
import com.slodon.b2b2c.investment.config.AnalysisConfig;
|
|
import com.slodon.b2b2c.investment.config.AnalysisConfig;
|
|
import com.slodon.b2b2c.investment.constant.InvestmentConst;
|
|
import com.slodon.b2b2c.investment.constant.InvestmentConst;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -162,7 +162,7 @@ public KeyWordPartVO searchVolume(HashMap<String,String> header,String keywords,
|
|
* @param header 请求头
|
|
* @param header 请求头
|
|
* @param keyword 关键词
|
|
* @param keyword 关键词
|
|
* @param locationName 地区
|
|
* @param locationName 地区
|
|
- * @return: com.slodon.b2b2c.investment.bean.vo.SuggestionVO
|
|
|
|
|
|
+ * @return: com.slodon.b2b2c.investment.bean.analysis.vo.SuggestionVO
|
|
* @author sunshihao
|
|
* @author sunshihao
|
|
* @date: 2025/8/7 15:49
|
|
* @date: 2025/8/7 15:49
|
|
*/
|
|
*/
|
|
@@ -350,13 +350,14 @@ public SuggestionVO KeywordForSuggestions(HashMap<String,String> header, String
|
|
List<TrafficBO> list = new ArrayList<>();
|
|
List<TrafficBO> list = new ArrayList<>();
|
|
JSONArray organics = postObject.getByPath("tasks[0].result[0].items[0].metrics.organic", JSONArray.class);
|
|
JSONArray organics = postObject.getByPath("tasks[0].result[0].items[0].metrics.organic", JSONArray.class);
|
|
JSONArray paids = postObject.getByPath("tasks[0].result[0].items[0].metrics.paid", JSONArray.class);
|
|
JSONArray paids = postObject.getByPath("tasks[0].result[0].items[0].metrics.paid", JSONArray.class);
|
|
- Map<Integer, Long> temp = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Long> temp = new HashMap<>();
|
|
if(organics!=null&&!organics.isEmpty()){
|
|
if(organics!=null&&!organics.isEmpty()){
|
|
for (Object organic : organics) {
|
|
for (Object organic : organics) {
|
|
JSONObject obj = (JSONObject) organic;
|
|
JSONObject obj = (JSONObject) organic;
|
|
int month = obj.getByPath("month", Integer.class);
|
|
int month = obj.getByPath("month", Integer.class);
|
|
|
|
+ int year = obj.getByPath("year", Integer.class);
|
|
long organicCount = obj.getByPath("count", Long.class);
|
|
long organicCount = obj.getByPath("count", Long.class);
|
|
- temp.put(month,organicCount);
|
|
|
|
|
|
+ temp.put(year+"-"+month,organicCount);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(paids!=null&&!paids.isEmpty()){
|
|
if(paids!=null&&!paids.isEmpty()){
|
|
@@ -364,9 +365,10 @@ public SuggestionVO KeywordForSuggestions(HashMap<String,String> header, String
|
|
TrafficBO bo = new TrafficBO();
|
|
TrafficBO bo = new TrafficBO();
|
|
JSONObject obj = (JSONObject) paid;
|
|
JSONObject obj = (JSONObject) paid;
|
|
int month = obj.getByPath("month", Integer.class);
|
|
int month = obj.getByPath("month", Integer.class);
|
|
|
|
+ int year = obj.getByPath("year", Integer.class);
|
|
long paidCount = obj.getByPath("count", Long.class);
|
|
long paidCount = obj.getByPath("count", Long.class);
|
|
- long organicCount = temp.get(month);
|
|
|
|
- bo.setX_axis(month);
|
|
|
|
|
|
+ long organicCount = temp.get(year+"-"+month);
|
|
|
|
+ bo.setX_axis(year+"-"+month);
|
|
bo.setPaid(paidCount);
|
|
bo.setPaid(paidCount);
|
|
bo.setOrganic(organicCount);
|
|
bo.setOrganic(organicCount);
|
|
list.add(bo);
|
|
list.add(bo);
|