Bladeren bron

用户行为优化

huangzhiguo 1 jaar geleden
bovenliggende
commit
b6317f5cc6

+ 4 - 86
src/main/java/com/caimei365/manager/controller/caimei/user/CustomerApi.java

@@ -7,6 +7,7 @@ import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.cmUser.*;
 import com.caimei365.manager.service.caimei.user.CustomerService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -21,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
  * @author : Charles
  * @date : 2023/9/5
  */
+@Slf4j
 @RestController
 @RequestMapping("/user/customer")
 public class CustomerApi {
@@ -126,7 +128,8 @@ public class CustomerApi {
      * @return
      */
     @PostMapping("/saveInformation")
-    public ResponseJson saveInformationNotes(HttpServletRequest request, CmInformationNotes cmInformationNotes) {
+    public ResponseJson saveInformationNotes(HttpServletRequest request,@RequestBody CmInformationNotes cmInformationNotes) {
+        log.info("cmInformationNotes====="+cmInformationNotes);
         if (null == cmInformationNotes.getInformationId()) {
             return ResponseJson.error(-1, "游客Id不能为空", null);
         }
@@ -492,89 +495,4 @@ public class CustomerApi {
         }
         return customerService.getPageShopKeyword(shopId, startTime, endTime, pageNum, pageSize);
     }
-
-    /**
-     * 意向数据列表
-     * @param shopId
-     * @param startTime
-     * @param endTime
-     * @param pageNum
-     * @param pageSize
-     * @return
-     */
-    @GetMapping("/getIntentionUserList")
-    public ResponseJson<PaginationVo<CmShopIntentionUser>> getIntentionUserList(Integer shopId, String startTime, String endTime,
-                                                                    @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                                    @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-        if (null == shopId) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
-        }
-        return customerService.getIntentionUserList(shopId, startTime, endTime, pageNum, pageSize);
-    }
-
-    /**
-     * 保存意向客户数据
-     * @param cmShopIntentionUser
-     * @return
-     */
-    @PostMapping("/saveIntentionUser")
-    public ResponseJson saveIntentionUser(CmShopIntentionUser cmShopIntentionUser) {
-        if (null == cmShopIntentionUser.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getStartTime()) {
-            return ResponseJson.error(-1, "统计开始时间不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getEndTime()) {
-            return ResponseJson.error(-1, "统计结束时间不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getAppReadingVolume()) {
-            return ResponseJson.error(-1, "公众号阅读量不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getRedReadingVolume()) {
-            return ResponseJson.error(-1, "小红书阅读量不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getWbReadingVolume()) {
-            return ResponseJson.error(-1, "微博阅读量不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getOtherReadingVolume()) {
-            return ResponseJson.error(-1, "其他渠道阅读量不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getIntentionStrong()) {
-            return ResponseJson.error(-1, "意向强烈人数不能为空", null);
-        }
-        if (null == cmShopIntentionUser.getIntentionOrdinary()) {
-            return ResponseJson.error(-1, "意向普通人数不能为空", null);
-        }
-        return customerService.saveIntentionUser(cmShopIntentionUser);
-    }
-
-    /**
-     * 删除意向客户数据
-     * @param id
-     * @return
-     */
-    @GetMapping("/renewIntentionUser")
-    public ResponseJson renewIntentionUser(Integer id) {
-        if (null == id) {
-            return ResponseJson.error(-1, "id不能为空", null);
-        }
-        return customerService.renewIntentionUser(id);
-    }
-
-    /**
-     * 添加意向客户数据总结
-     * @param id
-     * @return
-     */
-    @GetMapping("/renewIntentionNote")
-    public ResponseJson renewIntentionNote(Integer id, String note) {
-        if (null == id) {
-            return ResponseJson.error(-1, "意向客户数据id不能为空", null);
-        }
-        if (StringUtils.isBlank(note)) {
-            return ResponseJson.error(-1, "意向客户数据总结不能为空", null);
-        }
-        return customerService.renewIntentionNote(id, note);
-    }
 }

+ 13 - 34
src/main/java/com/caimei365/manager/dao/user/CustomerServiceDao.java

@@ -68,6 +68,12 @@ public interface CustomerServiceDao {
      */
     void insertInformationNote(CmInformationNotes cmInformationNotes);
 
+    /**
+     * 添加游客备注图片
+     * @param cmInformationNotesImage
+     */
+    void insertInformationNoteImage(CmInformationNotesImage cmInformationNotesImage);
+
     /**
      * 查询游客备注
      * @param informationId
@@ -75,6 +81,13 @@ public interface CustomerServiceDao {
      */
     List<CmInformationNotes> getInformationNotes(@Param("informationId") Integer informationId);
 
+    /**
+     * 游客备注图片
+     * @param informationNoteId
+     * @return
+     */
+    List<String> getinformationNotesImage(@Param("informationNoteId") Integer informationNoteId);
+
     /**
      * 相关文章列表
      * @param cmShopInfo
@@ -248,38 +261,4 @@ public interface CustomerServiceDao {
      */
     List<CmPageShopKeyword> getPageShopKeyword(@Param("shopId") Integer shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    /**
-     * 意向客户数据列表
-     * @param shopId
-     * @param startTime
-     * @param endTIme
-     * @return
-     */
-    List<CmShopIntentionUser> getIntentionUserList(@Param("shopId") Integer shopId, @Param("startTime") String startTime, @Param("endTime") String endTIme);
-
-    /**
-     * 插入意向客户数据
-     * @param cmShopIntentionUser
-     */
-    void insertIntention(CmShopIntentionUser cmShopIntentionUser);
-
-    /**
-     * 修改意向客户数据
-     * @param cmShopIntentionUser
-     */
-    void updateIntention(CmShopIntentionUser cmShopIntentionUser);
-
-    /**
-     * 删除意向客户数据
-     * @param id
-     */
-    void deleteIntentionUser(@Param("id") Integer id);
-
-    /**
-     * 数据总结
-     * @param id
-     * @param note
-     */
-    void updateIntentionNote(@Param("id") Integer id, @Param("note") String note);
-
 }

+ 8 - 1
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmInformationNotes.java

@@ -2,6 +2,9 @@ package com.caimei365.manager.entity.caimei.cmUser;
 
 import lombok.Data;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * Description
  *
@@ -23,8 +26,12 @@ public class CmInformationNotes {
      * 备注人
      */
     private String noteUser;
+    /**
+     * 备注图片
+     */
+    private List<String> images;
     /**
      * 添加时间
      */
-    private Integer addTime;
+    private String addTime;
 }

+ 23 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmInformationNotesImage.java

@@ -0,0 +1,23 @@
+package com.caimei365.manager.entity.caimei.cmUser;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2023/11/8
+ */
+@Data
+public class CmInformationNotesImage {
+
+    private Integer id;
+    /**
+     * 游客id
+     */
+    private Integer informationNoteId;
+    /**
+     * 图片
+     */
+    private String image;
+}

+ 8 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmRoosInformation.java

@@ -23,6 +23,14 @@ public class CmRoosInformation {
      * 跟进状态 0 已跟进 1 未跟进
      */
     private Integer followUpStatus;
+    /**
+     * 协销id
+     */
+    private Integer serviceProviderId;
+    /**
+     * 协销名称
+     */
+    private String name;
     /**
      * 咨询姓名
      */

+ 0 - 32
src/main/java/com/caimei365/manager/service/caimei/user/CustomerService.java

@@ -246,36 +246,4 @@ public interface CustomerService {
      */
     ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, String startTime, String endTime, Integer pageNum, Integer pageSize);
 
-    /**
-     * 意向客户数据列表
-     * @param shopId
-     * @param startTime
-     * @param endTime
-     * @param pageNum
-     * @param pageSize
-     * @return
-     */
-    ResponseJson<PaginationVo<CmShopIntentionUser>> getIntentionUserList(Integer shopId, String startTime, String endTime, int pageNum, int pageSize);
-
-    /**
-     * 保存意向客户数据
-     * @param cmShopIntentionUser
-     * @return
-     */
-    ResponseJson saveIntentionUser(CmShopIntentionUser cmShopIntentionUser);
-
-    /**
-     * 删除意向客户数据
-     * @param id
-     * @return
-     */
-    ResponseJson renewIntentionUser(Integer id);
-
-    /**
-     * 添加意向客户数据总结
-     * @param id
-     * @param note
-     * @return
-     */
-    ResponseJson renewIntentionNote(Integer id, String note);
 }

+ 3 - 3
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java

@@ -163,20 +163,20 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
             r.setPagePath(decode);
 
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-            String s = null;
+            String s = "";
             try {
                 s = simpleDateFormat.format(simpleDateFormat.parse(r.getAccessTime()));
             } catch (ParseException e) {
                 e.printStackTrace();
             }
             for (CmBehaviorRecord record : reginList) {
-                String format = null;
+                String format = "";
                 try {
                     format = simpleDateFormat.format(simpleDateFormat.parse(record.getAccessTime()));
                 } catch (ParseException e) {
                     e.printStackTrace();
                 }
-                if (r.getIp().equals(record.getIp()) && r.getPageType().equals(record.getPageType()) && format.equals(s)) {
+                if (r.getIp().equals(record.getIp()) && format.equals(s)) {
                     record.setAccessSource(record.getAccessSource());
                 }
             }

+ 11 - 7
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmClubRemarksServiceImpl.java

@@ -60,13 +60,15 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
     public ResponseJson<Map<String, Object>> getServiceList(String startTime, String endTime) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         // 格式时间
-        try {
-            Date startDate = dateFormat.parse(startTime);
-            Date endDate = dateFormat.parse(endTime);
-            startTime = dateFormat.format(startDate) + "00:00:00";
-            endTime = dateFormat.format(endDate) + "23:59:59";
-        } catch ( Exception e ) {
-            e.printStackTrace();
+        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) {
+            try {
+                Date startDate = dateFormat.parse(startTime);
+                Date endDate = dateFormat.parse(endTime);
+                startTime = dateFormat.format(startDate) + "00:00:00";
+                endTime = dateFormat.format(endDate) + "23:59:59";
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
         // 协销数据
         List<ServiceProviderModel> serviceList = cmClubRemarksDao.getServiceList();
@@ -84,6 +86,8 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
         }
         // 全部协销的数据
         ServiceProviderModel service = new ServiceProviderModel();
+        service.setName("全部");
+        service.setLinkMan("全部");
         service.setRegisteredNumber(registeredNumber.get());
         service.setUnregisteredNumber(unRegisteredNumber.get());
         // 在首位加入总数数据

+ 15 - 61
src/main/java/com/caimei365/manager/service/caimei/user/impl/CustomerServiceImpl.java

@@ -144,6 +144,15 @@ public class CustomerServiceImpl implements CustomerService {
     @Override
     public ResponseJson saveInformationNotes(CmInformationNotes cmInformationNotes) {
         customerServiceDao.insertInformationNote(cmInformationNotes);
+        // 处理备注图片
+        if (null != cmInformationNotes.getImages()) {
+            CmInformationNotesImage notesImage = new CmInformationNotesImage();
+            notesImage.setInformationNoteId(cmInformationNotes.getId());
+            for (String image : cmInformationNotes.getImages()) {
+                notesImage.setImage(image);
+                customerServiceDao.insertInformationNoteImage(notesImage);
+            }
+        }
         return ResponseJson.success();
     }
 
@@ -159,6 +168,12 @@ public class CustomerServiceImpl implements CustomerService {
     public ResponseJson<PaginationVo<CmInformationNotes>> getInformationNotes(Integer informationId, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
         List<CmInformationNotes> informationNotes = customerServiceDao.getInformationNotes(informationId);
+        if (null != informationNotes) {
+            for (CmInformationNotes note : informationNotes) {
+                // 文件备注图片
+                note.setImages(customerServiceDao.getinformationNotesImage(note.getId()));
+            }
+        }
         PaginationVo<CmInformationNotes> page = new PaginationVo<>(informationNotes);
         return ResponseJson.success(page);
     }
@@ -565,67 +580,6 @@ public class CustomerServiceImpl implements CustomerService {
         return ResponseJson.success(page);
     }
 
-    /**
-     * 意向客户数据列表
-     *
-     * @param shopId
-     * @param startTime
-     * @param endTime
-     * @param pageNum
-     * @param pageSize
-     * @return
-     */
-    @Override
-    public ResponseJson<PaginationVo<CmShopIntentionUser>> getIntentionUserList(Integer shopId, String startTime, String endTime, int pageNum, int pageSize) {
-        PageHelper.startPage(pageNum, pageSize);
-        List<CmShopIntentionUser> shopIntentionUserList = customerServiceDao.getIntentionUserList(shopId, startTime, endTime);
-        PaginationVo<CmShopIntentionUser> page = new PaginationVo<>(shopIntentionUserList);
-        return ResponseJson.success(page);
-    }
-
-    /**
-     * 保存意向客户数据
-     *
-     * @param cmShopIntentionUser
-     * @return
-     */
-    @Override
-    public ResponseJson saveIntentionUser(CmShopIntentionUser cmShopIntentionUser) {
-        if (null == cmShopIntentionUser.getId()) {
-            // 修改
-            customerServiceDao.updateIntention(cmShopIntentionUser);
-        } else {
-            // 新增
-            customerServiceDao.insertIntention(cmShopIntentionUser);
-        }
-        return ResponseJson.success();
-    }
-
-    /**
-     * 删除意向客户数据
-     *
-     * @param id
-     * @return
-     */
-    @Override
-    public ResponseJson renewIntentionUser(Integer id) {
-        customerServiceDao.deleteIntentionUser(id);
-        return ResponseJson.success();
-    }
-
-    /**
-     * 添加意向客户数据总结
-     *
-     * @param id
-     * @param note
-     * @return
-     */
-    @Override
-    public ResponseJson renewIntentionNote(Integer id, String note) {
-        customerServiceDao.updateIntentionNote(id, note);
-        return ResponseJson.success();
-    }
-
 
     /**
      * 时间计算

+ 15 - 16
src/main/resources/mapper/user/CmClubRemarksDao.xml

@@ -24,11 +24,11 @@
                 <if test="serviceProviderId != null">
                     and createServiceProviderId = #{serviceProviderId}
                 </if>
-              and (<if test="startTime != null and startTime != ''">
-                        ADDTIME <![CDATA[ >= ]]> #{startTime}
+               <if test="startTime != null and startTime != ''">
+                        and ADDTIME <![CDATA[ >= ]]> #{startTime}
                    </if>
                    <if test="endTime != null and endTime != ''">
-                        AND ADDTIME <![CDATA[ <= ]]> #{endTime})
+                        AND ADDTIME <![CDATA[ <= ]]> #{endTime}
                    </if>
                   )
                 +
@@ -37,12 +37,12 @@
                     <if test="serviceProviderId!= null">
                         and serviceProviderId = #{serviceProviderId}
                     </if>
-                    and (<if test="startTime != null and startTime != ''">
-                            ADDTIME <![CDATA[ >= ]]> #{startTime}
-                        </if>
-                        <if test="endTime != null and endTime != ''">
-                            AND ADDTIME <![CDATA[ <= ]]> #{endTime})
-                        </if>)
+                     <if test="startTime != null and startTime != ''">
+                        and ADDTIME <![CDATA[ >= ]]> #{startTime}
+                    </if>
+                    <if test="endTime != null and endTime != ''">
+                        AND ADDTIME <![CDATA[ <= ]]> #{endTime})
+                    </if>
             )
     </select>
 
@@ -53,13 +53,12 @@
                 <if test="serviceProviderId != null">
                     and serviceProviderId = #{serviceProviderId}
                 </if>
-                and (<if test="startTime != null and startTime != ''">
-                        ADDTIME <![CDATA[ >= ]]> #{startTime}
-                    </if>
-                    <if test="endTime != null and endTime != ''">
-                            AND ADDTIME <![CDATA[ <= ]]> #{endTime}
-                    </if>
-                    )
+                <if test="startTime != null and startTime != ''">
+                    and ADDTIME <![CDATA[ >= ]]> #{startTime}
+                </if>
+                <if test="endTime != null and endTime != ''">
+                        AND ADDTIME <![CDATA[ <= ]]> #{endTime}
+                </if>
             )
     </select>
 

+ 22 - 88
src/main/resources/mapper/user/CustomerServiceDao.xml

@@ -53,15 +53,17 @@
         where id = #{id}
     </update>
     <select id="getCmInformationList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmRoosInformation">
-        SELECT id,
-               IP,
-               shopId,
-               followUpStatus,
-               consultName,
-               consultMobile,
-               isClick,
-               createTime
-        FROM cm_roos_information
+        SELECT cri.id,
+               cri.IP,
+               cri.shopId,
+               cri.followUpStatus,
+               cri.consultName,
+               cri.consultMobile,
+               cri.isClick,
+               cri.serviceProviderId,
+               (select linkMan from serviceprovider where serviceProviderID = cri.serviceProviderId) as name,
+               cri.createTime
+        FROM cm_roos_information cri
         <where>
           shopId = #{shopId}
           AND consultName IS NOT NULL
@@ -88,11 +90,16 @@
         where id = #{id}
     </select>
 
-    <insert id="insertInformationNote">
+    <insert id="insertInformationNote" keyProperty="id" useGeneratedKeys="true" keyColumn="id">
         insert into cm_information_notes(informationId, note, noteUser, addTime)
         values (#{informationId}, #{note}, #{noteUser}, now())
     </insert>
 
+    <insert id="insertInformationNoteImage">
+        insert into cm_information_notes_image(informationNoteId, image)
+        values (#{informationNoteId}, #{image})
+    </insert>
+
     <select id="getInformationNotes" resultType="com.caimei365.manager.entity.caimei.cmUser.CmInformationNotes">
         select
             id,
@@ -102,6 +109,11 @@
             addTime
         from cm_information_notes
         where informationId = #{informationId}
+        order by addTime desc
+    </select>
+
+    <select id="getinformationNotesImage" resultType="java.lang.String">
+        select image from cm_information_notes_image where informationNoteId = #{informationNoteId};
     </select>
 
     <select id="getShopInfoList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopInfo">
@@ -388,83 +400,5 @@
         group by cpsk.searchId
     </select>
 
-    <select id="getIntentionUserList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopIntentionUser">
-        select
-            id,
-            shopId,
-            startTime,
-            endTime,
-            appReadingVolume,
-            redReadingVolume,
-            wbReadingVolume,
-            otherReadingVolume,
-            intentionStrong,
-            intentionOrdinary,
-            addTime,
-            delFlag
-        from cm_shop_intention_user
-        <where>
-            shopId = #{shopId}
-            <if test="startTime != null and startTime != ''">
-                and startTime <![CDATA[ >= ]]> #{startTime}
-            </if>
-            <if test="endTime != null and endTime != ''">
-                and endTime <![CDATA[ <= ]]> #{endTime}
-            </if>
-        </where>
-    </select>
-
-    <insert id="insertIntention">
-        insert into cm_shop_intention_user(
-            shopId,
-            startTime,
-            endTime,
-            appReadingVolume,
-            redReadingVolume,
-            wbReadingVolume,
-            otherReadingVolume,
-            intentionStrong,
-            intentionOrdinary,
-            addTime,
-            delFlag
-            ) values (
-                 #{shopId},
-                 #{startTime},
-                 #{endTime},
-                 #{appReadingVolume},
-                 #{redReadingVolume},
-                 #{wbReadingVolume},
-                 #{otherReadingVolume},
-                 #{intentionStrong},
-                 #{intentionOrdinary},
-                 now(),
-                 0
-            )
-    </insert>
-
-    <update id="updateIntention">
-        update cm_shop_intention_user
-            set startTime   = #{startTime},
-            endTime = #{endTime},
-            appReadingVolume    = #{appReadingVolume},
-            redReadingVolume    = #{redReadingVolume},
-            wbReadingVolume     = #{wbReadingVolume},
-            otherReadingVolume  = #{otherReadingVolume},
-            intentionStrong     = #{intentionStrong},
-            intentionOrdinary   = #{intentionOrdinary}
-        where id = #{id}
-    </update>
-
-    <update id="deleteIntentionUser">
-        update cm_shop_intention_user
-        set delFlag = 1
-        where id = #{id}
-    </update>
-
-    <insert id="updateIntentionNote">
-        update cm_shop_intention_user
-        set note = #{note}
-        where id = #{id}
-    </insert>
 
 </mapper>