chenyanan 1 year ago
parent
commit
809632960b

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

@@ -1,6 +1,8 @@
 package com.dgtly.system.mapper;
 
 import com.dgtly.system.domain.AlertLog;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 /**
@@ -60,7 +62,7 @@ public interface AlertLogMapper
      * @param alertLogIds 需要删除的数据ID
      * @return 结果
      */
-    public int deleteAlertLogByIds(String[] alertLogIds);
+    public int deleteAlertLogByIds(@Param("alertLogIds") String[] alertLogIds);
 
-    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId, Long alertId);
+    public AlertLog selectAlertLogByUserIdAndAlertId(@Param("userId") Long userId,@Param("alertId") Long alertId);
 }

+ 1 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/AlertLogServiceImpl.java

@@ -40,6 +40,7 @@ public class AlertLogServiceImpl implements IAlertLogService
 
     @Override
     public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId) {
+        System.out.println(userId);
         return alertLogMapper.selectAlertLogByUserIdAndAlertId(userId,alertId);
     }
 

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

@@ -46,7 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectAlertLogByUserIdAndAlertId" parameterType="AlertLog" resultMap="AlertLogResult">
         <include refid="selectAlertLogVo"/>
-        where user_id = #{userId} and alert_id = #{alertId}
+        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')
     </select>
 

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

@@ -45,92 +45,6 @@ public class WxAlertLogController  extends ApiBaseController {
 
 
     @ApiOperation(value = "微信弹框",notes = "参数:{userId:1}")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "userId" , paramType = "body",dataType = "Long")
-//    })
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params" , paramType = "body")
-    })
-    @PostMapping("/getAlertLog")
-    public Object getAlertLog1(){
-        ParameterObject obj = getParameterObject();
-        Long userId = Long.valueOf(obj.getString("userId"));
-        AlertConfiguration alertConfiguration = null;
-        //
-        AlertConfiguration alertConfiguration1 = null;
-        alertLogService.selectAlertLogByUserId(userId);
-        if (alertLogService.selectAlertLogByUserId(userId)!=null){
-            AlertLog alertLog = alertLogService.selectAlertLogByUserId(userId);
-            Long alertId = alertLog.getAlertId();
-            alertConfiguration = alertConfigurationService.selectAlertConfigurationById(alertId);
-            if (alertConfiguration.getAlertStatus().equals("1")){
-                //是否超时
-                Date date = new Date();
-                int i = date.compareTo(alertConfiguration.getAlertStartTime());
-                int i1 = date.compareTo(alertConfiguration.getAlertEndTime());
-                if (i>=0&&i1<=0){
-                    //不超时
-                    if (alertLog.getAlertNum()<alertConfiguration.getAlertNum()){
-                        //提醒次数没用完
-                        alertLog.setAlertNum(alertLog.getAlertNum()+1);
-                        alertLogService.updateAlertLog(alertLog);
-                        return AjaxResult.success().putKV("log", alertConfiguration);
-                    }else {
-                        return AjaxResult.success("不能弹");
-                    }
-                }else {
-                    return AjaxResult.success("不能弹");
-                }
-            }else {
-                //对应的弹幕没启动,结束
-                return AjaxResult.success("不能弹");
-            }
-        }else {
-            //是否启动
-            alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(1);
-            SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
-            String salesLevel = sysUserExt.getSalesLevel();
-            if (alertConfiguration1!=null){
-                Date date = new Date();
-                int i = date.compareTo(alertConfiguration1.getAlertStartTime());
-                int i1 = date.compareTo(alertConfiguration1.getAlertEndTime());
-                if (i >= 0 && i1 <= 0) {
-                    //不超时,判断身份,用户类型默认0立邦员工1经销商 经销商是customer_level
-                    alertConfiguration1.getAlertStatus();
-                    if (alertConfiguration1.getUserType().equals("1")&&salesLevel.equals("customer_level")){
-                        //经销商
-                        AlertLog alertLog1 = new AlertLog();
-                        alertLog1.setAlertId(alertConfiguration1.getAlertId());
-                        alertLog1.setUserId(userId);
-                        alertLog1.setUserType("1");
-                        alertLog1.setAlertNum(0L);
-                        alertLogService.insertAlertLog(alertLog1);
-                        return AjaxResult.success().putKV("log",alertConfiguration1);
-                    }else if(alertConfiguration1.getUserType().equals("0")&& !salesLevel.equals("customer_level")){
-                        //立邦员工
-                        AlertLog alertLog1 = new AlertLog();
-                        alertLog1.setAlertId(alertConfiguration1.getAlertId());
-                        alertLog1.setUserId(userId);
-                        alertLog1.setUserType("0");
-                        alertLog1.setAlertNum(0L);
-                        alertLogService.insertAlertLog(alertLog1);
-                        return AjaxResult.success().putKV("log",alertConfiguration1);
-                    }else {
-                        return AjaxResult.success("不能弹");
-                    }
-                } else {
-                    return AjaxResult.success("不能弹");
-                }
-            }else {
-                return AjaxResult.success("不能弹");
-            }
-        }
-    }
-
-    @ApiOperation(value = "微信弹框",notes = "参数:{userId:1}")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "userId" , paramType = "body",dataType = "Long")
-//    })
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params" , paramType = "body")
     })
@@ -159,7 +73,7 @@ public class WxAlertLogController  extends ApiBaseController {
                         if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
                             alertLog.setAlertNum(alertLog.getAlertNum()+1);
                             alertLogService.updateAlertLog(alertLog);
-                            return AjaxResult.success(alertLog);
+                            return AjaxResult.success(alertConfiguration1);
                         }else {
                             return AjaxResult.warning("每日弹出次数已满");
                         }
@@ -175,12 +89,13 @@ public class WxAlertLogController  extends ApiBaseController {
                     }
                 }
                 if(strings.contains("0")&&!sysUserExt.getSalesLevel().equals("customer_level")){
+                    System.out.println(userId);
                     AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId());
                     if (alertLog!=null){
                         if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
                             alertLog.setAlertNum(alertLog.getAlertNum()+1);
                             alertLogService.updateAlertLog(alertLog);
-                            return AjaxResult.success(alertLog);
+                            return AjaxResult.success(alertConfiguration1);
                         }else {
                             return AjaxResult.warning("每日弹出次数已满");
                         }