Browse Source

内容库V1.0.0

kaick 1 year ago
parent
commit
31d7ff3f9a

+ 4 - 3
src/main/java/com/caimei365/tools/task/StatisticsTask.java

@@ -14,6 +14,7 @@ import com.caimei365.tools.utils.SmsUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.core.RedisCallback;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -177,7 +178,7 @@ public class StatisticsTask {
     public void behaviorRecordMinute() {
         try {
             Calendar calendar = Calendar.getInstance();
-            String dateNewStr = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
+            String dateNewStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:00").format(calendar.getTime());
             calendar.add(Calendar.MINUTE, -5);
             String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
             List<Map<String, Object>> behaviorRecordClubMinute = baseMapper.getBehaviorRecordClubMinute(dateStr);
@@ -225,7 +226,7 @@ public class StatisticsTask {
                     ArrayList<String> keyWords = new ArrayList<>();
                     keyWords.add(name+"...等"+count+"家机构客户访问了您的内容库资料分享");
                     keyWords.add(pageLabel);
-                    keyWords.add(dateNewStr);
+                    keyWords.add(DateFormatUtils.format(calendar.getTime(), "yyyy-MM-dd"));
                     MessageModel<WechatTemplateMessage> wechatTemplateMessageMessageModel = new MessageModel<WechatTemplateMessage>()
                             .code(MessageType.WECHAT_TEMPLATE_MESSAGE)
                             .mqInfo(new MqInfo().topic("MessageLine").delay(3).async(1))
@@ -236,7 +237,7 @@ public class StatisticsTask {
                                     .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
                                     .keyWords(keyWords)
                                     .remark("为了更好给您服务,请及时联系采美客服!")
-                                    .pagePath("pages/seller/notice/service/Institutional_visits?type=1&spId="+spId+"&accDateTime="+dateStr));
+                                    .pagePath("pages/seller/notice/service/Institutional_visits?type=1&spId="+spId+"&accDateTime="+dateNewStr));
                     messageSender.messageSend(wechatTemplateMessageMessageModel);
             }
             log.info(">>>>>>>>>>>【定时任务】统计内容库访问活跃行为,统计成功");

+ 4 - 4
src/main/resources/mapper/CmBehaviorRecordMapper.xml

@@ -356,8 +356,8 @@
             SUM(b.accessDuration) AS accessDuration,
             b.accessDate,
             b.accessClient,
-            MAX(CASE WHEN b.headUserId IS NOT NULL THEN b.headUserId END),
-            MAX(CASE WHEN b.productArchiveId IS NOT NULL THEN b.productArchiveId END),
+            MAX(CASE WHEN b.headUserId IS NOT NULL THEN b.headUserId END) as headUserId,
+            MAX(CASE WHEN b.productArchiveId IS NOT NULL THEN b.productArchiveId END) as productArchiveId,
             b.region AS region,
             u.registerTime AS addTime,
             (SELECT touristId FROM cm_behavior_record WHERE accessDate = #{accessDate} and IP = b.IP ORDER BY accessTime DESC LIMIT 1) AS touristId,
@@ -468,8 +468,8 @@
             SUM(b.accessDuration) AS accessDuration,
             b.accessDate,
             b.accessClient,
-            MAX(CASE WHEN b.headUserId IS NOT NULL THEN b.headUserId END),
-            MAX(CASE WHEN b.productArchiveId IS NOT NULL THEN b.productArchiveId END),
+            MAX(CASE WHEN b.headUserId IS NOT NULL THEN b.headUserId END) as headUserId,
+            MAX(CASE WHEN b.productArchiveId IS NOT NULL THEN b.productArchiveId END) as productArchiveId,
             b.region AS region,
             u.registerTime AS addTime
         FROM cm_behavior_record b