Bladeren bron

Merge branch 'div-20251104' of http://git.dgtis.com/qxp/suishenbang-oneportal into div-20251104

yanym 3 weken geleden
bovenliggende
commit
9c66773c35

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

@@ -20,7 +20,7 @@ public interface IAlertConfigurationService
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(String salesLevel,String orgCode);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String orgCode);
 
     /**
      * 查询弹框配置列表

+ 1 - 1
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 salesLevel,String orgCode) {
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String orgCode) {
         //查询有效弹窗
         List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus();
         if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){

+ 30 - 37
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -52,26 +52,18 @@ public class WxAlertLogController  extends ApiBaseController {
     })
     @PostMapping("/getAlert")
     public Object getAlertLog() throws ParseException {
-//        String userType="";
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));
+        Set<String> userTypeSet = new HashSet<>();
         SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
-        String salesLevel = sysUserExt.getSalesLevel();
-        List<String> userTypeList = new ArrayList<>();
         List<SysUserShopExt>  sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
-        Set<String> userTypeSet = new HashSet<>();
-        for (SysUserShopExt shopExt : sysUserShopExt){
-            userTypeSet.add(shopExt.getIsShopType());
-        }
-
-        if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
-            userTypeList.add("1");
-        }else{
-            userTypeList.add("0");
+        if (sysUserShopExt != null && sysUserShopExt.size() > 0){
+            for (SysUserShopExt shopExt : sysUserShopExt){
+                userTypeSet.add(shopExt.getIsShopType());
+            }
         }
-
         //是否有启动弹窗
-        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(sysUserExt.getSalesLevel(),sysUserExt.getOrgCode());
+        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(sysUserExt.getOrgCode());
 
         if (alertConfiguration1!=null){
             //有启动
@@ -86,36 +78,37 @@ public class WxAlertLogController  extends ApiBaseController {
                 //满足时间
                 String[] split = alertConfiguration1.getUserType().split(",");
                 List<String> strings = Arrays.asList(split);
-                if ((strings.contains("1")  || strings.contains("2")) && sysUserExt.getSalesLevel().equals("customer_level")){
-                    //满足类型对应a
-                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
-                    if (alertLog!=null){
-                        if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
-                            updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
-                            return AjaxResult.success(alertConfiguration1);
+                if (sysUserExt != null){
+                    if ((strings.contains("1")  || strings.contains("2")) && sysUserExt.getSalesLevel().equals("customer_level")){
+                        //满足类型对应a
+                        AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
+                        if (alertLog!=null){
+                            if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
+                                updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
+                                return AjaxResult.success(alertConfiguration1);
+                            }else {
+                                return AjaxResult.warning("每日弹出次数已满");
+                            }
                         }else {
-                            return AjaxResult.warning("每日弹出次数已满");
+                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"1");
+                            return AjaxResult.success(alertConfiguration1);
                         }
-                    }else {
-                        intAlertLog(alertConfiguration1,"1",now,sdf,userId,"1");
-                        return AjaxResult.success(alertConfiguration1);
                     }
-                }
-                if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
-                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
-                    if (alertLog!=null){
-                        if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
-                            updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
-                            return AjaxResult.success(alertConfiguration1);
+                    if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
+                        AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
+                        if (alertLog!=null){
+                            if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
+                                updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
+                                return AjaxResult.success(alertConfiguration1);
+                            }else {
+                                return AjaxResult.warning("每日弹出次数已满");
+                            }
                         }else {
-                            return AjaxResult.warning("每日弹出次数已满");
+                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
+                            return AjaxResult.success(alertConfiguration1);
                         }
-                    }else {
-                        intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
-                        return AjaxResult.success(alertConfiguration1);
                     }
                 }
-
                 //判断该用户是否为金牌店或仿石漆
                 if (sysUserShopExt != null){
                     if((strings.contains("3") || strings.contains("2")) && userTypeSet.contains("0")){

+ 21 - 16
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

@@ -119,35 +119,40 @@ public class WxPortalController extends ApiBaseController {
     })
     @PostMapping("/ridingLantern")
     public Object getRidingLantern(){
-//        String userType="";
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));
-        SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
-        String salesLevel = sysUserExt.getSalesLevel();
         List<String> userTypeList = new ArrayList<>();
-        if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
-            userTypeList.add("1");
-        }else{
-            userTypeList.add("0");
-        }
-        List<SysUserShopExt>  sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
         Set<String> userTypeSet = new HashSet<>();
-        for (SysUserShopExt shopExt : sysUserShopExt){
-            userTypeSet.add(shopExt.getIsShopType());
+        SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
+        if (sysUserExt != null){
+            String salesLevel = sysUserExt.getSalesLevel();
+            if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
+                userTypeList.add("1");
+            }else{
+                userTypeList.add("0");
+            }
         }
-        for (String userType : userTypeSet){
-            if ("0".equals(userType)){
-                userTypeList.add("2");
-            }else {
-                userTypeList.add("3");
+        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");
+                }
             }
         }
+        log.info("该用户的userType为:{}",userTypeList);
         List<SysRidingLantern> lanternList = sysRidingLanternService.selectLanternList();
         List<SysRidingLantern> lanternListhow=new ArrayList<>();
         if (lanternList != null && lanternList.size() > 0) {
             lanternList.forEach(lantern->{
                 //如果userType为空,则添加通知,
                 if (StringUtils.isEmpty(lantern.getUserType())){
+                    lantern.setUserType("");
                     lanternListhow.add(lantern);
                 }else {
                     String[] split = lantern.getUserType().split(",");