Ver código fonte

合并1104分支

yousongbo 3 semanas atrás
pai
commit
b4b0454965
19 arquivos alterados com 359 adições e 343 exclusões
  1. 21 8
      suishenbang-admin/src/main/java/com/dgtly/web/controller/system/AlertConfigurationController.java
  2. 9 37
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html
  3. 17 20
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html
  4. 9 31
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/edit.html
  5. 3 6
      suishenbang-admin/src/main/resources/templates/system/lantern/add.html
  6. 14 22
      suishenbang-admin/src/main/resources/templates/system/lantern/edit.html
  7. 17 34
      suishenbang-admin/src/main/resources/templates/system/lantern/lantern.html
  8. 18 0
      suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java
  9. 1 1
      suishenbang-system/src/main/java/com/dgtly/system/mapper/AlertConfigurationMapper.java
  10. 1 1
      suishenbang-system/src/main/java/com/dgtly/system/mapper/SysUserShopExtMapper.java
  11. 3 1
      suishenbang-system/src/main/java/com/dgtly/system/service/IAlertConfigurationService.java
  12. 1 1
      suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserShopExtService.java
  13. 43 15
      suishenbang-system/src/main/java/com/dgtly/system/service/impl/AlertConfigurationServiceImpl.java
  14. 1 1
      suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserShopExtServiceImpl.java
  15. 0 3
      suishenbang-system/src/main/resources/mapper/system/AlertConfigurationMapper.xml
  16. 4 1
      suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml
  17. 1 1
      suishenbang-system/src/main/resources/mapper/system/SysUserShopExtMapper.xml
  18. 150 149
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java
  19. 46 11
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

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

@@ -1,10 +1,11 @@
 package com.dgtly.web.controller.system;
 
-import java.util.ArrayList;
-import java.util.HashMap;
+
 import java.util.List;
-import java.util.Map;
-import com.dgtly.system.domain.OrderSalesParameter;
+
+import com.alibaba.fastjson2.JSON;
+import com.dgtly.common.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -25,6 +26,7 @@ import com.dgtly.common.core.page.TableDataInfo;
  * @author chenyn
  * @date 2023-06-13
  */
+@Slf4j
 @Controller
 @RequestMapping("/system/configuration")
 public class AlertConfigurationController extends BaseController
@@ -86,13 +88,17 @@ public class AlertConfigurationController extends BaseController
     @ResponseBody
     public AjaxResult addSave(AlertConfiguration alertConfiguration)
     {
-      /*  int num = alertConfigurationService.selectAlertConfigurationListFilter(alertConfiguration);
-        if ( num==1){
-            return error("弹幕通知只能有一个该组织下启动,请先关闭该组织下已启动的后重新添加");
-        }*/
+        log.info("11111111111{}", JSON.toJSON(alertConfiguration));
+        //如果userType为空,则添加所有人通知
+        if (StringUtils.isEmpty(alertConfiguration.getUserType())){
+            alertConfiguration.setUserType("2");
+        }
+        log.info("3333333333{}", JSON.toJSON(alertConfiguration));
         return toAjax(alertConfigurationService.insertAlertConfiguration(alertConfiguration));
     }
 
+
+
     /**
      * 修改弹框配置
      */
@@ -112,6 +118,13 @@ public class AlertConfigurationController extends BaseController
     @ResponseBody
     public AjaxResult editSave(AlertConfiguration alertConfiguration)
     {
+
+        log.info("新增弹框配置");
+        log.info("222222222{}", JSON.toJSON(alertConfiguration));
+        //如果userType为空,则添加所有人通知
+        if (StringUtils.isEmpty(alertConfiguration.getUserType())){
+            alertConfiguration.setUserType("2");
+        }
         if(("0").equals(alertConfiguration.getAlertStatus())){
             return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
         }

+ 9 - 37
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html

@@ -44,20 +44,12 @@
             <label class="col-sm-3 control-label">弹框开始时间:</label>
             <div class="col-sm-8">
                 <input id="alertStartTime" name="alertStartTime" class="form-control" type="datetime-local">
-                <!--<div class="input-group date">-->
-                    <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
-                    <!--<input id="alertStartTime" name="alertStartTime" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
-                <!--</div>-->
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">弹框结束时间:</label>
             <div class="col-sm-8">
                 <input id="alertEndTime" name="alertEndTime" class="form-control" type="datetime-local">
-                <!--<div class="input-group date">-->
-                    <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
-                    <!--<input id="alertEndTime" name="alertEndTime" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
-                <!--</div>-->
             </div>
         </div>
         <div class="form-group">
@@ -69,9 +61,10 @@
         <div class="form-group">
             <label class="col-sm-3 control-label">用户类型:</label>
             <div class="col-sm-8">
-                <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_alert_permission')}">
+                <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_alert_permission')}" multiple>
                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                 </select>
+                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 默认为全部人员</span>
             </div>
         </div>
         <div class="form-group">
@@ -95,16 +88,6 @@
                 <a class="btn btn-primary btn-rounded btn-sm" id="clearSelect">清空部门类型</a>
             </div>
         </div>
-<!--        <div class="form-group">
-            <label class="col-sm-3 control-label">是否启动:</label>
-            <div class="col-sm-8">
-                <div class="radio-box" th:each="dict : ${@dict.getType('sys_ziti_show_hide')}">
-                    <input type="radio" th:id="${dict.dictCode}" name="alertStatus" th:value="${dict.dictValue}"
-                           th:checked="${dict.default}">
-                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
-                </div>
-            </div>
-        </div>-->
     </form>
 </div>
 <th:block th:include="include :: footer" />
@@ -131,7 +114,6 @@
         }
         $("#alertContentItem").hide();
         $("#alertImageItem").hide();
-        $("#userType").selectpicker('val','1');
         getCompanyList(obj);
         $('#avatar').on('change', function () {
             var reader = new FileReader();
@@ -237,9 +219,6 @@
             },
             alertNum: {
                 required:true
-            },
-            userType: {
-                required:true
             }
         },
     });
@@ -266,17 +245,21 @@
 
     function submitHandler() {
         if ($.validate.form()) {
-            debugger
             var alertTitle = $('#alertTitle').val();
             var alertType = $('#alertType').val();
             var contentVal = $('#alertContent').val();
             var startTime = $('#alertStartTime').val().replace('T',' ');
             var endTime = $('#alertEndTime').val().replace('T',' ');
             var alertNum = $('#alertNum').val();
-            var userType = $('#userType').val();
+            var userType;
+            if ($('#userType').val()) {
+                userType = $('#userType').val().join(',');
+            }else {
+                userType = '';
+            }
             if (new Date(startTime).getTime() - new Date(endTime).getTime() >= 0){
                 $.modal.alertWarning("弹框结束时间不能小于开始时间");
-            }else {
+            } else {
                 var objSubmit = {
                     alertTitle:alertTitle,
                     alertType:alertType,
@@ -322,20 +305,9 @@
                 }
                 $.ajax(configSubmit)
             }
-            // $.operate.save(prefix + "/add", $('#form-configuration-add').serialize());
         }
     }
 
-    // $("input[name='alertStartTime']").datetimepicker({
-    //     format: "yyyy-mm-dd hh:ii",
-    //     autoclose: true
-    // });
-    //
-    // $("input[name='alertEndTime']").datetimepicker({
-    //     format: "yyyy-mm-dd hh:ii",
-    //     autoclose: true
-    // });
-
     /* 获取公司列表 */
     function getCompanyList(obj) {
         var config = {

+ 17 - 20
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html

@@ -89,15 +89,6 @@
                 <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:configuration:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:configuration:edit">-->
-                    <!--<i class="fa fa-edit"></i> 修改-->
-                <!--</a>-->
-                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:configuration:remove">-->
-                    <!--<i class="fa fa-remove"></i> 删除-->
-                <!--</a>-->
-                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:configuration:export">-->
-                    <!--<i class="fa fa-download"></i> 导出-->
-                 <!--</a>-->
             </div>
             <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
@@ -171,17 +162,23 @@
                     field : 'userType',
                     title : '用户类型',
                     formatter: function(value, row, index) {
-                        if (value.indexOf('2') != -1){
-                            return '立邦人员、经销商';
-                        }
-                        if (value.indexOf('1') != -1) {
-                            return '经销商';
-                        }
-                        if (value.indexOf('0') != -1) {
-                            return '立邦员工';
-                        }
-                        if (value.indexOf('3') != -1) {
-                            return '其他';
+                        if (value == 2){
+                            return '全部人员';
+                        } else {
+                            var userStr = '';
+                            if (value.indexOf('0') != -1){
+                                userStr += '立邦员工 ';
+                            }
+                            if (value.indexOf('1') != -1){
+                                userStr += '经销商 ';
+                            }
+                            if (value.indexOf('3') != -1){
+                                userStr += '服务商 ';
+                            }
+                            if (value.indexOf('4') != -1){
+                                userStr += '金牌店 ';
+                            }
+                            return userStr;
                         }
                     }
                 },

+ 9 - 31
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/edit.html

@@ -56,10 +56,6 @@
                 <label class="col-sm-3 control-label">弹框结束时间:</label>
                 <div class="col-sm-8">
                     <input id="alertEndTime" name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd HH:mm')}" class="form-control" type="datetime-local">
-                    <!--<div class="input-group date">-->
-                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
-                        <!--<input id="alertEndTime" name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">-->
-                    <!--</div>-->
                 </div>
             </div>
             <div class="form-group">
@@ -71,9 +67,10 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">用户类型:</label>
                 <div class="col-sm-8">
-                    <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_alert_permission')}">
+                    <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_alert_permission')}" multiple>
                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{userType}"></option>
                     </select>
+                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 默认为全部人员</span>
                 </div>
             </div>
             <div class="form-group">
@@ -105,16 +102,6 @@
                     <a class="btn btn-primary btn-rounded btn-sm" id="clearSelect">清空部门类型</a>
                 </div>
             </div>
-       <!--     <div class="form-group">
-                <label class="col-sm-3 control-label">是否启动:</label>
-                <div class="col-sm-8">
-                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_ziti_show_hide')}">
-                        <input type="radio" th:id="${dict.dictCode}" name="alertStatus" th:value="${dict.dictValue}"
-                               th:field="*{alertStatus}">
-                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
-                    </div>
-                </div>
-            </div>-->
         </form>
     </div>
     <th:block th:include="include :: footer" />
@@ -145,7 +132,7 @@
                 $("#alertContentItem").hide();
                 $("#div-bgUrl").html("<img src='" + formData.photoUrl + "' style='width:300px;margin-bottom: 5px;'>");
             }
-            $("#userType").selectpicker('val',formData.userType);
+            $("#userType").selectpicker('val',formData.userType.split(','));
             if (formData.salesLevel == 'company_level'){
                 var objhx1 = {
                     parType: 'company_level',
@@ -263,9 +250,6 @@
                 },
                 alertNum: {
                     required:true
-                },
-                userType: {
-                    required:true
                 }
             }
         });
@@ -279,7 +263,12 @@
                 var startTime = $('#alertStartTime').val().replace('T',' ');
                 var endTime = $('#alertEndTime').val().replace('T',' ');
                 var alertNum = $('#alertNum').val();
-                var userType = $('#userType').val();
+                var userType;
+                if ($('#userType').val()) {
+                    userType = $('#userType').val().join(',');
+                }else {
+                    userType = '';
+                }
                 if (new Date(startTime).getTime() - new Date(endTime).getTime() >= 0){
                     $.modal.alertWarning("弹框结束时间不能小于开始时间");
                 }else {
@@ -330,19 +319,8 @@
                     $.ajax(configSubmit)
                 }
             }
-            // $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
         }
 
-        // $("input[name='alertStartTime']").datetimepicker({
-        //     format: "yyyy-mm-dd hh:ii",
-        //     autoclose: true
-        // });
-        //
-        // $("input[name='alertEndTime']").datetimepicker({
-        //     format: "yyyy-mm-dd hh:ii",
-        //     autoclose: true
-        // });
-
         $('#avatar').on('change', function () {
             var reader = new FileReader();
             reader.onload = function (e) {

+ 3 - 6
suishenbang-admin/src/main/resources/templates/system/lantern/add.html

@@ -45,7 +45,7 @@
                     <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_lantern_permission')}" multiple>
                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                     </select>
-                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
+                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 默认为全部人员</span>
                 </div>
             </div>
             <!--<div class="form-group">    -->
@@ -64,6 +64,7 @@
     <th:block th:include="include :: bootstrap-select-js" />
     <script type="text/javascript">
         var prefix = ctx + "system/lantern"
+
         $("#form-lantern-add").validate({
             focusCleanup: true,
             rules:{
@@ -81,11 +82,7 @@
 
         function submitHandler() {
             if ($.validate.form()) {
-                if ($('#userType').selectpicker('val') == null) {
-                    $.modal.msg("请选择通知人员");
-                }else {
-                    $.operate.save(prefix + "/add", $('#form-lantern-add').serialize());
-                }
+                $.operate.save(prefix + "/add", $('#form-lantern-add').serialize());
             }
         }
 

+ 14 - 22
suishenbang-admin/src/main/resources/templates/system/lantern/edit.html

@@ -9,12 +9,6 @@
     <div class="wrapper wrapper-content animated fadeInRight ibox-content">
         <form class="form-horizontal m" id="form-lantern-edit" th:object="${sysRidingLantern}">
             <input name="id" th:field="*{id}" type="hidden">
-            <!--<div class="form-group">    -->
-                <!--<label class="col-sm-3 control-label">是否删除:</label>-->
-                <!--<div class="col-sm-8">-->
-                    <!--<input name="isDelete" th:field="*{isDelete}" class="form-control" type="text">-->
-                <!--</div>-->
-            <!--</div>-->
             <div class="form-group">
                 <label class="col-sm-3 control-label">内容:</label>
                 <div class="col-sm-8">
@@ -43,20 +37,11 @@
                 <label class="col-sm-3 control-label">公告人员:</label>
                 <div class="col-sm-8">
                     <select title="请选择" id="userType" name="userType" class="form-control m-b selectpicker" th:with="type=${@dict.getType('sys_lantern_permission')}" multiple>
-                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{userType}"></option>
                     </select>
-                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
+                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 默认为全部人员</span>
                 </div>
             </div>
-            <!--<div class="form-group">    -->
-                <!--<label class="col-sm-3 control-label">磁贴:</label>-->
-                <!--<div class="col-sm-8">-->
-                    <!--<select name="tile" class="form-control m-b">-->
-                        <!--<option value="">所有</option>-->
-                    <!--</select>-->
-                    <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
-                <!--</div>-->
-            <!--</div>-->
         </form>
     </div>
     <th:block th:include="include :: footer" />
@@ -64,6 +49,17 @@
     <th:block th:include="include :: bootstrap-select-js" />
     <script type="text/javascript">
         var prefix = ctx + "system/lantern";
+
+        $(document).ready(function () {
+            var formArray = $('#form-lantern-edit').serializeArray();
+            var formData = {};
+            $(formArray ).each(function(index, obj){
+                formData[obj.name] = obj.value;
+            });
+            console.log('form-lantern-edit',formData);
+            $("#userType").selectpicker('val',formData.userType.split(','));
+        })
+
         $("#form-lantern-edit").validate({
             focusCleanup: true,
             rules:{
@@ -81,11 +77,7 @@
 
         function submitHandler() {
             if ($.validate.form()) {
-                if ($('#userType').selectpicker('val') == null) {
-                    $.modal.msg("请选择通知人员");
-                }else {
-                    $.operate.save(prefix + "/edit", $('#form-lantern-edit').serialize());
-                }
+                $.operate.save(prefix + "/edit", $('#form-lantern-edit').serialize());
             }
         }
 

+ 17 - 34
suishenbang-admin/src/main/resources/templates/system/lantern/lantern.html

@@ -11,10 +11,6 @@
                 <form id="formId">
                     <div class="select-list">
                         <ul>
-                            <!--<li>-->
-                                <!--<p>是否删除:</p>-->
-                                <!--<input type="text" name="isDelete"/>-->
-                            <!--</li>-->
                             <li>
                                 <p>内容:</p>
                                 <input type="text" name="content"/>
@@ -22,13 +18,9 @@
                             <li class="select-time">
                                 <p>开始时间:</p>
                                 <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="startTime"/>
-                                <!--<span>-</span>-->
-                                <!--<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endStartTime]"/>-->
                             </li>
                             <li class="select-time">
                                 <p>结束时间:</p>
-                                <!--<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginEndTime]"/>-->
-                                <!--<span>-</span>-->
                                 <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
                             </li>
                             <li>
@@ -37,13 +29,6 @@
                                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                 </select>
                             </li>
-                            <!--<li>-->
-                                <!--<p>磁贴:</p>-->
-                                <!--<select name="tile" th:with="type=${@dict.getType('')}">-->
-                                    <!--<option value="">请选择</option>-->
-                                    <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
-                                <!--</select>-->
-                            <!--</li>-->
                             <li>
                                 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                 <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@@ -63,9 +48,6 @@
                 <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:lantern:remove">
                     <i class="fa fa-remove"></i> 删除
                 </a>
-                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:lantern:export">-->
-                    <!--<i class="fa fa-download"></i> 导出-->
-                 <!--</a>-->
             </div>
             <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
@@ -95,10 +77,6 @@
                     title : 'null',
                     visible: false
                 },
-                // {
-                //     field : 'isDelete',
-                //     title : '是否删除'
-                // },
                 {
                     field : 'content',
                     title : '内容',
@@ -120,21 +98,26 @@
                     field : 'userType',
                     title : '公告人员',
                     formatter: function(value, row, index) {
-                        if (value.indexOf('1') != -1 && value.indexOf('0') != -1){
-                            return '立邦人员、经销商';
-                        }
-                        if (value.indexOf('1') != -1 && value.indexOf('0') == -1) {
-                            return '经销商';
-                        }
-                        if (value.indexOf('1') == -1 && value.indexOf('0') != -1) {
-                            return '立邦人员';
+                        if (value == null){
+                            return '全部人员';
+                        } else {
+                            var userStr = '';
+                            if (value.indexOf('0') != -1){
+                                userStr += '立邦员工 ';
+                            }
+                            if (value.indexOf('1') != -1){
+                                userStr += '经销商 ';
+                            }
+                            if (value.indexOf('2') != -1){
+                                userStr += '服务商 ';
+                            }
+                            if (value.indexOf('3') != -1){
+                                userStr += '金牌店 ';
+                            }
+                            return userStr;
                         }
                     }
                 },
-                // {
-                //     field : 'tile',
-                //     title : '磁贴'
-                // },
                 {
                     title: '操作',
                     align: 'center',

+ 18 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java

@@ -146,6 +146,10 @@ public class SysUser extends BaseEntity
     //门店账号标识 1门店账号 0非门店账号
     private String  isShopAccount;
 
+    private String officeName;
+
+    private String subOfficeName;
+
     //应用类型对应关系
     private List<Map<String,Object> >loginTypeList;
    //门店对应关系
@@ -214,7 +218,21 @@ public class SysUser extends BaseEntity
         return isSelfDelivery;
     }
 
+    public String getOfficeName() {
+        return officeName;
+    }
+
+    public void setOfficeName(String officeName) {
+        this.officeName = officeName;
+    }
+
+    public String getSubOfficeName() {
+        return subOfficeName;
+    }
 
+    public void setSubOfficeName(String subOfficeName) {
+        this.subOfficeName = subOfficeName;
+    }
 
     public void setIsSelfDelivery(String isSelfDelivery) {
         this.isSelfDelivery = isSelfDelivery;

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

@@ -22,7 +22,7 @@ public interface AlertConfigurationMapper
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public List<AlertConfiguration> selectAlertConfigurationByAlertStatus(@Param("userType") String userType);
+    public List<AlertConfiguration> selectAlertConfigurationByAlertStatus();
 
 
     /**

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

@@ -19,7 +19,7 @@ public interface SysUserShopExtMapper
      * @param userId 门店人员信息扩展ID
      * @return 门店人员信息扩展
      */
-    public SysUserShopExt selectSysUserShopExtById(String userId);
+    public List<SysUserShopExt> selectSysUserShopExtById(String userId);
 
     /**
      * 查询门店人员信息扩展列表

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

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

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

@@ -17,7 +17,7 @@ public interface ISysUserShopExtService
      * @param userId 门店人员信息扩展ID
      * @return 门店人员信息扩展
      */
-    public SysUserShopExt selectSysUserShopExtById(String userId);
+    public List<SysUserShopExt>  selectSysUserShopExtById(String userId);
 
     /**
      * 查询门店人员信息扩展列表

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

@@ -37,8 +37,9 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(String userType,String salesLevel,String orgCode) {
-        List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus(userType);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(List<String> userTypeList,String orgCode) {
+        //查询有效弹窗
+        List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus();
         if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){
             //判断弹框的组织 如果弹框有组织 对比该组织与员工的组织是否一致
             Iterator<AlertConfiguration> it = alertConfigurationList.iterator();
@@ -46,27 +47,54 @@ 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)){
+                            for (String userType:userTypeList){
+                                String [] userTypes = userType.split(",");
+                                boolean exists = Arrays.stream(userTypes)
+                                        .anyMatch(str -> str.equals(userType));
+                                if (exists){
+                                    return alert;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return  null;
+    }
+
+    @Override
+    public AlertConfiguration selectAlertConfiguration(List<String> userTypeList) {
+        //查询有效弹窗
+        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())){
+                    for (String userType:userTypeList){
+                        String [] userTypes = userType.split(",");
+                        boolean exists = Arrays.stream(userTypes)
+                                .anyMatch(str -> str.equals(userType));
+                        if (exists){
                             return alert;
                         }
                     }
                 }
-//                if(orgCode ==null || ("").equals(orgCode)){
-//                    if( alert.getOrgCode() ==null || ("null").equals(alert.getOrgCode())){
-//                        return alert;
-//                    }
-//                }else{
-//                    List<String>  orgCodes = alertConfigurationMapper.selectOrgCodeByInterface(alert.getSalesLevel(),alert.getOrgCode());
-//                    if(orgCodes !=null && orgCodes.size()>0){
-//                        if(orgCodes.contains(orgCode)){
-//                            return alert;
-//                        }
-//                    }
-//                }
             }
         }
         return  null;

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

@@ -28,7 +28,7 @@ public class SysUserShopExtServiceImpl implements ISysUserShopExtService
      * @return 门店人员信息扩展
      */
     @Override
-    public SysUserShopExt selectSysUserShopExtById(String userId)
+    public List<SysUserShopExt>  selectSysUserShopExtById(String userId)
     {
         return sysUserShopExtMapper.selectSysUserShopExtById(userId);
     }

+ 0 - 3
suishenbang-system/src/main/resources/mapper/system/AlertConfigurationMapper.xml

@@ -60,9 +60,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectAlertConfigurationByAlertStatus" parameterType="Long" resultMap="AlertConfigurationResult">
         <include refid="selectAlertConfigurationVo"/>
         WHERE alert_status = 1
-        <if test="userType !=null and userType !=''  ">
-            and ( user_type =#{userType}  or user_type ='2')
-        </if>
         AND now() >=alert_start_time
         AND alert_end_time > now()
     </select>

+ 4 - 1
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -31,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateBy"     column="update_by"    />
 		<result property="updateTime"   column="update_time"  />
 		<result property="remark"       column="remark"       />
+		<result property="officeName"       column="sales_office_name"       />
+		<result property="subOfficeName"       column="sales_group_name"       />
 		<result property="isConsignee"       column="is_consignee"       />
 		<result property="isIndependently"  column="is_independently" />
 		<result property="isSelfDelivery" column="is_self_delivery" />
@@ -96,13 +98,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        		    d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
        		    r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,
        		    suse.sales_level,suse.org_name,suse.org_code,suse.sap_employee_id,suse.boss_employee_id,suse.boss_name,suse.customer_code,suse.is_customer_manager,
-       		    suse.post_name,suse.post_code,suse.identity
+       		    suse.post_name,suse.post_code,suse.identity,cust.sales_office_name,cust.sales_office_name ,cust.sales_group_name
 		from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_company c on u.company_id = c.id
 			 left join sys_user_role ur on u.user_id = ur.user_id
 			 left join sys_role r on r.role_id = ur.role_id
 			 left join sys_user_ext suse on suse.user_id = u.user_id  and suse.del_flag = '0'
+			 left join data_master_customer cust on cust.CustomerCode = suse.customer_code
     </sql>
 
 	<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">

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

@@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectSysUserShopExtById" parameterType="String" resultMap="SysUserShopExtResult">
         <include refid="selectSysUserShopExtVo"/>
-        where user_id = #{userId} and delFlag='0'
+        where user_id = #{userId} and del_flag='0'
     </select>
 
     <insert id="insertSysUserShopExt" parameterType="SysUserShopExt">

+ 150 - 149
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -18,10 +18,7 @@ import io.swagger.annotations.ApiOperation;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 弹框日志Controller
@@ -45,6 +42,9 @@ public class WxAlertLogController  extends ApiBaseController {
     @Autowired
     private IAlertUpvoteLogService alertUpvoteLogService;
 
+    @Autowired
+    private ISysUserShopExtService sysUserShopExtService;
+
 
     @ApiOperation(value = "微信弹框",notes = "参数:{userId:1}")
     @ApiImplicitParams({
@@ -52,20 +52,39 @@ 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<>();
+        List<String> userTypeList = new ArrayList<>();
         SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
-        String salesLevel = sysUserExt.getSalesLevel();
-        if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
-            userType = "1";
-        }else{
-            userType = "0";
+        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("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);
         }
-        //是否有启动
-        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(userType,sysUserExt.getSalesLevel(),sysUserExt.getOrgCode());
+        //是否有启动弹窗
 
-        if (alertConfiguration1!=null){
+        if (alertConfiguration1 != null){
             //有启动
             alertConfiguration1.setIsClearCache(false);
             Date datez = new Date();
@@ -78,155 +97,69 @@ 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");
-                    //AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
-                  /*  if(log == null){
-                        alertConfiguration1.setIsClearCache(true);
-                    }*/
-                    if (alertLog!=null){
-                        if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
-                            Long count =alertLog.getAlertNum()+1;
-                            // 创建两个日期对象
-                            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                            Date date1 = dateFormat.parse(sdf.format(alertLog.getCreateTime()));
-                            Date date2 = dateFormat.parse(sdf.format(alertConfiguration1.getAlertEndTime()));
-                            // 设置时间部分为零点
-                            Calendar calendar = Calendar.getInstance();
-                            calendar.setTime(date1);
-                            calendar.set(Calendar.HOUR_OF_DAY, 0);
-                            calendar.set(Calendar.MINUTE, 0);
-                            calendar.set(Calendar.SECOND, 0);
-                            calendar.set(Calendar.MILLISECOND, 0);
-                            date1 = calendar.getTime();
-                            calendar.setTime(date2);
-                            calendar.set(Calendar.HOUR_OF_DAY, 0);
-                            calendar.set(Calendar.MINUTE, 0);
-                            calendar.set(Calendar.SECOND, 0);
-                            calendar.set(Calendar.MILLISECOND, 0);
-                            date2 = calendar.getTime();
-                            int clearT = date1.compareTo(date2);
-                            if(count == alertConfiguration1.getAlertNum() && clearT==0){
-                                alertConfiguration1.setIsClearCache(true);
-                                alertLog.setIsClearCache("1");
+                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("每日弹出次数已满");
                             }
-                            alertLog.setAlertNum(count);
-                            alertLogService.updateAlertLog(alertLog);
-                            return AjaxResult.success(alertConfiguration1);
                         }else {
-                            return AjaxResult.warning("每日弹出次数已满");
+                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"1");
+                            return AjaxResult.success(alertConfiguration1);
                         }
-                    }else {
-                        //加数据
-                        AlertLog alertLog1 = new AlertLog();
-                        alertLog1.setAlertId(alertConfiguration1.getAlertId());
-                        alertLog1.setUserId(userId);
-                        alertLog1.setUserType("1");
-                        alertLog1.setAlertNum(1L);
-                        // 创建两个日期对象
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date date1 = dateFormat.parse(now);
-                        Date date2 = dateFormat.parse(sdf.format(alertConfiguration1.getAlertEndTime()));
-                        // 设置时间部分为零点
-                        Calendar calendar = Calendar.getInstance();
-                        calendar.setTime(date1);
-                        calendar.set(Calendar.HOUR_OF_DAY, 0);
-                        calendar.set(Calendar.MINUTE, 0);
-                        calendar.set(Calendar.SECOND, 0);
-                        calendar.set(Calendar.MILLISECOND, 0);
-                        date1 = calendar.getTime();
-                        calendar.setTime(date2);
-                        calendar.set(Calendar.HOUR_OF_DAY, 0);
-                        calendar.set(Calendar.MINUTE, 0);
-                        calendar.set(Calendar.SECOND, 0);
-                        calendar.set(Calendar.MILLISECOND, 0);
-                        date2 = calendar.getTime();
-                        int clearT = date1.compareTo(date2);
-                        if(clearT==0 && alertConfiguration1.getAlertNum()==1){
-                            alertConfiguration1.setIsClearCache(true);
-                            alertLog1.setIsClearCache("1");
+                    }
+                    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);
                         }
-                        alertLogService.insertAlertLog(alertLog1);
-                        return AjaxResult.success(alertConfiguration1);
                     }
                 }
-                if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
-                    AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
-                  /*  AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
-                    if(log == null){
-                        alertConfiguration1.setIsClearCache(true);
-                    }*/
-                    if (alertLog!=null){
-                        if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
-                            Long count =alertLog.getAlertNum()+1;
-                            // 创建两个日期对象
-                            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                            Date date1 = dateFormat.parse(sdf.format(alertLog.getCreateTime()));
-                            Date date2 = dateFormat.parse(sdf.format(alertConfiguration1.getAlertEndTime()));
-                            // 设置时间部分为零点
-                            Calendar calendar = Calendar.getInstance();
-                            calendar.setTime(date1);
-                            calendar.set(Calendar.HOUR_OF_DAY, 0);
-                            calendar.set(Calendar.MINUTE, 0);
-                            calendar.set(Calendar.SECOND, 0);
-                            calendar.set(Calendar.MILLISECOND, 0);
-                            date1 = calendar.getTime();
-
-                            calendar.setTime(date2);
-                            calendar.set(Calendar.HOUR_OF_DAY, 0);
-                            calendar.set(Calendar.MINUTE, 0);
-                            calendar.set(Calendar.SECOND, 0);
-                            calendar.set(Calendar.MILLISECOND, 0);
-                            date2 = calendar.getTime();
-                            int clearT = date1.compareTo(date2);
-                            if(count == alertConfiguration1.getAlertNum() && clearT==0){
-                                alertConfiguration1.setIsClearCache(true);
-                                alertLog.setIsClearCache("1");
+                //判断该用户是否为金牌店或仿石漆
+                if (sysUserShopExt != null){
+                    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("每日弹出次数已满");
                             }
-                            alertLog.setAlertNum(count);
-                            alertLogService.updateAlertLog(alertLog);
-                            return AjaxResult.success(alertConfiguration1);
                         }else {
-                            return AjaxResult.warning("每日弹出次数已满");
+                            intAlertLog(alertConfiguration1,"1",now,sdf,userId,"3");
+                            return AjaxResult.success(alertConfiguration1);
                         }
-                    }else {
-                        //加数据
-                        AlertLog alertLog1 = new AlertLog();
-                        alertLog1.setAlertId(alertConfiguration1.getAlertId());
-                        alertLog1.setUserId(userId);
-                        alertLog1.setUserType("0");
-                        alertLog1.setAlertNum(1L);
-                        // 创建两个日期对象
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date date1 = dateFormat.parse(now);
-                        Date date2 = dateFormat.parse(sdf.format(alertConfiguration1.getAlertEndTime()));
-                        // 设置时间部分为零点
-                        Calendar calendar = Calendar.getInstance();
-                        calendar.setTime(date1);
-                        calendar.set(Calendar.HOUR_OF_DAY, 0);
-                        calendar.set(Calendar.MINUTE, 0);
-                        calendar.set(Calendar.SECOND, 0);
-                        calendar.set(Calendar.MILLISECOND, 0);
-                        date1 = calendar.getTime();
-                        calendar.setTime(date2);
-                        calendar.set(Calendar.HOUR_OF_DAY, 0);
-                        calendar.set(Calendar.MINUTE, 0);
-                        calendar.set(Calendar.SECOND, 0);
-                        calendar.set(Calendar.MILLISECOND, 0);
-                        date2 = calendar.getTime();
-                        int clearT = date1.compareTo(date2);
-                        if(clearT==0 && alertConfiguration1.getAlertNum()==1){
-                            alertConfiguration1.setIsClearCache(true);
-                            alertLog1.setIsClearCache("1");
+                    }
+                    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);
                         }
-                        alertLogService.insertAlertLog(alertLog1);
-                        return AjaxResult.success(alertConfiguration1);
                     }
                 }
                 return AjaxResult.warning("没有符合的弹框");
-
             } else {
                 //超时
                 return AjaxResult.warning("时间超时");
@@ -237,6 +170,74 @@ public class WxAlertLogController  extends ApiBaseController {
         }
     }
 
+    public void  updateAlertLog(AlertConfiguration alertConfiguration,AlertLog alertLog,SimpleDateFormat sdf,String isClearCache)throws ParseException {
+        Long count =alertLog.getAlertNum()+1;
+        // 创建两个日期对象
+        Date date1 = getTimeStampV1(null,sdf,alertLog.getCreateTime());
+        Date date2 = getTimeStampV2(sdf,alertConfiguration.getAlertEndTime());
+        int clearT = date1.compareTo(date2);
+        if(count == alertConfiguration.getAlertNum() && clearT==0){
+            alertConfiguration.setIsClearCache(true);
+            alertLog.setIsClearCache(isClearCache);
+        }
+        alertLog.setAlertNum(count);
+        alertLogService.updateAlertLog(alertLog);
+    }
+    //初始化AlertLog对象
+    public  void intAlertLog(AlertConfiguration alertConfiguration,String isClearCache,String now,SimpleDateFormat sdf,Long userId,String userType) throws ParseException {
+        //加数据
+        AlertLog alertLog1 = initAlertLog(userId,alertConfiguration.getAlertId());
+        alertLog1.setUserType(userType);
+        // 创建两个日期对象
+        Date date1 = getTimeStampV1(now,null,null);
+        Date date2 = getTimeStampV2(sdf,alertConfiguration.getAlertEndTime());
+        int clearT = date1.compareTo(date2);
+        if(clearT==0 && alertConfiguration.getAlertNum() == 1){
+            alertConfiguration.setIsClearCache(true);
+            alertLog1.setIsClearCache(isClearCache);
+        }
+        alertLogService.insertAlertLog(alertLog1);
+    }
+
+    //创建两个日期对象1
+    public static Date getTimeStampV1(String now,SimpleDateFormat sdf,Date lertEndTime) throws ParseException {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        // 设置时间部分为零点
+        Calendar calendar = Calendar.getInstance();
+        if (StringUtils.isEmpty(now)){
+            calendar.setTime(dateFormat.parse(sdf.format(lertEndTime)));
+        }else {
+            calendar.setTime(dateFormat.parse(now));
+        }
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        Date date = calendar.getTime();
+        return date;
+    }
+
+    //创建两个日期对象2
+    public static Date getTimeStampV2(SimpleDateFormat sdf,Date lertEndTime) throws ParseException {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(dateFormat.parse(sdf.format(lertEndTime)));
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        Date date = calendar.getTime();
+        return date;
+    }
+    //封装相同逻辑
+    public AlertLog initAlertLog(Long userId,Long alertId){
+        AlertLog alertLog1 = new AlertLog();
+        alertLog1.setAlertId(alertId);
+        alertLog1.setUserId(userId);
+        alertLog1.setAlertNum(1L);
+        return alertLog1;
+    }
+
 
     @ApiOperation(value = "点赞状态",notes = "参数:{userId:1,alertId:1,status:1}")
     @ApiImplicitParams({

+ 46 - 11
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

@@ -11,6 +11,7 @@ import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
 import com.dgtly.common.core.domain.Ztree;
 import com.dgtly.common.enums.BusinessType;
+import com.dgtly.common.utils.StringUtils;
 import com.dgtly.system.domain.*;
 import com.dgtly.system.service.*;
 import com.dgtly.wxportal.domain.HelpCenter;
@@ -21,11 +22,15 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 
 
+
+
+@Slf4j
 @Api(tags = "微信门户相关接口")
 @RestController
 @RequestMapping("/wxportal")
@@ -64,6 +69,9 @@ public class WxPortalController extends ApiBaseController {
     @Autowired
     private ISysUserExtService sysUserExtService;
 
+    @Autowired
+    private ISysUserShopExtService sysUserShopExtService;
+
 
     @Autowired
     JdbcTemplate jdbcTemplate;
@@ -111,26 +119,52 @@ public class WxPortalController extends ApiBaseController {
     })
     @PostMapping("/ridingLantern")
     public Object getRidingLantern(){
-        String userType="";
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));
+        List<String> userTypeList = new ArrayList<>();
+        Set<String> userTypeSet = new HashSet<>();
         SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
-        String salesLevel = sysUserExt.getSalesLevel();
-        if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
-            userType = "1";
-        }else{
-            userType = "0";
+        if (sysUserExt != null){
+            String salesLevel = sysUserExt.getSalesLevel();
+            if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
+                userTypeList.add("1");
+            }else{
+                userTypeList.add("0");
+            }
         }
+        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) {
-            String finalUserType = userType;
             lanternList.forEach(lantern->{
-                String[] split = lantern.getUserType().split(",");
-                boolean exists = Arrays.stream(split)
-                        .anyMatch(str -> str.equals(String.valueOf(finalUserType)));
-                if (exists){
+                //如果userType为空,则添加通知,
+                if (StringUtils.isEmpty(lantern.getUserType())){
+                    lantern.setUserType("");
                     lanternListhow.add(lantern);
+                }else {
+                    String[] split = lantern.getUserType().split(",");
+                    for (String userTypeStr : userTypeList){
+                        boolean exists = Arrays.stream(split)
+                                .anyMatch(str -> str.equals(userTypeStr));
+                        if (exists){
+                            if (!lanternListhow.contains(lantern)){
+                                lanternListhow.add(lantern);
+                            }
+                        }
+                    }
                 }
             });
             return AjaxResult.success().putKV("lanterns", lanternListhow);
@@ -138,6 +172,7 @@ public class WxPortalController extends ApiBaseController {
             return AjaxResult.error("暂无通知");
         }
     }
+
     /**
      * 新增保存磁铁日志
      */