Browse Source

用户行为标签

huangzhiguo 2 years ago
parent
commit
a2eaaf197e

+ 3 - 2
src/main/java/com/caimei365/tools/controller/BaseApi.java

@@ -62,9 +62,10 @@ public class BaseApi {
      * 临时接口
      */
     /*@GetMapping("/record/update")
-    public void svipCoupon(Integer startId, Integer endId) throws IOException {
+    public void svipCoupon() throws IOException {
 //        cmVipCouponService.openCoupon();
-        cmBehaviorRecordService.updateClubAddress(startId, endId);
+//        cmBehaviorRecordService.updateClubAddress(startId, endId);
+        cmBehaviorRecordService.insertTodayData();
     }*/
 
     /**

+ 40 - 8
src/main/java/com/caimei365/tools/service/impl/CmBehaviorRecordServiceImpl.java

@@ -371,12 +371,28 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
             int num = 0;
             for (CmBehaviorRecordPo recordPo : selDataList) {
                 if (recordPo.getIP().equals(data.getIP()) && recordPo.getUserId().equals(data.getUserId())) {
+                    // 标签信息 对多存储10个
                     if (num < 10) {
-                        if (keywords.contains(recordPo.getPageLabel())) {
-                            if (!item.contains(recordPo.getPageLabel())) {
-                                item.add(recordPo.getPageLabel());
-                                num++;
+                        if (StringUtils.isNotBlank(recordPo.getPageLabel())) {
+                            if (recordPo.getPageLabel().contains(",")) {
+                                String[] split = recordPo.getPageLabel().split(",");
+                                for (String s : split) {
+                                    if (keywords.contains(s)) {
+                                        if (!item.contains(s)) {
+                                            item.add(s);
+                                            num++;
+                                        }
+                                    }
+                                }
+                            } else {
+                                if (keywords.contains(recordPo.getPageLabel())) {
+                                    if (!item.contains(recordPo.getPageLabel())) {
+                                        item.add(recordPo.getPageLabel());
+                                        num++;
+                                    }
+                                }
                             }
+
                         }
                     }
                     if (StringUtils.isNotBlank(recordPo.getRelevanceShop()) && !shopNames.contains(recordPo.getRelevanceShop())) {
@@ -420,11 +436,26 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                 if (recordPo.getIP().equals(data.getIP()) && recordPo.getUserId().equals(data.getUserId())) {
                     // 标签信息
                     if (num < 10) {
-                        if (keywords.contains(recordPo.getPageLabel())) {
-                            if (!item.contains(recordPo.getPageLabel())) {
-                                item.add(recordPo.getPageLabel());
-                                num++;
+                        if (StringUtils.isNotBlank(recordPo.getPageLabel())) {
+                            if (recordPo.getPageLabel().contains(",")) {
+                                String[] split = recordPo.getPageLabel().split(",");
+                                for (String s : split) {
+                                    if (keywords.contains(s)) {
+                                        if (!item.contains(s)) {
+                                            item.add(s);
+                                            num++;
+                                        }
+                                    }
+                                }
+                            } else {
+                                if (keywords.contains(recordPo.getPageLabel())) {
+                                    if (!item.contains(recordPo.getPageLabel())) {
+                                        item.add(recordPo.getPageLabel());
+                                        num++;
+                                    }
+                                }
                             }
+
                         }
                     }
                     // 供应商
@@ -436,6 +467,7 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
             data.setLabel(StringUtils.strip(item.toString(), "[]"));
             data.setRelevanceShop(StringUtils.strip(shopNames.toString(), "[]"));
             recordMapper.inBehaviorToday(data);
+            log.info("====今日用户行为列表数据已生成====");
         }
     }