浏览代码

CRM系统升级优化

kaick 1 年之前
父节点
当前提交
228d8c5102

+ 1 - 1
src/main/java/com/caimei365/tools/mapper/BaseMapper.java

@@ -113,7 +113,7 @@ public interface BaseMapper {
 
     List<Integer> getRecommendKeyword(String date);
 
-    List<Map<String,Object>> getBehaviorRecordYesterday(String accessTime);
+    List<Map<String,Object>> getBehaviorRecordYesterday(@Param("accessTime") String accessTime);
 
     String getBehaviorRecordYesterdayPageLabel(@Param("spId") Integer spId,@Param("clubId") Integer clubId,@Param("accessTime")String accessTime);
 

+ 11 - 0
src/main/java/com/caimei365/tools/model/dto/message/InsideMessage.java

@@ -129,12 +129,23 @@ public class InsideMessage implements Serializable {
     /** 当前id */
     private Integer thisId;
 
+    /** 数量 */
+    private Integer sum;
+
     /**
      * 供应商公司名称
      */
 
     private String shopName;
 
+    public Integer getSum() {
+        return sum;
+    }
+
+    public void setSum(Integer sum) {
+        this.sum = sum;
+    }
+
     public Integer getId() {
         return id;
     }

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

@@ -45,8 +45,8 @@ public class StatisticsTask {
     private RedisTemplate<String, String> redisTemplate;
     @Resource
     private CommodityFeign commodityFeign;
-
-    private final MessageSender messageSender;
+    @Resource
+    private  MessageSender messageSender;
 
     /**
      * 每天凌晨3点执行一次统计前一天商品访问量
@@ -112,7 +112,7 @@ public class StatisticsTask {
             for (Map<String, Object> map : behaviorRecordYesterday) {
                 Integer spId = (Integer) map.get("spId");
                 String name = (String) map.get("name");
-                Double count = (Double) map.get("count");
+                Integer count = Integer.valueOf(map.get("count").toString()) ;
                 String pageLabel = baseMapper.getBehaviorRecordYesterdayPageLabel(spId, null, dateStr);
                 String openId = baseMapper.getWechatOpenId((String) map.get("unionId"));
                 //站内信
@@ -125,7 +125,7 @@ public class StatisticsTask {
                                 .shopTieredType(7)
                                 .name(name)
                                 .content(pageLabel)
-                                .couponFee(count)
+                                .sum(count)
                                 .thisId(spId)
                         );
                 messageSender.messageSend(insideMessageMessageModel);
@@ -144,7 +144,7 @@ public class StatisticsTask {
                                 .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
                                 .keyWords(keyWords)
                                 .remark("为了更好给您服务,请及时联系采美客服!")
-                                .pagePath("pages/seller/club/list?type=wechat"));
+                                .pagePath("pages/seller/notice/service/Institutional_visits?spId="+spId+"&accDateTime="+dateStr));
                 messageSender.messageSend(wechatTemplateMessageMessageModel);
             }
             //访问商城形式的不活跃行为 短信推送
@@ -156,7 +156,7 @@ public class StatisticsTask {
                 if (null != clubPo.getSpID()) {
                     String mobile = baseMapper.findMobile(baseMapper.findSpUserId(clubPo.getSpID()));
                     if (StringUtils.isNotBlank(mobile)) {
-                        SmsUtil.sendSms(1, mobile, "【采美365】该机构客户已有6个月未在商城活跃,请及时跟进。机构名称【" + clubPo.getName() + "】,联系人【" + clubPo.getLinkMan() + "】,手机号【" + clubPo.getContractMobile() + "】。微信小程序微信小程序https://....comm,退订回T。");
+                        SmsUtil.sendSms(1, mobile, "【采美365】该机构客户已有6个月未在商城活跃,请及时跟进。机构名称【" + clubPo.getName() + "】,联系人【" + clubPo.getLinkMan() + "】,手机号【" + clubPo.getContractMobile() + "】。");
                     }
                 }
             }

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

@@ -211,10 +211,10 @@
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         WHERE b.userId !=0
-          and b.pageType in (6, 8, 11)
-          and DATE (b.accessTime) = DATE (#{accessTime})
+        and b.pageType in (6, 8, 11)
+        and DATE (b.accessTime) = DATE (#{accessTime})
         GROUP BY c.spId
-        ORDER BY count (c.clubId) DESC
+        ORDER BY count(c.clubId) DESC
     </select>
     <select id="getBehaviorRecordYesterdayPageLabel" resultType="string">
         SELECT GROUP_CONCAT(a.pageLabel)
@@ -228,7 +228,7 @@
             </if>
               and b.pageType in(6,8,11)
               and  DATE(b.accessTime) = DATE(#{accessTime})
-              GROUP BY b.pageLabel LIMIT 10) as a
+              GROUP BY b.pageLabel LIMIT 5) as a
     </select>
     <select id="getWechatOpenId" resultType="string">
         SELECT openid

+ 2 - 2
src/main/resources/mapper/MessageCenter.xml

@@ -10,10 +10,10 @@
     <insert id="sendInsideMessage">
         INSERT INTO message_center (shopID, clubID, orderID, userType, messageType, accountType, orderMessageType,
                                     couponMessageType, couponFee, content, time, saved, shopMessType,
-                                    shopTieredType, couponType, productID,reasonContent,mobile,name,userName,superUserName,thisId)
+                                    shopTieredType, couponType, productID,reasonContent,mobile,name,userName,superUserName,thisId,sum)
         VALUES (#{shopId}, #{clubId}, #{orderId}, #{userType}, #{messageType}, #{accountType}, #{orderMessageType},
                 #{couponMessageType}, #{couponFee}, #{content}, now(), 0, #{shopMessType},
-                #{shopTieredType}, #{couponType}, #{productId}, #{reasonContent},#{mobile},#{name},#{userName},#{superUserName},#{thisId})
+                #{shopTieredType}, #{couponType}, #{productId}, #{reasonContent},#{mobile},#{name},#{userName},#{superUserName},#{thisId},#{sum})
     </insert>
     <insert id="addNotification">
         INSERT INTO notification(theme, newTime, shopContent, porductID, shopID)

+ 26 - 2
src/test/java/com/caimei365/tools/ToolsApplicationTests.java

@@ -1,19 +1,43 @@
 //package com.caimei365.tools;
 //
+//import com.caimei365.tools.model.dto.message.MessageModel;
+//import com.caimei365.tools.model.dto.message.MqInfo;
+//import com.caimei365.tools.model.dto.message.WechatTemplateMessage;
+//import com.caimei365.tools.model.dto.message.enums.MessageType;
+//import com.caimei365.tools.service.MessageSender;
 //import com.caimei365.tools.utils.SmsUtil;
 //import org.junit.jupiter.api.Test;
 //import org.springframework.boot.test.context.SpringBootTest;
 //import org.yaml.snakeyaml.scanner.ScannerImpl;
 //
+//import javax.annotation.Resource;
+//import java.util.ArrayList;
 //import java.util.Calendar;
 //import java.util.Date;
 //
 //@SpringBootTest
 //class ToolsApplicationTests {
-//
+//    @Resource
+//    private MessageSender messageSender;
 //    @Test
 //    void contextLoads() {
-//
+////微信模板消息
+//        ArrayList<String> keyWords = new ArrayList<>();
+//        keyWords.add("name"+"...等"+7+"家机构客户");
+//        keyWords.add("pageLabel");
+//        keyWords.add("2023-09-12");
+//        MessageModel<WechatTemplateMessage> wechatTemplateMessageMessageModel = new MessageModel<WechatTemplateMessage>()
+//                .code(MessageType.WECHAT_TEMPLATE_MESSAGE)
+//                .mqInfo(new MqInfo().topic("MessageLine").delay(3).async(0))
+//                .info(new WechatTemplateMessage()
+//                        .first("")
+//                        .openId("o9nzn5yD6IOcFuhG4b3OG1droVJw")
+//                        .appid("wxf3cd4ae0cdd11c36")
+//                        .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
+//                        .keyWords(keyWords)
+//                        .remark("为了更好给您服务,请及时联系采美客服!")
+//                        .pagePath("pages/seller/notice/service/Institutional_visits?spId="+1379+"&accDateTime="+"2023-09-12"));
+//        messageSender.messageSend(wechatTemplateMessageMessageModel);
 //    }
 //
 ////    @Test