njs 1 年間 前
コミット
ff3bd2ba53

+ 2 - 2
suishenbang-admin/src/main/java/com/dgtly/web/controller/system/AlertConfigurationController.java

@@ -86,7 +86,7 @@ public class AlertConfigurationController extends BaseController
     @ResponseBody
     public AjaxResult addSave(AlertConfiguration alertConfiguration)
     {
-        int num = alertConfigurationService.selectAlertConfigurationListFilter();
+        int num = alertConfigurationService.selectAlertConfigurationListFilter(alertConfiguration);
         if (alertConfiguration.getAlertStatus().equals("1")&&num==1){
             return error("弹幕通知只能有一个启动,请修改后重新添加");
         }
@@ -116,7 +116,7 @@ public class AlertConfigurationController extends BaseController
         //没改之前的配置
         AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationById(alertConfiguration.getAlertId());
         //判断之前有没有
-        int num = alertConfigurationService.selectAlertConfigurationListFilter();
+        int num = alertConfigurationService.selectAlertConfigurationListFilter(alertConfiguration);
         if(num==1){
             if (alertConfiguration1.getAlertStatus().equals("1")){
                 return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));

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

@@ -1,6 +1,8 @@
 package com.dgtly.system.mapper;
 
 import com.dgtly.system.domain.AlertConfiguration;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 /**
@@ -19,7 +21,7 @@ public interface AlertConfigurationMapper
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(@Param("userType") String userType);
 
 
     /**
@@ -30,7 +32,7 @@ public interface AlertConfigurationMapper
      */
     public List<AlertConfiguration> selectAlertConfigurationList(AlertConfiguration alertConfiguration);
 
-    public int selectAlertConfigurationListFilter();
+    public int selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration);
 
     /**
      * 新增弹框配置

+ 2 - 2
suishenbang-system/src/main/java/com/dgtly/system/service/IAlertConfigurationService.java

@@ -19,7 +19,7 @@ public interface IAlertConfigurationService
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String userType);
 
     /**
      * 查询弹框配置列表
@@ -30,7 +30,7 @@ public interface IAlertConfigurationService
     public List<AlertConfiguration> selectAlertConfigurationList(AlertConfiguration alertConfiguration);
 
 //
-    public int selectAlertConfigurationListFilter();
+    public int selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration);
 
     /**
      * 新增弹框配置

+ 4 - 4
suishenbang-system/src/main/java/com/dgtly/system/service/impl/AlertConfigurationServiceImpl.java

@@ -34,8 +34,8 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus) {
-        return alertConfigurationMapper.selectAlertConfigurationByAlertStatus(alertStatus);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String userType) {
+        return alertConfigurationMapper.selectAlertConfigurationByAlertStatus(userType);
     }
 
     /**
@@ -51,8 +51,8 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public int selectAlertConfigurationListFilter() {
-        return alertConfigurationMapper.selectAlertConfigurationListFilter();
+    public int selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration) {
+        return alertConfigurationMapper.selectAlertConfigurationListFilter(alertConfiguration);
     }
 
     /**

+ 10 - 7
suishenbang-system/src/main/resources/mapper/system/AlertConfigurationMapper.xml

@@ -38,11 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectAlertConfigurationListFilter" resultType="java.lang.Integer">
         SELECT
-            count(*)
+            count(0)
         FROM
             alert_configuration
-        WHERE alert_configuration.alert_status = 1
-
+        WHERE alert_status = 1
+        <if test="userType !=null and userType !=''">
+            and user_type = #{userType}
+        </if>
     </select>
     
     <select id="selectAlertConfigurationById" parameterType="Long" resultMap="AlertConfigurationResult">
@@ -51,10 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectAlertConfigurationByAlertStatus" parameterType="Long" resultMap="AlertConfigurationResult">
-        select *
-        FROM
-            alert_configuration
-        WHERE alert_configuration.alert_status = 1
+        <include refid="selectAlertConfigurationVo"/>
+        WHERE alert_status = 1
+        <if test="userType !=null and userType !=''">
+            and user_type = #{userType}
+        </if>
     </select>
 
     <insert id="insertAlertConfiguration" parameterType="AlertConfiguration" useGeneratedKeys="true" keyProperty="alertId">

+ 9 - 2
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -50,12 +50,19 @@ public class WxAlertLogController  extends ApiBaseController {
     })
     @PostMapping("/getAlert")
     public Object getAlertLog(){
+        String userType="";
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));
-        //是否有启动
-        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(1);
         SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
         String salesLevel = sysUserExt.getSalesLevel();
+        if(("customer_level").equals(salesLevel)){
+            userType = "1";
+        }else{
+            userType = "0";
+        }
+        //是否有启动
+        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(userType);
+
         if (alertConfiguration1!=null){
             //有启动
             Date date = new Date();