Selaa lähdekoodia

缓存每个用户针对每个弹框的一次的清缓存

njs 1 vuosi sitten
vanhempi
commit
07c4a36154

+ 11 - 1
suishenbang-system/src/main/java/com/dgtly/system/domain/AlertConfiguration.java

@@ -63,13 +63,23 @@ public class AlertConfiguration extends BaseEntity
     /** 弹框图片地址 */
     private String photoUrl;
 
+    /** 是否需要清缓存**/
+    private Boolean isClearCache;
 
     public void setAlertId(Long alertId)
     {
         this.alertId = alertId;
     }
 
-    public Long getAlertId() 
+    public Boolean getIsClearCache() {
+        return isClearCache;
+    }
+
+    public void setIsClearCache(Boolean clearCache) {
+        isClearCache = clearCache;
+    }
+
+    public Long getAlertId()
     {
         return alertId;
     }

+ 1 - 1
suishenbang-system/src/main/java/com/dgtly/system/mapper/AlertLogMapper.java

@@ -64,5 +64,5 @@ public interface AlertLogMapper
      */
     public int deleteAlertLogByIds(@Param("alertLogIds") String[] alertLogIds);
 
-    public AlertLog selectAlertLogByUserIdAndAlertId(@Param("userId") Long userId,@Param("alertId") Long alertId);
+    public AlertLog selectAlertLogByUserIdAndAlertId(@Param("userId") Long userId,@Param("alertId") Long alertId,@Param("isCacheType") String isCacheType);
 }

+ 1 - 1
suishenbang-system/src/main/java/com/dgtly/system/service/IAlertLogService.java

@@ -22,7 +22,7 @@ public interface IAlertLogService
 //  找
     public AlertLog selectAlertLogByUserId(Long userId);
 
-    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId);
+    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId,String isCacheType);
 
     /**
      * 查询弹框日志列表

+ 2 - 3
suishenbang-system/src/main/java/com/dgtly/system/service/impl/AlertLogServiceImpl.java

@@ -39,9 +39,8 @@ public class AlertLogServiceImpl implements IAlertLogService
     }
 
     @Override
-    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId) {
-        System.out.println(userId);
-        return alertLogMapper.selectAlertLogByUserIdAndAlertId(userId,alertId);
+    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId,String isCacheType) {
+        return alertLogMapper.selectAlertLogByUserIdAndAlertId(userId,alertId,isCacheType);
     }
 
     /**

+ 3 - 1
suishenbang-system/src/main/resources/mapper/system/AlertLogMapper.xml

@@ -49,7 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where 1=1
         <if test="userId!=null">and user_id = #{userId}</if>
         <if test="alertId != null ">and alert_id = #{alertId}</if>
-        and DATE_FORMAT(create_time,'%Y%m%d') = DATE_FORMAT(NOW(),'%Y%m%d')
+        <if test="isCacheType !=null and  isCacheType == '0'.toString()">
+            and DATE_FORMAT(create_time,'%Y%m%d') = DATE_FORMAT(NOW(),'%Y%m%d')
+        </if>
     </select>
 
     <insert id="insertAlertLog" parameterType="AlertLog" useGeneratedKeys="true" keyProperty="alertLogId">

+ 6 - 6
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -287,24 +287,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
 	    <include refid="selectUserVo"/>
-		where u.email = #{email}
+		where u.email = #{email}  and del_flag='0'  and quit is null
 	</select>
 	
 	<select id="checkLoginNameUnique"  resultType="int">
-		select count(1) from sys_user where login_name=#{loginName}
+		select count(1) from sys_user where login_name=#{loginName} and del_flag='0'  and quit is null
 	</select>
 	
 	<select id="checkPhoneUnique"  resultMap="SysUserResult">
-		select user_id, phonenumber from sys_user where phonenumber=#{phonenumber}
+		select user_id, phonenumber from sys_user where phonenumber=#{phonenumber}  and del_flag='0'  and quit is null
 	</select>
 	
 	<select id="checkEmailUnique"  resultMap="SysUserResult">
-		select user_id, email from sys_user where email=#{email}
+		select user_id, email from sys_user where email=#{email}  and del_flag='0'  and quit is null
 	</select>
 	
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
 		<include refid="selectUserVo"/>
-		where u.user_id = #{userId}
+		where u.user_id = #{userId}  and u.del_flag='0'  and u.quit is null
 	</select>
 	
 	<delete id="deleteUserById" parameterType="Long">
@@ -383,7 +383,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="isSelfDelivery !=null">is_self_delivery =#{isSelfDelivery},</if>
 			update_time = sysdate()
 		</set>
-		where login_name = #{loginName}
+		where login_name = #{loginName} and quit is null  and del_flag='0'
 	</update>
 
 	<update id="updateIsAuthentication" parameterType="String">

+ 11 - 3
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -65,6 +65,7 @@ public class WxAlertLogController  extends ApiBaseController {
 
         if (alertConfiguration1!=null){
             //有启动
+            alertConfiguration1.setIsClearCache(false);
             Date date = new Date();
             int i = date.compareTo(alertConfiguration1.getAlertStartTime());
             int i1 = date.compareTo(alertConfiguration1.getAlertEndTime());
@@ -75,7 +76,11 @@ public class WxAlertLogController  extends ApiBaseController {
 
                 if ((strings.contains("1")  || strings.contains("2")) &&sysUserExt.getSalesLevel().equals("customer_level")){
                     //满足类型对应a
-                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId());
+                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
+                    AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
+                    if(log == null){
+                        alertConfiguration1.setIsClearCache(true);
+                    }
                     if (alertLog!=null){
                         if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
                             alertLog.setAlertNum(alertLog.getAlertNum()+1);
@@ -96,8 +101,11 @@ public class WxAlertLogController  extends ApiBaseController {
                     }
                 }
                 if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
-                    System.out.println(userId);
-                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId());
+                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
+                    AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
+                    if(log == null){
+                        alertConfiguration1.setIsClearCache(true);
+                    }
                     if (alertLog!=null){
                         if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
                             alertLog.setAlertNum(alertLog.getAlertNum()+1);