|
@@ -47,8 +47,10 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
|
} else {
|
|
|
cmBehaviorRecordPo.setUserId("0");
|
|
|
}
|
|
|
+ boolean flag = true;
|
|
|
if (ipSavePo.getParams().contains("userId") || ipSavePo.getParams().contains("productId")) {
|
|
|
String[] split = ipSavePo.getParams().split("&");
|
|
|
+
|
|
|
for (String s : split) {
|
|
|
String str = s.trim();
|
|
|
// 页面路径
|
|
@@ -113,9 +115,7 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isBlank(cmBehaviorRecordPo.getPageLabel()) || StringUtils.isEmpty(cmBehaviorRecordPo.getPageLabel())) {
|
|
|
- cmBehaviorRecordPo.setPageLabel(" ");
|
|
|
- }
|
|
|
+
|
|
|
// 用户行为记录 or roos页面统计
|
|
|
if (str.startsWith("behaviorType") && str.contains("=")) {
|
|
|
String[] split1 = str.split("=");
|
|
@@ -207,7 +207,8 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
|
if (StringUtils.isNotBlank(trim)) {
|
|
|
// 浏览器userAgent
|
|
|
cmBehaviorRecordPo.setUserAgent(trim);
|
|
|
- if (boolReptiles(trim)) {
|
|
|
+ flag = boolReptiles(trim);
|
|
|
+ if (flag) {
|
|
|
cmBehaviorRecordPo.setDelFlag("1");
|
|
|
}
|
|
|
}
|
|
@@ -242,8 +243,85 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ // 处理页面标签为空
|
|
|
+ if (StringUtils.isBlank(cmBehaviorRecordPo.getPageLabel()) || StringUtils.isEmpty(cmBehaviorRecordPo.getPageLabel())) {
|
|
|
+ String pageLabel = "";
|
|
|
+ if (6 == cmBehaviorRecordPo.getPageType()) {
|
|
|
+ // 商品详情
|
|
|
+ String productId = "";
|
|
|
+ if ("0".equals(cmBehaviorRecordPo.getAccessClient())) {
|
|
|
+ // 网站访问
|
|
|
+ String[] labelPath = cmBehaviorRecordPo.getPagePath().split("-");
|
|
|
+ if (labelPath[1].contains(".html")) {
|
|
|
+ // http://localhost:8009/product-1017.html
|
|
|
+ productId = labelPath[1].substring(0, labelPath[1].lastIndexOf(".html"));
|
|
|
+ } else {
|
|
|
+ // http://localhost:8009/product-7425-5.html
|
|
|
+ productId = labelPath[1];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 小程序访问
|
|
|
+ if (cmBehaviorRecordPo.getPagePath().contains("id=")) {
|
|
|
+ if (cmBehaviorRecordPo.getPagePath().contains("&typeId")) {
|
|
|
+ // /pages/goods/product?id=7425&typeId=5
|
|
|
+ productId = cmBehaviorRecordPo.getPagePath().substring(cmBehaviorRecordPo.getPagePath().indexOf("id="), cmBehaviorRecordPo.getPagePath().lastIndexOf("&typeId"));
|
|
|
+ } else {
|
|
|
+ // /pages/goods/product?id=1017
|
|
|
+ productId = cmBehaviorRecordPo.getPagePath().substring(cmBehaviorRecordPo.getPagePath().indexOf("id=")+3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ pageLabel = recordMapper.getProductPageLabel(Integer.parseInt(productId.trim()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else if (11 == cmBehaviorRecordPo.getPageType()) {
|
|
|
+ String infoId = "";
|
|
|
+ // 文章详情
|
|
|
+ if ("0".equals(cmBehaviorRecordPo.getAccessClient())) {
|
|
|
+ // 网站
|
|
|
+ // https://www.caimei365.com/info/detail-5555-1.html
|
|
|
+ String[] labelPath = cmBehaviorRecordPo.getPagePath().split("-");
|
|
|
+ if (labelPath[1].contains(".html")) {
|
|
|
+ // 暂无该情况
|
|
|
+ infoId = labelPath[1].substring(0, labelPath[1].lastIndexOf(".html"));
|
|
|
+ }else {
|
|
|
+ infoId = labelPath[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ pageLabel = recordMapper.getInfoPageLabel(Integer.parseInt(infoId.trim()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else if (12 == cmBehaviorRecordPo.getPageType()){
|
|
|
+ String baikeId = "";
|
|
|
+ // 采美百科
|
|
|
+ if ("0".equals(cmBehaviorRecordPo.getAccessClient())) {
|
|
|
+ // 网站
|
|
|
+ // https://www.caimei365.com/encyclopedia/instrument-10.html
|
|
|
+ String[] labelPath = cmBehaviorRecordPo.getPagePath().split("-");
|
|
|
+ if (labelPath[1].contains(".html")) {
|
|
|
+ baikeId = labelPath[1].substring(0, labelPath[1].lastIndexOf(".html"));
|
|
|
+ }else {
|
|
|
+ // 暂无该情况
|
|
|
+ baikeId = labelPath[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ pageLabel = recordMapper.getBaiKePageLabel(Integer.parseInt(baikeId.trim()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(pageLabel) || StringUtils.isEmpty(pageLabel)) {
|
|
|
+ // 为空查询页面标签、或者使用初始默认数据
|
|
|
+ pageLabel = recordMapper.getPageLabel(cmBehaviorRecordPo.getPageType());
|
|
|
+ }
|
|
|
+ cmBehaviorRecordPo.setPageLabel(pageLabel);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
Date date = new Date();
|
|
|
cmBehaviorRecordPo.setAccessTime(date);
|
|
|
cmBehaviorRecordPo.setAccessDuration("5000");
|
|
@@ -259,37 +337,39 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
cmBehaviorRecordPo.setRegion(region);
|
|
|
- recordMapper.insertRecord(cmBehaviorRecordPo);
|
|
|
-
|
|
|
- int recordId = cmBehaviorRecordPo.getRecordID();
|
|
|
- if (cmBehaviorRecordPo.getShopId() != null) {
|
|
|
- if (14 != cmBehaviorRecordPo.getPageType()) {
|
|
|
- if (StringUtils.isNotBlank(cmBehaviorRecordPo.getPageLabel())) {
|
|
|
- List<String> strList = new ArrayList<>();
|
|
|
- // 页面标签在含有多个,包含 , 是可分割,进行分割作为关键词
|
|
|
- if (cmBehaviorRecordPo.getPageLabel().contains(",")) {
|
|
|
- String[] split = cmBehaviorRecordPo.getPageLabel().split(",");
|
|
|
- for (String s : split) {
|
|
|
- strList.add(s);
|
|
|
+ // if (flag) {
|
|
|
+ recordMapper.insertRecord(cmBehaviorRecordPo);
|
|
|
+
|
|
|
+ int recordId = cmBehaviorRecordPo.getRecordID();
|
|
|
+ if (cmBehaviorRecordPo.getShopId() != null) {
|
|
|
+ if (14 != cmBehaviorRecordPo.getPageType()) {
|
|
|
+ if (StringUtils.isNotBlank(cmBehaviorRecordPo.getPageLabel())) {
|
|
|
+ List<String> strList = new ArrayList<>();
|
|
|
+ // 页面标签在含有多个,包含 , 是可分割,进行分割作为关键词
|
|
|
+ if (cmBehaviorRecordPo.getPageLabel().contains(",")) {
|
|
|
+ String[] split = cmBehaviorRecordPo.getPageLabel().split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ strList.add(s);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strList.add(cmBehaviorRecordPo.getPageLabel());
|
|
|
}
|
|
|
- } else {
|
|
|
- strList.add(cmBehaviorRecordPo.getPageLabel());
|
|
|
- }
|
|
|
- // 供应商id
|
|
|
- List<Integer> shopIds = recordMapper.shopIds(strList);
|
|
|
- if (shopIds.size() > 0) {
|
|
|
- for (Integer shopId : shopIds) {
|
|
|
- recordMapper.insertShopId(recordId, shopId);
|
|
|
+ // 供应商id
|
|
|
+ List<Integer> shopIds = recordMapper.shopIds(strList);
|
|
|
+ if (shopIds.size() > 0) {
|
|
|
+ for (Integer shopId : shopIds) {
|
|
|
+ recordMapper.insertShopId(recordId, shopId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- Integer id = recordMapper.selShopId(cmBehaviorRecordPo.getShopId());
|
|
|
- if (id != null) {
|
|
|
- recordMapper.insertShopId(recordId, cmBehaviorRecordPo.getShopId());
|
|
|
+ } else {
|
|
|
+ Integer id = recordMapper.selShopId(cmBehaviorRecordPo.getShopId());
|
|
|
+ if (id != null) {
|
|
|
+ recordMapper.insertShopId(recordId, cmBehaviorRecordPo.getShopId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ //}
|
|
|
}
|
|
|
}
|
|
|
|