瀏覽代碼

用户行为优化1.0.5

huangzhiguo 1 年之前
父節點
當前提交
d6fe58bf7a

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

@@ -89,17 +89,15 @@ public class BaseApi {
      */
      */
     /*@GetMapping("/record/message")
     /*@GetMapping("/record/message")
     public void getMessage(){
     public void getMessage(){
-        messageService.UnActiveMessage();
+        messageService.getBehaviorActiveInfo();
     }*/
     }*/
 
 
     /**
     /**
      * 临时接口
      * 临时接口
      */
      */
     /*@GetMapping("/base/oldData")
     /*@GetMapping("/base/oldData")
-    public void oldData(String startTime, String endTime) {
-//        cmBehaviorRecordService.pageStatistics(dateTime);
-//        cmBehaviorRecordService.insertTodayData();
-        cmBehaviorRecordService.clubDemand(startTime, endTime);
+    public void oldData() {
+        cmBehaviorRecordService.clubBehaviorInfo();
     }*/
     }*/
 
 
     @ApiOperation("获取小程序二维码图片")
     @ApiOperation("获取小程序二维码图片")

+ 4 - 0
src/main/java/com/caimei365/tools/model/po/CmBehaviorInfo.java

@@ -52,6 +52,10 @@ public class CmBehaviorInfo {
      * 分配人
      * 分配人
      */
      */
     private String allocation;
     private String allocation;
+    /**
+     * 数据生成时间 日常访问
+     */
+    private String dateTime;
     /**
     /**
      * 添加时间
      * 添加时间
      */
      */

+ 5 - 1
src/main/java/com/caimei365/tools/model/po/MessageCenterPo.java

@@ -29,7 +29,7 @@ public class MessageCenterPo implements Serializable {
      */
      */
     private Integer orderId;
     private Integer orderId;
     /**
     /**
-     * 用户类型1.机构2.供应商
+     * 用户类型 1.机构 2.供应商 3.协销 4.颜选用户
      */
      */
     private Integer userType;
     private Integer userType;
     /**
     /**
@@ -114,4 +114,8 @@ public class MessageCenterPo implements Serializable {
      * 供应商公司名称
      * 供应商公司名称
      */
      */
     private String shopName;
     private String shopName;
+    /**
+     * 失败原因
+     */
+    private String reasonContent;
 }
 }

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

@@ -146,6 +146,9 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                             }
                             }
                         }
                         }
                     }
                     }
+                    if (StringUtils.isEmpty(cmBehaviorRecordPo.getBehaviorType()) || StringUtils.isNotBlank(cmBehaviorRecordPo.getBehaviorType())) {
+                        cmBehaviorRecordPo.setBehaviorType("0");
+                    }
                     // 供应商Id
                     // 供应商Id
                     if (str.startsWith("shopId") && str.contains("=")) {
                     if (str.startsWith("shopId") && str.contains("=")) {
                         String[] split1 = str.split("=");
                         String[] split1 = str.split("=");
@@ -1165,7 +1168,24 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                         // 设置机构访问页面类型和标签
                         // 设置机构访问页面类型和标签
                         List<CmBehaviorRecordPo> collect = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageLabels())).collect(Collectors.toList());
                         List<CmBehaviorRecordPo> collect = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageLabels())).collect(Collectors.toList());
                         List<String> pageLabelList = collect.stream().map(CmBehaviorRecordPo::getPageLabels).collect(Collectors.toList());
                         List<String> pageLabelList = collect.stream().map(CmBehaviorRecordPo::getPageLabels).collect(Collectors.toList());
-                        String strip = StringUtils.strip(pageLabelList.toString(), "[]");
+                        List<String> labelList = new ArrayList<>();
+                        for (String pageLabel : pageLabelList) {
+                            if (StringUtils.isNotBlank(pageLabel)) {
+                                if (pageLabel.contains(",")) {
+                                    String[] split = pageLabel.split(",");
+                                    for (String str : split) {
+                                        if (!labelList.contains(str) && StringUtils.isNotBlank(str) && StringUtils.isNotEmpty(str)) {
+                                            labelList.add(str);
+                                        }
+                                    }
+                                } else {
+                                    if (!labelList.contains(pageLabel) && StringUtils.isNotBlank(pageLabel) && StringUtils.isNotEmpty(pageLabel)) {
+                                        labelList.add(pageLabel);
+                                    }
+                                }
+                            }
+                        }
+                        String strip = StringUtils.strip(labelList.toString(), "[]");
                         if (StringUtils.isNotBlank(strip)) {
                         if (StringUtils.isNotBlank(strip)) {
                             cmBehaviorInfo.setLabel(strip.endsWith(".") ? strip.substring(strip.length() - 1) : strip);
                             cmBehaviorInfo.setLabel(strip.endsWith(".") ? strip.substring(strip.length() - 1) : strip);
                         } else {
                         } else {
@@ -1173,12 +1193,30 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                         }
                         }
                         List<CmBehaviorRecordPo> collect1 = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageTypes())).collect(Collectors.toList());
                         List<CmBehaviorRecordPo> collect1 = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageTypes())).collect(Collectors.toList());
                         List<String> pageTypesList = collect1.stream().map(CmBehaviorRecordPo::getPageTypes).collect(Collectors.toList());
                         List<String> pageTypesList = collect1.stream().map(CmBehaviorRecordPo::getPageTypes).collect(Collectors.toList());
-                        String strip1 = StringUtils.strip(pageTypesList.toString(), "[]");
+                        List<String> typesList = new ArrayList<>();
+                        for (String pageTypes : pageTypesList) {
+                            if (StringUtils.isNotBlank(pageTypes)) {
+                                if (pageTypes.contains(",")) {
+                                    String[] split = pageTypes.split(",");
+                                    for (String str : split) {
+                                        if (!typesList.contains(str) && StringUtils.isNotBlank(str) && StringUtils.isNotEmpty(str)) {
+                                            typesList.add(str);
+                                        }
+                                    }
+                                } else {
+                                    if (!typesList.contains(pageTypes) && StringUtils.isNotBlank(pageTypes) && StringUtils.isNotEmpty(pageTypes)) {
+                                        typesList.add(pageTypes);
+                                    }
+                                }
+                            }
+                        }
+                        String strip1 = StringUtils.strip(typesList.toString(), "[]");
                         if (StringUtils.isNotBlank(strip1)) {
                         if (StringUtils.isNotBlank(strip1)) {
                             cmBehaviorInfo.setPageType(strip1);
                             cmBehaviorInfo.setPageType(strip1);
                         } else {
                         } else {
                             cmBehaviorInfo.setPageType("");
                             cmBehaviorInfo.setPageType("");
                         }
                         }
+                        cmBehaviorInfo.setDateTime(format);
                         recordMapper.insertBehaviorInfo(cmBehaviorInfo);
                         recordMapper.insertBehaviorInfo(cmBehaviorInfo);
                     }
                     }
                 }
                 }

+ 11 - 1
src/main/java/com/caimei365/tools/service/impl/MessageServiceImpl.java

@@ -1,8 +1,11 @@
 package com.caimei365.tools.service.impl;
 package com.caimei365.tools.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei365.tools.mapper.MessageCenterMapper;
 import com.caimei365.tools.mapper.MessageMapper;
 import com.caimei365.tools.mapper.MessageMapper;
+import com.caimei365.tools.model.dto.message.InsideMessage;
 import com.caimei365.tools.model.po.ClubPo;
 import com.caimei365.tools.model.po.ClubPo;
+import com.caimei365.tools.model.po.MessageCenterPo;
 import com.caimei365.tools.model.po.ServiceproviderPo;
 import com.caimei365.tools.model.po.ServiceproviderPo;
 import com.caimei365.tools.service.MessageService;
 import com.caimei365.tools.service.MessageService;
 import com.caimei365.tools.utils.RequestUtil;
 import com.caimei365.tools.utils.RequestUtil;
@@ -36,6 +39,8 @@ public class MessageServiceImpl implements MessageService {
 
 
     @Resource private MessageMapper messageMapper;
     @Resource private MessageMapper messageMapper;
 
 
+    @Resource private MessageCenterMapper messageCenterMapper;
+
     /**
     /**
      * 协销不活跃机构
      * 协销不活跃机构
      */
      */
@@ -107,10 +112,11 @@ public class MessageServiceImpl implements MessageService {
     }
     }
 
 
     /**
     /**
-     * 活跃机构发送模板消息
+     * 协销活跃机构发送模板消息 -- 活跃用户 未填写咨询记录
      */
      */
     @Override
     @Override
     public void getBehaviorActiveInfo() {
     public void getBehaviorActiveInfo() {
+        log.info("协销活跃机构发送模板消息 -- 活跃用户 未填写咨询记录 === 开始");
         Date date = new Date();
         Date date = new Date();
         // 获取三天前日期
         // 获取三天前日期
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -185,8 +191,12 @@ public class MessageServiceImpl implements MessageService {
                 } catch (Exception e) {
                 } catch (Exception e) {
                     log.info("推送微信模板消息失败:" + e);
                     log.info("推送微信模板消息失败:" + e);
                 }
                 }
+                InsideMessage insideMessage = new InsideMessage();
+                insideMessage.thisId(serviceprovider.getServiceProviderId()).userType(3).messageType(3).shopTieredType(11).content(clubName + "待你填写咨询记录").time(dateFormat.format(date));
+                messageCenterMapper.sendInsideMessage(insideMessage);
             }
             }
         }
         }
+        log.info("协销活跃机构发送模板消息 -- 活跃用户 未填写咨询记录=====结束");
     }
     }
 
 
 
 

+ 1 - 1
src/main/java/com/caimei365/tools/task/CmOrganValueSystemTask.java

@@ -99,7 +99,7 @@ public class CmOrganValueSystemTask {
     }
     }
 
 
     /**
     /**
-     * 每天10点 给协销微信模板提醒 -- 不活跃机构
+     * 每天下午3点 给协销微信模板提醒 -- 活跃机构未填写咨询记录
      */
      */
     @Scheduled(cron = "0 0 15 * * ?")
     @Scheduled(cron = "0 0 15 * * ?")
     public void getBehaviorActiveMessage() {
     public void getBehaviorActiveMessage() {

+ 8 - 5
src/main/resources/mapper/CmBehaviorRecordMapper.xml

@@ -736,14 +736,14 @@
     </update>
     </update>
 
 
     <select id="getClubData" resultType="com.caimei365.tools.model.po.CmClubPo">
     <select id="getClubData" resultType="com.caimei365.tools.model.po.CmClubPo">
-        select clubId, userId, spId from club
+        select clubId, ifnull(userId, 0) as userId, ifnull(spId, 1342) as spId from club
     </select>
     </select>
 
 
     <select id="getClubBehaviorPage" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
     <select id="getClubBehaviorPage" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
         SELECT
         SELECT
             b.IP,
             b.IP,
-            b.userID,
-            c.clubID,
+            b.userId,
+            c.clubId,
             GROUP_CONCAT(b.pageLabel) as pageLabels,
             GROUP_CONCAT(b.pageLabel) as pageLabels,
             GROUP_CONCAT(cpt.pageType) as pageTypes,
             GROUP_CONCAT(cpt.pageType) as pageTypes,
             b.delFlag
             b.delFlag
@@ -768,8 +768,10 @@
                                         pageType,
                                         pageType,
                                      </if>
                                      </if>
                                      label,
                                      label,
+                                     dateTime,
                                      addTime,
                                      addTime,
-                                     delFlag)
+                                     delFlag
+                                     )
         values(
         values(
                #{operateObject},
                #{operateObject},
                #{clubId},
                #{clubId},
@@ -778,9 +780,10 @@
                 </if>
                 </if>
                #{type},
                #{type},
                 <if test="pageType != null and pageType != ''">
                 <if test="pageType != null and pageType != ''">
-                    #{pagetType},
+                    #{pageType},
                 </if>
                 </if>
                #{label},
                #{label},
+               #{dateTime},
                now(),
                now(),
                0
                0
                )
                )

+ 2 - 1
src/main/resources/mapper/MessageMapper.xml

@@ -37,9 +37,10 @@
 
 
     <select id="getBehaviorActiveInfo" resultType="com.caimei365.tools.model.po.ClubPo">
     <select id="getBehaviorActiveInfo" resultType="com.caimei365.tools.model.po.ClubPo">
         SELECT
         SELECT
-            cbr.userId,
+            cbr.userId as userID,
             MIN(cbr.accessTime) as behaviorTime,
             MIN(cbr.accessTime) as behaviorTime,
             coas.activeState,
             coas.activeState,
+            c.clubId as clubID,
             c.name AS name,
             c.name AS name,
             c.linkMan AS linkMan
             c.linkMan AS linkMan
         FROM cm_behavior_record cbr
         FROM cm_behavior_record cbr