Przeglądaj źródła

# Conflicts:
# suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/HanaOrderComponent.java

yousongbo 1 miesiąc temu
rodzic
commit
0abb0dac7a

+ 5 - 0
suishenbang-quartz/src/main/java/com/dgtly/quartz/task/RyTask.java

@@ -103,6 +103,11 @@ public class RyTask
         hanaOrderComponent.hanaSalesDeliverSignatureSync();
     }
 
+    /**定时同步公装经销商(主经销商认证则公装也认证)*/
+    public void certificationSync() throws Exception {
+        hanaOrderComponent.certificationSync();
+    }
+
     /**
      * @description: C类产品订单标记
      * @param: []

Plik diff jest za duży
+ 44 - 39
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/HanaOrderComponent.java


+ 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,@Param("isCacheType") String isCacheType);
+    AlertLog selectAlertLogByUserIdAndAlertId(@Param("userId") Long userId,@Param("alertId") Long alertId,@Param("isCacheType") String isCacheType,@Param("userType") String userType);
 }

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

@@ -145,6 +145,6 @@ public interface MetaHanaDeliverSignMapper
    List<String> selectDeliverNumListByTmsShipmentNumber(@Param("tmsShipmentNumber") String tmsShipmentNumber);
 
 
-
+   int updateCertificationSync();
 
 }

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

@@ -24,6 +24,8 @@ public interface IAlertConfigurationService
 
     public AlertConfiguration selectAlertConfiguration(List<String> userTypeList);
 
+    AlertConfiguration selectAlert(String alertStatus);
+
     /**
      * 查询弹框配置列表
      * 

+ 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,String isCacheType);
+    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId,String isCacheType,String userType);
 
     /**
      * 查询弹框日志列表

+ 3 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/IMetaHanaDeliverSignService.java

@@ -64,4 +64,7 @@ public interface IMetaHanaDeliverSignService
     public void pretreatmentHanaDeliverSign();
 
 
+    void certificationSync();
+
+
 }

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

@@ -105,6 +105,29 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
         return  null;
     }
 
+    @Override
+    public AlertConfiguration selectAlert(String alertStatus) {
+        //查询有效弹窗
+        List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus();
+        if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){
+            //判断弹框的组织 如果弹框有组织 对比该组织与员工的组织是否一致
+            Iterator<AlertConfiguration> it = alertConfigurationList.iterator();
+            while (it.hasNext()) {
+                AlertConfiguration alert = it.next();
+                //diy
+                if( alert.getOrgCode() ==null || ("null").equals(alert.getOrgCode())){
+                    String [] userTypes = alert.getUserType().split(",");
+                    boolean exists = Arrays.stream(userTypes)
+                            .anyMatch(str -> str.equals(alertStatus));
+                    if (exists){
+                        return alert;
+                    }
+                }
+            }
+        }
+        return  null;
+    }
+
     /**
      * 查询弹框配置列表
      * 

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

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

+ 5 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/MetaHanaDeliverSignServiceImpl.java

@@ -253,6 +253,11 @@ public class MetaHanaDeliverSignServiceImpl implements IMetaHanaDeliverSignServi
 
     }
 
+    @Override
+    public void certificationSync() {
+        metaHanaDeliverSignMapper.updateCertificationSync();
+    }
+
 
     public  String findMaxValidDateTime(List<MetaHanaDeliverSign> list) {
         return list.stream()

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

@@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="isCacheType !=null and  isCacheType == '0'.toString()">
             and DATE_FORMAT(create_time,'%Y%m%d') = DATE_FORMAT(NOW(),'%Y%m%d')
         </if>
+        <if test="userType != null ">and user_type = #{userType}</if>
         order by  create_time desc
         limit 1
     </select>

+ 8 - 0
suishenbang-system/src/main/resources/mapper/system/MetaHanaDeliverSignMapper.xml

@@ -217,5 +217,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </insert>
 
+    <update id="updateCertificationSync" >
+        UPDATE customers_ext set is_authentication ='1' WHERE chains_code in (
+        SELECT chains_code FROM customers_ext WHERE chains_code in (
+        SELECT t2.customer_code FROM customers_ext t1 LEFT JOIN meta_relation_ship_diy t2
+        on  t1.chains_code = t2.main_customer_code
+        WHERE t1.is_authentication = '1' ) and is_authentication != '1')
+    </update>
+
 
 </mapper>

+ 13 - 96
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -57,36 +57,9 @@ public class WxAlertLogController  extends ApiBaseController {
     public Object getAlertLog() throws ParseException {
         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);
-        log.info("用户信息:{}", JSON.toJSON(sysUserExt));
-        List<SysUserShopExt>  sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
-        log.info("用户门店信息:{}", JSON.toJSON(sysUserShopExt));
-        if (sysUserShopExt != null && sysUserShopExt.size() > 0) {
-            for (SysUserShopExt shopExt : sysUserShopExt) {
-                userTypeSet.add(shopExt.getIsShopType());
-            }
-            for (String userType : userTypeSet){
-                if ("0".equals(userType)){
-                    userTypeList.add("3");
-                }else {
-                    userTypeList.add("4");
-                }
-            }
-        }
-        AlertConfiguration alertConfiguration1 = null;
-        if (sysUserExt != null){
-            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(userTypeList);
-        }
+        String userTp = obj.getString("userType");
+        log.info("当前系统进来为{}",userTp);
+        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlert(userTp);
         //是否有启动弹窗
         log.info("本次匹配的弹窗:{}",JSON.toJSON(alertConfiguration1));
         if (alertConfiguration1 != null){
@@ -99,74 +72,18 @@ public class WxAlertLogController  extends ApiBaseController {
             int i = date.compareTo(alertConfiguration1.getAlertStartTime());
             int i1 = date.compareTo(alertConfiguration1.getAlertEndTime());
             if (i >= 0 && i1 < 0) {
-                //满足时间
-                String[] split = alertConfiguration1.getUserType().split(",");
-                List<String> strings = Arrays.asList(split);
-                if (sysUserExt != null){
-                    log.info("开始匹配用户:{}",JSON.toJSON(sysUserExt));
-                    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 {
-                            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);
-                            }else {
-                                return AjaxResult.warning("每日弹出次数已满");
-                            }
-                        }else {
-                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
-                            return AjaxResult.success(alertConfiguration1);
-                        }
-                    }
-                }
-                //判断该用户是否为金牌店或仿石漆
-                if (sysUserShopExt != null){
-                    log.info("开始匹配门店信息:{}",JSON.toJSON(sysUserShopExt));
-                    if((strings.contains("3") || strings.contains("2")) && userTypeSet.contains("0")){
-                        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 {
-                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"3");
-                            return AjaxResult.success(alertConfiguration1);
-                        }
-                    }
-                    if((strings.contains("4") || strings.contains("2")) && userTypeSet.contains("1")){
-                        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 {
-                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"4");
-                            return AjaxResult.success(alertConfiguration1);
-                        }
+                AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),userTp,userTp);
+                if (alertLog!=null){
+                    if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
+                        updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
+                        return AjaxResult.success(alertConfiguration1);
+                    }else {
+                        return AjaxResult.warning("每日弹出次数已满");
                     }
+                }else {
+                    intAlertLog(alertConfiguration1,"1",now,sdf,userId,userTp);
+                    return AjaxResult.success(alertConfiguration1);
                 }
-                return AjaxResult.warning("没有符合的弹框");
             } else {
                 //超时
                 return AjaxResult.warning("时间超时");