Bladeren bron

增加弹窗匹配

yousongbo 3 weken geleden
bovenliggende
commit
58c565e9c9

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

@@ -20,9 +20,9 @@ public interface IAlertConfigurationService
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(String orgCode);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(List<String> userTypeList,String orgCode);
 
-    public AlertConfiguration selectAlertConfiguration();
+    public AlertConfiguration selectAlertConfiguration(List<String> userTypeList);
 
     /**
      * 查询弹框配置列表

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

@@ -37,7 +37,7 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(String orgCode) {
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(List<String> userTypeList,String orgCode) {
         //查询有效弹窗
         List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus();
         if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){
@@ -47,12 +47,26 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
                 AlertConfiguration alert = it.next();
                 //diy
                 if( alert.getOrgCode() ==null || ("null").equals(alert.getOrgCode())){
-                    return alert;
+                    for (String userType:userTypeList){
+                        String [] userTypes = userType.split(",");
+                        boolean exists = Arrays.stream(userTypes)
+                                .anyMatch(str -> str.equals(userType));
+                        if (exists){
+                            return alert;
+                        }
+                    }
                 }else {
                     List<String>  orgCodes = alertConfigurationMapper.selectOrgCodeByInterface(alert.getSalesLevel(),alert.getOrgCode());
                     if(orgCodes !=null && orgCodes.size()>0){
                         if(orgCodes.contains(orgCode)){
-                            return alert;
+                            for (String userType:userTypeList){
+                                String [] userTypes = userType.split(",");
+                                boolean exists = Arrays.stream(userTypes)
+                                        .anyMatch(str -> str.equals(userType));
+                                if (exists){
+                                    return alert;
+                                }
+                            }
                         }
                     }
                 }
@@ -62,7 +76,7 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public AlertConfiguration selectAlertConfiguration() {
+    public AlertConfiguration selectAlertConfiguration(List<String> userTypeList) {
         //查询有效弹窗
         List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus();
         if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){
@@ -72,7 +86,14 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
                 AlertConfiguration alert = it.next();
                 //diy
                 if( alert.getOrgCode() ==null || ("null").equals(alert.getOrgCode())){
-                    return alert;
+                    for (String userType:userTypeList){
+                        String [] userTypes = userType.split(",");
+                        boolean exists = Arrays.stream(userTypes)
+                                .anyMatch(str -> str.equals(userType));
+                        if (exists){
+                            return alert;
+                        }
+                    }
                 }
             }
         }

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

@@ -55,18 +55,32 @@ public class WxAlertLogController  extends ApiBaseController {
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));
         Set<String> userTypeSet = new HashSet<>();
+        List<String> userTypeList = new ArrayList<>();
         SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
         List<SysUserShopExt>  sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
         if (sysUserShopExt != null && sysUserShopExt.size() > 0) {
             for (SysUserShopExt shopExt : sysUserShopExt) {
                 userTypeSet.add(shopExt.getIsShopType());
             }
+            for (String userType : userTypeSet){
+                if ("0".equals(userType)){
+                    userTypeList.add("2");
+                }else {
+                    userTypeList.add("3");
+                }
+            }
         }
         AlertConfiguration alertConfiguration1 = null;
         if (sysUserExt != null){
-            alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(sysUserExt.getOrgCode());
+            String salesLevel = sysUserExt.getSalesLevel();
+            if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
+                userTypeList.add("1");
+            }else{
+                userTypeList.add("0");
+            }
+            alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(userTypeList,sysUserExt.getOrgCode());
         }else {
-            alertConfiguration1 = alertConfigurationService. selectAlertConfiguration();
+            alertConfiguration1 = alertConfigurationService. selectAlertConfiguration(userTypeList);
         }
         //是否有启动弹窗