huangzhiguo 1 vuosi sitten
vanhempi
commit
2020e137b7

+ 1 - 1
src/main/java/com/caimei365/manager/dao/user/CmClubRemarksDao.java

@@ -33,7 +33,7 @@ public interface CmClubRemarksDao {
      * @param serviceProviderId
      * @return
      */
-    Integer getUnregisteredNumber(@Param("serviceProviderId") Integer serviceProviderId);
+    Integer getUnregisteredNumber(@Param("serviceProviderId") Integer serviceProviderId, @Param("addTime") String addTime);
 
     /**
      * 咨询记录类别

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

@@ -10,6 +10,7 @@ import com.caimei365.manager.service.caimei.CmOssArchiveService;
 import com.caimei365.manager.service.caimei.user.CmClubRemarksService;
 import com.caimei365.manager.utils.OSSUtils;
 import com.github.pagehelper.PageHelper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
@@ -27,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
  * @author : Charles
  * @date : 2023/9/7
  */
+@Slf4j
 @Service
 public class CmClubRemarksServiceImpl implements CmClubRemarksService {
 
@@ -51,18 +53,22 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
      */
     @Override
     public ResponseJson<Map<String, Object>> getServiceList(String time) {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        if (StringUtils.isBlank(time)) {
+            time = dateFormat.format(new Date());
+        }
         // 协销数据
         List<ServiceProviderModel> serviceList = cmClubRemarksDao.getServiceList();
         AtomicInteger registeredNumber = new AtomicInteger(0);
         AtomicInteger unRegisteredNumber = new AtomicInteger(0);
-        serviceList.forEach( s -> {
+        for (ServiceProviderModel s : serviceList){
             // 已注册用户咨询记录
             s.setRegisteredNumber(cmClubRemarksDao.getRegisteredNumber(s.getServiceProviderId(), time));
             // 未注册用户咨询记录
-            s.setUnregisteredNumber(cmClubRemarksDao.getUnregisteredNumber(s.getServiceProviderId()));
+            s.setUnregisteredNumber(cmClubRemarksDao.getUnregisteredNumber(s.getServiceProviderId(), time));
             registeredNumber.set(MathUtil.add(registeredNumber.get(), s.getRegisteredNumber()).intValue());
             unRegisteredNumber.set(MathUtil.add(unRegisteredNumber.get(), s.getUnregisteredNumber()).intValue());
-        });
+        }
         Map<String, Object> map = new HashMap<>();
         map.put("serviceList", serviceList);
         map.put("registeredNumber", registeredNumber);
@@ -389,6 +395,33 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
             }
             List<String> imageList = null;
             List<RemarksFileVo> fileList = null;
+            List<String> remarkList = new ArrayList<>();
+            // 合并标签
+            if (StringUtils.isNotBlank(remarks.getRemarks())) {
+                if (remarks.getRemarks().contains(",")) {
+                    String[] split = remarks.getRemarks().split(",");
+                    remarkList.addAll(Arrays.asList(split));
+                } else {
+                    remarkList.add(remarks.getRemarks());
+                }
+            }
+            if (StringUtils.isNotBlank(remarks.getTrendsKeyword())) {
+                if (remarks.getTrendsKeyword().contains(",")) {
+                    String[] split = remarks.getTrendsKeyword().split(",");
+                    remarkList.addAll(Arrays.asList(split));
+                } else {
+                    remarkList.add(remarks.getTrendsKeyword());
+                }
+            }
+            if (StringUtils.isNotBlank(remarks.getStateKeyword())) {
+                if (remarks.getStateKeyword().contains(",")) {
+                    String[] split = remarks.getStateKeyword().split(",");
+                    remarkList.addAll(Arrays.asList(split));
+                } else {
+                    remarkList.add(remarks.getStateKeyword());
+                }
+            }
+            remarks.setRemarks(StringUtils.strip(remarkList.toString(), "[]"));
             if (1 == remarks.getType()) {
                 // 已注册用户
                 imageList = cmClubRemarksDao.getRemarksImageList(remarks.getRemarksId());

+ 10 - 0
src/main/resources/config/beta/application-beta.yml

@@ -73,3 +73,13 @@ wechat:
     id: gh_123456
     appid: wx123456
     secret: abc123456
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 172.31.165.28:22122

+ 10 - 0
src/main/resources/config/dev/application-dev.yml

@@ -73,3 +73,13 @@ wechat:
     id: gh_123456
     appid: wx123456
     secret: abc123456
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 192.168.2.100:22122

+ 11 - 0
src/main/resources/config/prod/application-prod.yml

@@ -75,3 +75,14 @@ wechat:
     id: gh_7de98a37fb6a
     appid: wxea43a0f9ebce9e66
     secret: 1c3cd60908e72dd280840bee9e15f7f6
+
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 172.31.165.24:22122

+ 6 - 6
src/main/resources/mapper/user/CmClubRemarksDao.xml

@@ -19,13 +19,13 @@
 
     <select id="getRegisteredNumber" resultType="java.lang.Integer">
         SELECT
-                (SELECT COUNT(id) FROM cm_club_remarks WHERE createServiceProviderId = #{serviceProviderId} AND clubId IS NOT NULL)
-                    + (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} AND addTime = #{addTime} AND clubId IS NOT NULL)
+                (SELECT COUNT(id) FROM cm_club_remarks WHERE createServiceProviderId = #{serviceProviderId} and addTime LIKE concat('%',#{addTime},'%') AND clubId IS NOT NULL)
+                    + (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} AND addTime LIKE concat('%',#{addTime},'%') AND clubId IS NOT NULL)
     </select>
 
     <select id="getUnregisteredNumber" resultType="java.lang.Integer">
         SELECT
-                (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} AND clubId IS NULL)
+                (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} and addTime LIKE concat('%',#{addTime},'%') AND clubId IS NULL)
     </select>
 
     <select id="getClassName" resultType="com.caimei365.manager.entity.caimei.cmUser.CmConsulttype">
@@ -103,8 +103,9 @@
         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,
         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 NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
         (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
@@ -120,7 +121,6 @@
         LEFT JOIN product p ON p.productID = ccr.productID
         LEFT JOIN shop sh ON sh.shopID = p.shopID
         <where>
-            ccr.clubId is not null
             <if test="remarks != null and remarks !=''">
                 AND ccr.remarks LIKE concat('%',#{remarks},'%')
             </if>

+ 24 - 36
src/main/resources/mapper/user/CustomerServiceDao.xml

@@ -157,7 +157,7 @@
                  LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
         <where>
             csk.shopId = #{shopId}
-            and csk.delFlag = 0 and cusf.delStatus = 0
+            and csk.delFlag = 0 and cusf.delStatus = 1
             <if test="keyword != null and keyword != ''">
                 and cusf.keyword like concat('%',#{keyword},'%')
             </if>
@@ -294,18 +294,15 @@
             cps.shopId,
             s.name AS shopName,
             cps.shopLink,
-            cps.accessNumber,
-            cps.accessDuration,
-            ifnull((cps.accessDuration / cps.accessNumber), 0) AS averageDuration
+            IFNULL(SUM(cps.accessNumber), 0) AS accessNumber,
+            IFNULL(SUM(cps.accessDuration), 0) AS accessDuration,
+            IFNULL((IFNULL(SUM(cps.accessDuration), 0) / IFNULL(SUM(cps.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop cps
                  LEFT JOIN shop s ON s.shopId = cps.shopId
         <where>
             cps.shopId = #{shopId}
-            <if test="startTime != null and startTime != ''">
-                and cps.accessDate <![CDATA[ > ]]> #{startTime}
-            </if>
-            <if test="endTime != null and endTime != ''">
-                and cps.accessDate <![CDATA[ < ]]> #{endTime}
+            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+                and cps.accessDate BETWEEN #{startTime} and #{endTime}
             </if>
         </where>
         group by cps.shopId
@@ -320,20 +317,17 @@
             p.mainImage,
             copi.validFlag,
             cpsp.link,
-            cpsp.accessNumber,
-            cpsp.accessDuration,
-            ifnull((cpsp.accessDuration / cpsp.accessNumber), 0) AS averageDuration
+            IFNULL(SUM(cpsp.accessNumber), 0) AS accessNumber,
+            IFNULL(SUM(cpsp.accessDuration), 0) AS accessDuration,
+            IFNULL((IFNULL(SUM(cpsp.accessDuration), 0) / IFNULL(SUM(cpsp.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop_product cpsp
                  LEFT JOIN product p ON p.productId = cpsp.productId
                  LEFT JOIN cm_organize_product_info copi ON copi.productId = cpsp.productId
         WHERE cpsp.shopId = #{shopId} and copi.organizeId = 0
-        <if test="startTime != null and startTime != ''">
-            and cpsp.accessDate <![CDATA[ > ]]> #{startTime}
-        </if>
-        <if test="endTime != null and endTime != ''">
-            and cpsp.accessDate <![CDATA[ < ]]> #{endTime}
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and cpsp.accessDate BETWEEN #{startTime} and #{endTime}
         </if>
-        group by cpsp.shopId
+        group by cpsp.productId
     </select>
 
     <select id="getPageShopInfo" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopInfo">
@@ -345,19 +339,16 @@
             i.title,
             i.onlineStatus,
             cpsi.link,
-            cpsi.accessNumber,
-            cpsi.accessDuration,
-            ifnull((cpsi.accessDuration / cpsi.accessNumber), 0) AS averageDuration
+            IFNULL(SUM(cpsi.accessNumber), 0) AS accessNumber,
+            IFNULL(SUM(cpsi.accessDuration), 0) AS accessDuration,
+            IFNULL((IFNULL(SUM(cpsi.accessDuration), 0) / IFNULL(SUM(cpsi.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop_info cpsi
         LEFT JOIN info i ON i.id = cpsi.infoId
         WHERE cpsi.shopId = #{shopId}
-        <if test="startTime != null and startTime != ''">
-            and cpsi.accessDate <![CDATA[ > ]]> #{startTime}
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and cpsi.accessDate BETWEEN #{startTime} and #{endTime}
         </if>
-        <if test="endTime != null and endTime != ''">
-            and cpsi.accessDate <![CDATA[ < ]]> #{endTime}
-        </if>
-        group by cpsi.shopId
+        group by cpsi.infoId
     </select>
 
     <select id="getPageShopKeyword" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopKeyword">
@@ -366,18 +357,15 @@
             cpsk.shopId,
             cusf.keyword,
             cpsk.link,
-            cpsk.accessNumber,
-            cpsk.accessDuration,
-            ifnull((cpsk.accessDuration / cpsk.accessNumber), 0) AS averageDuration
+            IFNULL(SUM(cpsk.accessNumber), 0) AS accessNumber,
+            IFNULL(SUM(cpsk.accessDuration), 0) AS accessDuration,
+            IFNULL((IFNULL(SUM(cpsk.accessDuration), 0) / IFNULL(SUM(cpsk.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop_keyword cpsk
         LEFT JOIN cm_user_search_frequency cusf ON cusf.id = cpsk.searchId
         WHERE cpsk.shopId = #{shopId}
-        <if test="startTime != null and startTime != ''">
-            and cpsk.accessDate <![CDATA[ > ]]> #{startTime}
-        </if>
-        <if test="endTime != null and endTime != ''">
-            and cpsk.accessDate <![CDATA[ < ]]> #{endTime}
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and cpsk.accessDate BETWEEN #{startTime} and #{endTime}
         </if>
-        group by cpsk.shopId
+        group by cpsk.searchId
     </select>
 </mapper>