浏览代码

潜客统计、咨询记录

huangzhiguo 1 年之前
父节点
当前提交
8fa6cb7daf

+ 5 - 4
src/main/java/com/caimei365/manager/controller/caimei/user/CmClubRemarksApi.java

@@ -3,12 +3,10 @@ package com.caimei365.manager.controller.caimei.user;
 import com.caimei365.manager.config.security.ConstantKey;
 import com.caimei365.manager.config.security.ConstantKey;
 import com.caimei365.manager.config.security.JwtService;
 import com.caimei365.manager.config.security.JwtService;
 import com.caimei365.manager.config.security.SecurityConfig;
 import com.caimei365.manager.config.security.SecurityConfig;
+import com.caimei365.manager.config.thinkgem.utils.Encodes;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.ResponseJson;
-import com.caimei365.manager.entity.caimei.cmUser.CmClubRemarks;
-import com.caimei365.manager.entity.caimei.cmUser.CmConsulttype;
-import com.caimei365.manager.entity.caimei.cmUser.CmReport;
-import com.caimei365.manager.entity.caimei.cmUser.VisitRemarkVo;
+import com.caimei365.manager.entity.caimei.cmUser.*;
 import com.caimei365.manager.service.caimei.user.CmClubRemarksService;
 import com.caimei365.manager.service.caimei.user.CmClubRemarksService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +18,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.IOException;
+import java.net.URLDecoder;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -81,8 +80,10 @@ public class CmClubRemarksApi {
      */
      */
     @GetMapping("/remarks/download")
     @GetMapping("/remarks/download")
     public void downloadRemarks(String fileName, String ossName, HttpServletRequest request, HttpServletResponse response) throws IOException {
     public void downloadRemarks(String fileName, String ossName, HttpServletRequest request, HttpServletResponse response) throws IOException {
+
         cmClubRemarksService.downloadRemarks(fileName, ossName, request, response);
         cmClubRemarksService.downloadRemarks(fileName, ossName, request, response);
     }
     }
+
     /**
     /**
      * 报备列表
      * 报备列表
      * @param cmReport
      * @param cmReport

+ 6 - 0
src/main/java/com/caimei365/manager/dao/KeyWordDao.java

@@ -94,4 +94,10 @@ public interface KeyWordDao {
      * @param id
      * @param id
      */
      */
     void delPriorKeyword(@Param("id") Integer id);
     void delPriorKeyword(@Param("id") Integer id);
+
+    /**
+     * 根据标签Id删除优先展示标签
+     * @param id
+     */
+    void delPriorKeywordById(@Param("id") Integer id);
 }
 }

+ 1 - 0
src/main/java/com/caimei365/manager/service/caimei/impl/KeyWordServiceImpl.java

@@ -112,6 +112,7 @@ public class KeyWordServiceImpl implements KeyWordService {
             String[] split = id.split(",");
             String[] split = id.split(",");
             for (String s : split) {
             for (String s : split) {
                 keyWordDao.updateDelFlag(s);
                 keyWordDao.updateDelFlag(s);
+                keyWordDao.delPriorKeywordById(Integer.parseInt(s));
             }
             }
         } else {
         } else {
             keyWordDao.updateDelFlag(id);
             keyWordDao.updateDelFlag(id);

+ 15 - 2
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmClubRemarksServiceImpl.java

@@ -1,5 +1,6 @@
 package com.caimei365.manager.service.caimei.user.impl;
 package com.caimei365.manager.service.caimei.user.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.MathUtil;
 import com.caimei365.manager.dao.user.CmClubRemarksDao;
 import com.caimei365.manager.dao.user.CmClubRemarksDao;
@@ -12,6 +13,7 @@ import com.caimei365.manager.utils.OSSUtils;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jackson.map.ObjectMapper;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -131,8 +133,17 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
                 }
                 }
             }
             }
             remarks.setRemarks(StringUtils.strip(remarkList.toString(), "[]"));
             remarks.setRemarks(StringUtils.strip(remarkList.toString(), "[]"));
-            List<String> imageList = cmClubRemarksDao.getRemarksImageList(remarks.getRemarksId());
-            List<RemarksFileVo> fileList = cmClubRemarksDao.getRemarksFileList(remarks.getRemarksId());
+            List<String> imageList = null;
+            List<RemarksFileVo> fileList = null;
+            if (1 == remarks.getType()) {
+                // 已注册用户
+                imageList = cmClubRemarksDao.getRemarksImageList(remarks.getRemarksId());
+                fileList = cmClubRemarksDao.getRemarksFileList(remarks.getRemarksId());
+            } else {
+                // 未注册用户
+                imageList = cmClubRemarksDao.getVisitorImageList(remarks.getRemarksId());
+                fileList = cmClubRemarksDao.getVisitorFileList(remarks.getRemarksId());
+            }
             fileList.forEach(f -> f.setFileUrl(ossUtils.getOssUrl(f.getOssName())));
             fileList.forEach(f -> f.setFileUrl(ossUtils.getOssUrl(f.getOssName())));
             if (StringUtils.isNotBlank(remarks.getMainImage())) {
             if (StringUtils.isNotBlank(remarks.getMainImage())) {
                 remarks.setMainImage(AppUtils.getImageURL("product", remarks.getMainImage(), 0, ""));
                 remarks.setMainImage(AppUtils.getImageURL("product", remarks.getMainImage(), 0, ""));
@@ -167,6 +178,8 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
      */
      */
     @Override
     @Override
     public void downloadRemarks(String fileName, String ossName, HttpServletRequest request, HttpServletResponse response)  throws IOException {
     public void downloadRemarks(String fileName, String ossName, HttpServletRequest request, HttpServletResponse response)  throws IOException {
+
+        log.info("fileName==="+fileName+"===ossName==="+ossName);
         ossUtils.downFile(ossName, fileName);
         ossUtils.downFile(ossName, fileName);
         cmOssArchiveService.download(request, response, fileName);
         cmOssArchiveService.download(request, response, fileName);
     }
     }

+ 8 - 2
src/main/resources/mapper/KeyWordDao.xml

@@ -2,8 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.manager.dao.KeyWordDao">
 <mapper namespace="com.caimei365.manager.dao.KeyWordDao">
     <insert id="insertLabel">
     <insert id="insertLabel">
-        insert into cm_user_search_frequency(fromSearch, keyword, frequency, trueStatus, addTime)
-        values (1, #{keyword}, 0, 1, now())
+        insert into cm_user_search_frequency(fromSearch, keyword, frequency, dynamicStatus, trueStatus, addTime)
+        values (1, #{keyword}, 0, 0, 1, now())
     </insert>
     </insert>
 
 
     <insert id="insertLabelByExcel">
     <insert id="insertLabelByExcel">
@@ -172,4 +172,10 @@
         set delFlag = 1
         set delFlag = 1
         where id = #{id}
         where id = #{id}
     </update>
     </update>
+
+    <update id="delPriorKeywordById">
+        update cm_prior_keyword
+        set delFlag = 1
+        where searchId = #{id}
+    </update>
 </mapper>
 </mapper>

+ 32 - 2
src/main/resources/mapper/user/CmClubRemarksDao.xml

@@ -124,6 +124,10 @@
             <if test="remarks != null and remarks !=''">
             <if test="remarks != null and remarks !=''">
                 AND ccr.remarks LIKE concat('%',#{remarks},'%')
                 AND ccr.remarks LIKE concat('%',#{remarks},'%')
             </if>
             </if>
+            <if test="clubName !=null and clubName !=''">
+                AND ccr.clubId is not null
+                AND c.Name like concat('%',#{clubName},'%')
+            </if>
             <if test="leaderId != null">
             <if test="leaderId != null">
                 and csr.leaderId = #{leaderId}
                 and csr.leaderId = #{leaderId}
             </if>
             </if>
@@ -392,6 +396,18 @@
                     and ccr.clubId = #{clubId}
                     and ccr.clubId = #{clubId}
                 </if>
                 </if>
             </if>
             </if>
+            <if test="remarks != null and remarks !=''">
+                AND ccr.remarks LIKE concat('%',#{remarks},'%')
+            </if>
+            <if test="consult != null">
+                and ccr.consultType like concat('%',#{consult},'%')
+            </if>
+            <if test="startAddTime != '' and startAddTime != null">
+                and ccr.addTime <![CDATA[  >  ]]> #{startAddTime}
+            </if>
+            <if test="endAddTime != '' and endAddTime != null">
+                and ccr.addTime <![CDATA[  <  ]]> #{endAddTime}
+            </if>
         </where>
         </where>
 
 
         union
         union
@@ -400,8 +416,9 @@
         ccr.id AS remarksId, ccr.remarks, s.name AS spName, ccr.addTime, ccr.questionMan,
         ccr.id AS remarksId, ccr.remarks, s.name AS spName, ccr.addTime, ccr.questionMan,
         csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
         csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
         ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
         ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
-        '' as communicationSituation, '' as communicationMethods, '' as customerSource, '' as customerGender, '' as groupAddition,
-        '' as customerAge, '' as trendsKeyword, '' as stateKeyword, c.newDeal, c.contractMobile, '2' as type,
+        ccr.communicationSituation AS communicationSituation, ccr.communicationMethods AS communicationMethods, ccr.customerSource AS customerSource,
+        ccr.customerGender AS customerGender, ccr.groupAddition AS groupAddition, ccr.customerAge AS customerAge,
+        ccr.trendsKeyword AS trendsKeyword, ccr.stateKeyword AS stateKeyword, c.newDeal, c.contractMobile, '2' as type,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
         (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
         (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
@@ -423,6 +440,18 @@
             <if test="clubId != null">
             <if test="clubId != null">
                 and ccr.clubId = #{clubId}
                 and ccr.clubId = #{clubId}
             </if>
             </if>
+            <if test="remarks != null and remarks !=''">
+                AND ccr.remarks LIKE concat('%',#{remarks},'%')
+            </if>
+            <if test="consult != null">
+                and ccr.consultType like concat('%',#{consult},'%')
+            </if>
+            <if test="startAddTime != '' and startAddTime != null">
+                and ccr.addTime <![CDATA[  >  ]]> #{startAddTime}
+            </if>
+            <if test="endAddTime != '' and endAddTime != null">
+                and ccr.addTime <![CDATA[  <  ]]> #{endAddTime}
+            </if>
         </where>
         </where>
         ORDER BY ADDTIME DESC
         ORDER BY ADDTIME DESC
     </select>
     </select>
@@ -433,6 +462,7 @@
         where remarksId = #{remarksId}
         where remarksId = #{remarksId}
           and fileType = 1
           and fileType = 1
     </select>
     </select>
+
     <select id="getVisitorFileList" resultType="com.caimei365.manager.entity.caimei.cmUser.RemarksFileVo">
     <select id="getVisitorFileList" resultType="com.caimei365.manager.entity.caimei.cmUser.RemarksFileVo">
         select fileName, ossName
         select fileName, ossName
         from cm_visitor_remarks_file
         from cm_visitor_remarks_file