Browse Source

CRM系统升级优化bugfix

kaick 1 năm trước cách đây
mục cha
commit
2ef08d7c3e

+ 1 - 1
src/main/java/com/caimei/modules/utils/MessageUtil.java

@@ -56,7 +56,7 @@ public class MessageUtil {
                         .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
                         .keyWords(keyWords)
                         .remark("为了更好给您服务,请及时联系采美客服!")
-                        .pagePath("pages/seller/notice/service/Institutional_visits"));
+                        .pagePath("pages/seller/notice/service/Institutional_visits?spId="+1340+"&accDateTime="+"2023-09-14"));
         sendMessage(wechatTemplateMessageMessageModel);
 //        //站内信
 //        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();

+ 19 - 10
src/main/resources/mappings/modules/user/CmSpMapper.xml

@@ -160,35 +160,44 @@
 
     <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
 		select
-		ifnull(COUNT(   CASE WHEN a.time >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS loginSum,
-		ifnull(COUNT(  CASE WHEN a.time <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS not_loginSum
+		COUNT(  CASE WHEN a.time=1 THEN 1 END) AS loginSum,
+		((SELECT count(1) from club
+		WHERE  status=90
+		<if test="spID != null">
+			and  spID=#{spID}
+		</if>
+		)-COUNT(  CASE WHEN a.time=1 THEN 1 END)) AS not_loginSum
 		FROM (select a.*
-		FROM (
-		(select
-		c.clubId,u.loginTime AS time,c.spID
+		FROM ((
+		select
+		c.clubId,1 AS time,c.spID
 		FROM club c
 		LEFT JOIN user u ON u.userID = c.userID
 		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
-		where c.status=90 and sp.status=90  and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		and u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
 		)UNION(
 		select
-		c.clubId,ccr.addTime AS time,c.spID
+		c.clubId,1 AS time,c.spID
 		FROM club c
 		LEFT JOIN user u ON u.userID = c.userID
 		LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
 		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
-		where c.status=90 and sp.status=90  and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
 		and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
 		)UNION(
-		select c.clubId,cr.orderTime AS time,c.spID
+		select c.clubId,1 AS time,c.spID
 		FROM club c
 		LEFT JOIN user u ON u.userID = c.userID
 		LEFT JOIN cm_order cr ON cr.clubId = c.clubId
 		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
 		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
 		and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
 		)
-		) a where a.time is not null
+		) a where  1=1
 		<if test="spID != null">
 			and  a.spID=#{spID}
 		</if>

+ 26 - 16
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -151,44 +151,54 @@
                 AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
             </if>
             <if test="startLoginTime != null and startLoginTime != ''">
-                AND (u.loginTime &gt; #{startLoginTime} OR u.loginTime = #{startLoginTime} OR a.clubId= (select aa.clubId
-                FROM ((select
-                c.clubId
+                AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR a.clubId in (select a.clubId
+                FROM ((
+                select
+                c.clubId,ccr.addTime AS time,c.spID
                 FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
                 LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
                 LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
                 where c.status=90 and sp.status=90
                 and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
                 )UNION(
-                select c.clubId
+                select c.clubId,cr.orderTime AS time,c.spID
                 FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
                 LEFT JOIN cm_order cr ON cr.clubId = c.clubId
                 LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
-                where c.status=90 and  sp.status=90
+                where c.status=90 and sp.status=90
                 and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
-                )) aa
-                where aa.clubId=a.clubId
-                GROUP BY aa.clubId LIMIT 0,1))
+                GROUP BY c.clubId
+                )) a where a.time is not null
+                and  a.spID=#{spID}
+                GROUP BY a.clubId ))
             </if>
             <if test="endLoginTime != null and endLoginTime != ''">
-                AND (u.loginTime &lt; #{endLoginTime} OR u.loginTime = #{endLoginTime} OR a.clubId != (select aa.clubId
-                FROM ((select
-                c.clubId
+                AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) or u.loginTime is null) and a.clubId not in (select a.clubId
+                FROM ((
+                select
+                c.clubId,ccr.addTime AS time,c.spID
                 FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
                 LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
                 LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
-                where c.status=90 and  sp.status=90
+                where c.status=90 and sp.status=90
                 and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
                 )UNION(
-                select c.clubId
+                select c.clubId,cr.orderTime AS time,c.spID
                 FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
                 LEFT JOIN cm_order cr ON cr.clubId = c.clubId
                 LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
                 where c.status=90 and sp.status=90
                 and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
-                )) aa
-                where aa.clubId=a.clubId
-                GROUP BY aa.clubId LIMIT 0,1))
+                GROUP BY c.clubId
+                )) a where a.time is not null
+                and  a.spID=#{spID}
+                GROUP BY a.clubId )
             </if>
             <if test="userIdentity != null and userIdentity != '' and userIdentity != '8'.toString()">
                 AND u.userIdentity = #{userIdentity}