Browse Source

Merge branch 'alert' into prd

njs 1 year ago
parent
commit
2c5020f2c8
15 changed files with 953 additions and 109 deletions
  1. 32 23
      suishenbang-admin/src/main/java/com/dgtly/web/controller/system/AlertConfigurationController.java
  2. 2 0
      suishenbang-admin/src/main/java/com/dgtly/web/controller/system/SysUserController.java
  3. 186 19
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html
  4. 32 21
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html
  5. 307 17
      suishenbang-admin/src/main/resources/templates/system/alertConfiguration/edit.html
  6. 75 3
      suishenbang-api/src/main/java/com/dgtly/api/controller/SysUserController.java
  7. 2 0
      suishenbang-common/src/main/java/com/dgtly/common/core/controller/BaseController.java
  8. 34 1
      suishenbang-system/src/main/java/com/dgtly/system/domain/AlertConfiguration.java
  9. 41 0
      suishenbang-system/src/main/java/com/dgtly/system/domain/OrderSalesParameter.java
  10. 11 2
      suishenbang-system/src/main/java/com/dgtly/system/mapper/AlertConfigurationMapper.java
  11. 5 2
      suishenbang-system/src/main/java/com/dgtly/system/service/IAlertConfigurationService.java
  12. 64 4
      suishenbang-system/src/main/java/com/dgtly/system/service/impl/AlertConfigurationServiceImpl.java
  13. 151 13
      suishenbang-system/src/main/resources/mapper/system/AlertConfigurationMapper.xml
  14. 2 2
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java
  15. 9 2
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

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

@@ -1,15 +1,15 @@
 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 org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import com.dgtly.common.annotation.Log;
 import com.dgtly.common.enums.BusinessType;
 import com.dgtly.system.domain.AlertConfiguration;
@@ -86,8 +86,8 @@ public class AlertConfigurationController extends BaseController
     @ResponseBody
     public AjaxResult addSave(AlertConfiguration alertConfiguration)
     {
-        int num = alertConfigurationService.selectAlertConfigurationListFilter();
-        if (alertConfiguration.getAlertStatus().equals("1")&&num==1){
+        int num = alertConfigurationService.selectAlertConfigurationListFilter(alertConfiguration);
+        if ( num==1){
             return error("弹幕通知只能有一个启动,请修改后重新添加");
         }
         return toAjax(alertConfigurationService.insertAlertConfiguration(alertConfiguration));
@@ -103,7 +103,6 @@ public class AlertConfigurationController extends BaseController
         mmap.put("alertConfiguration", alertConfiguration);
         return prefix + "/edit";
     }
-
     /**
      * 修改保存弹框配置
      */
@@ -113,23 +112,31 @@ public class AlertConfigurationController extends BaseController
     @ResponseBody
     public AjaxResult editSave(AlertConfiguration alertConfiguration)
     {
-        //没改之前的配置
-        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationById(alertConfiguration.getAlertId());
-        //判断之前有没有
-        int num = alertConfigurationService.selectAlertConfigurationListFilter();
-        if(num==1){
-            if (alertConfiguration1.getAlertStatus().equals("1")){
-                return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
-            }else {
-                if (alertConfiguration.getAlertStatus().equals("1")){
-                    return AjaxResult.error("列表中只能有一条日志配置启动");
-                }else {
-                    return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
-                }
-            }
-        }else {
+        if(("0").equals(alertConfiguration.getAlertStatus())){
             return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
         }
+        return error("请取消发布后再做修改");
+    }
+    /**
+     * 是否发布/取消发布弹框配置
+     */
+    @RequiresPermissions("system:configuration:edit")
+    @Log(title = "发布弹框", businessType = BusinessType.UPDATE)
+    @PostMapping("/release")
+    @ResponseBody
+    public AjaxResult release(AlertConfiguration alertConfiguration)
+    {
+       if(alertConfiguration.getAlertStatus().equals("0")){
+           return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
+       }else{
+           int num = alertConfigurationService.selectAlertConfigurationListFilter(alertConfiguration);
+           if(num==1){
+               return AjaxResult.error("已发布该组织弹框,请核查");
+           }else {
+               return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
+           }
+
+       }
     }
 
     /**
@@ -143,4 +150,6 @@ public class AlertConfigurationController extends BaseController
     {
         return toAjax(alertConfigurationService.deleteAlertConfigurationByIds(ids));
     }
+
+
 }

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

@@ -355,4 +355,6 @@ public class SysUserController extends BaseController
 
         return AjaxResult.success(sysUserExt);
     }
+
+
 }

+ 186 - 19
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html

@@ -11,7 +11,7 @@
         <div class="form-group">
             <label class="col-sm-3 control-label">弹框内容:</label>
             <div class="col-sm-8">
-                <textarea name="alertContent" class="form-control"></textarea>
+                <textarea id="alertContent" name="alertContent" class="form-control"></textarea>
             </div>
         </div>
         <div class="form-group">
@@ -19,7 +19,7 @@
             <div class="col-sm-8">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                    <input name="alertStartTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                    <input id="alertStartTime" name="alertStartTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                 </div>
             </div>
         </div>
@@ -28,14 +28,14 @@
             <div class="col-sm-8">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                    <input name="alertEndTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                    <input id="alertEndTime" name="alertEndTime" 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 name="alertNum" class="form-control" type="text">
+                <input id="alertNum" name="alertNum" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
@@ -47,6 +47,27 @@
             </div>
         </div>
         <div class="form-group">
+            <label class="col-sm-3 control-label">部门类型:</label>
+            <div class="col-sm-3">
+                <select title="请选择公司" id="deptType1" class="form-control m-b selectpicker">
+                </select>
+            </div>
+            <div class="col-sm-3">
+                <select title="请选择大区" id="deptType2" class="form-control m-b selectpicker">
+                </select>
+            </div>
+            <div class="col-sm-3">
+                <select title="请选择销售部" id="deptType3" class="form-control m-b selectpicker">
+                </select>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label"></label>
+            <div class="col-sm-3">
+                <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')}">
@@ -55,19 +76,7 @@
                     <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                 </div>
             </div>
-        </div>
-        <!--<div class="form-group">-->
-            <!--<label class="col-sm-3 control-label">是否启动</label>-->
-            <!--<div class="col-sm-8">-->
-                <!--<label class="radio-box">-->
-                    <!--<input type="radio" name="alertStatus" value="0">未启动-->
-                <!--</label>-->
-                <!--<label class="radio-box">-->
-                    <!--<input type="radio" name="alertStatus" value="1">启动-->
-                <!--</label>-->
-                <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
-            <!--</div>-->
-        <!--</div>-->
+        </div>-->
     </form>
 </div>
 <th:block th:include="include :: footer" />
@@ -75,13 +84,128 @@
 <th:block th:include="include :: bootstrap-select-js" />
 <script type="text/javascript">
     var prefix = ctx + "system/configuration"
+    //var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
+    var getCompanyListPrefix = "http://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
+
+    $(document).ready(function () {
+        var obj = {
+            parType: "diy_level",
+            parValue: ""
+        }
+        getCompanyList(obj);
+        console.log('ctx',ctx);
+    })
+
+    $("#deptType1").on('change',function () {
+        if ($(this).val() != -1){
+            var obj1 = {
+                parType: "company_level",
+                parValue: $(this).val()
+            }
+            $("#deptType2").empty().append("");
+            $("#deptType2").selectpicker('refresh');
+            $("#deptType3").empty().append("");
+            $("#deptType3").selectpicker('refresh');
+            getCompanyList(obj1);
+        }
+    })
+
+    $("#deptType2").on('change',function () {
+        if ($(this).val() != -1){
+            var obj2 = {
+                parType: "office_level",
+                parValue: $(this).val()
+            }
+            $("#deptType3").empty().append("");
+            $("#deptType3").selectpicker('refresh');
+            getCompanyList(obj2);
+        }
+    })
+
+    $("#clearSelect").on('click',function () {
+        var obj3 = {
+            parType: "diy_level",
+            parValue: ""
+        }
+        $("#deptType1").empty().append("");
+        $("#deptType1").selectpicker('refresh');
+        $("#deptType2").empty().append("");
+        $("#deptType2").selectpicker('refresh');
+        $("#deptType3").empty().append("");
+        $("#deptType3").selectpicker('refresh');
+        getCompanyList(obj3,"");
+    })
+
     $("#form-configuration-add").validate({
-        focusCleanup: true
+        focusCleanup: true,
+        rules:{
+            alertContent:{
+                required:true
+            },
+            alertStartTime:{
+                required:true
+            },
+            alertEndTime:{
+                required:true
+            },
+            alertNum: {
+                required:true
+            },
+            userType: {
+                required:true
+            }
+        },
     });
 
     function submitHandler() {
         if ($.validate.form()) {
-            $.operate.save(prefix + "/add", $('#form-configuration-add').serialize());
+            var contentVal = $('#alertContent').val();
+            var startTime = $('#alertStartTime').val();
+            var endTime = $('#alertEndTime').val();
+            var alertNum = $('#alertNum').val();
+            var userType = $('#userType').val().join();
+            var objSubmit = {
+                alertContent:contentVal,
+                alertStartTime:startTime,
+                alertEndTime:endTime,
+                alertNum:alertNum,
+                userType:userType,
+                alertStatus:'0'
+            }
+            if ($('#deptType3').val() != "") {
+                objSubmit.salesLevel = 'suboffice_level';
+                objSubmit.orgCode = $('#deptType3').val();
+                objSubmit.orgName = $('#deptType3').find("option:selected")[0].label
+            }
+            if ($('#deptType2').val() != "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'office_level';
+                objSubmit.orgCode = $('#deptType2').val();
+                objSubmit.orgName = $('#deptType2').find("option:selected")[0].label
+            }
+            if ($('#deptType1').val() != "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'company_level';
+                objSubmit.orgCode = $('#deptType1').val();
+                objSubmit.orgName = $('#deptType1').find("option:selected")[0].label
+            }
+            if ($('#deptType1').val() == "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                objSubmit.salesLevel = 'diy_level';
+            }
+            console.log('objSubmit', objSubmit);
+            var configSubmit = {
+                url: prefix + "/add",
+                type: "post",
+                dataType: "json",
+                data: objSubmit,
+                beforeSend: function () {
+                    $.modal.loading("正在处理中,请稍后...");
+                },
+                success:function (result) {
+                    $.modal.closeLoading();
+                    $.operate.successCallback(result);
+                }
+            }
+            $.ajax(configSubmit)
+            // $.operate.save(prefix + "/add", $('#form-configuration-add').serialize());
         }
     }
 
@@ -94,6 +218,49 @@
         format: "yyyy-mm-dd hh:ii",
         autoclose: true
     });
+
+    /* 获取公司列表 */
+    function getCompanyList(obj) {
+        var config = {
+            url: getCompanyListPrefix,
+            type: "post",
+            dataType: "json",
+            data: obj,
+            beforeSend: function () {
+                $.modal.loading("正在处理中,请稍后...");
+            },
+            success: function(result) {
+                $.modal.closeLoading();
+                var companyList = result.dataList;
+                if (companyList && companyList.length != 0){
+                    var options = '';
+                    if (obj.parType == 'diy_level'){
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.company_code + "'>" + item.company_name + "</option>"
+                        })
+                        $("#deptType1").append(options);
+                        $("#deptType1").selectpicker('refresh');
+                        $("#deptType1").selectpicker('render');
+                    } else if (obj.parType == 'company_level') {
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.office_code + "'>" + item.office_name + "</option>"
+                        })
+                        $("#deptType2").append(options);
+                        $("#deptType2").selectpicker('refresh');
+                        $("#deptType2").selectpicker('render');
+                    }else {
+                        companyList.forEach(item=>{
+                            options += "<option value='" + item.suboffice_code + "'>" + item.suboffice_name + "</option>"
+                        })
+                        $("#deptType3").append(options);
+                        $("#deptType3").selectpicker('refresh');
+                        $("#deptType3").selectpicker('render');
+                    }
+                }
+            }
+        };
+        $.ajax(config)
+    }
 </script>
 </body>
 </html>

+ 32 - 21
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html

@@ -51,15 +51,15 @@
                 <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>
+                <!--<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>
@@ -89,23 +89,27 @@
                 {
                     field : 'alertContent', 
                     title : '弹框内容',
-                    width : '300px',
+                    width : '200px',
                     formatter: function(value, row, index) {
                         return $.table.tooltip(value);
                     }
                 },
                 {
                     field : 'alertStartTime', 
-                    title : '弹框开始时间'
+                    title : '开始时间'
                 },
                 {
                     field : 'alertEndTime', 
-                    title : '弹框结束时间'
+                    title : '结束时间'
                 },
                 {
                     field : 'alertNum', 
-                    title : '弹框每日可弹次数'
+                    title : '次数'
                 },
+                    {
+                        field : 'orgName',
+                        title : '通知部门'
+                    },
                 {
                     field : 'userType',
                     title : '用户类型',
@@ -134,8 +138,13 @@
                     align: 'center',
                     formatter: function(value, row, index) {
                         var actions = [];
-                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
-                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        if (row.alertStatus == 1) {
+                            actions.push('<a class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>编辑</a> ');
+                            actions.push('<a class="btn btn-default btn-xs ' + removeFlag + '" href="javascript:void(0)"><i class="fa fa-remove"></i>删除</a>');
+                        } else {
+                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        }
                         return actions.join('');
                     }
                 }]
@@ -146,23 +155,25 @@
         /* 启动状态显示 */
         function statusTools(row) {
             if (row.alertStatus == 0) {
-                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.alertId + '\')"></i> ';
+                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.alertId + '&' + row.userType + '&' + row.salesLevel + '&' + row.orgCode + '\')"></i> ';
             } else {
-                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.alertId + '\')"></i> ';
+                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.alertId + '&' + row.userType + '&' + row.salesLevel + '&' + row.orgCode + '\')"></i> ';
             }
         }
 
         /* 停用 */
-        function disable(roleId) {
+        function disable(row) {
+            var arrayTingyong = row.split('&');
             $.modal.confirm("确认关闭该通知吗?", function() {
-                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 0 });
+                $.operate.post(prefix + "/release", { "alertId": arrayTingyong[0], "alertStatus": 0, "userType": arrayTingyong[1], "salesLevel": arrayTingyong[2], "orgCode": arrayTingyong[3] });
             })
         }
 
         /* 启用 */
-        function enable(roleId) {
+        function enable(row) {
+            var arrayQiyong = row.split('&');
             $.modal.confirm("确认启用该通知吗?", function() {
-                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 1 });
+                $.operate.post(prefix + "/release", { "alertId": arrayQiyong[0], "alertStatus": 1, "userType": arrayQiyong[1], "salesLevel": arrayQiyong[2], "orgCode": arrayQiyong[3] });
             })
         }
     </script>

+ 307 - 17
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/edit.html

@@ -12,7 +12,7 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">弹框内容:</label>
                 <div class="col-sm-8">
-                    <textarea name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
+                    <textarea id="alertContent" name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
                 </div>
             </div>
 
@@ -21,7 +21,7 @@
                 <div class="col-sm-8">
                     <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                        <input name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
+                        <input id="alertStartTime" name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
                     </div>
                 </div>
             </div>
@@ -30,7 +30,7 @@
                 <div class="col-sm-8">
                     <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                        <input name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
+                        <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>
@@ -49,6 +49,34 @@
                 </div>
             </div>
             <div class="form-group">
+                <input name="alertId" th:field="*{alertId}" style="display: none;">
+                <input name="salesLevel" th:field="*{salesLevel}" style="display: none;">
+                <input name="orgCode" th:field="*{orgCode}" style="display: none;">
+                <input name="orgName" th:field="*{orgName}" style="display: none;">
+                <input name="userTypeStr" th:field="*{userType}" style="display: none;">
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">部门类型:</label>
+                <div class="col-sm-3">
+                    <select title="请选择公司" id="deptType1" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+                <div class="col-sm-3">
+                    <select title="请选择大区" id="deptType2" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+                <div class="col-sm-3">
+                    <select title="请选择销售部" id="deptType3" class="form-control m-b selectpicker">
+                    </select>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label"></label>
+                <div class="col-sm-3">
+                    <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')}">
@@ -57,18 +85,7 @@
                         <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                     </div>
                 </div>
-            </div>
-            <!--<div class="form-group">    -->
-                <!--<label class="col-sm-3 control-label">是否启动:</label>-->
-                <!--<div class="col-sm-8">-->
-                    <!--<label class="radio-box">-->
-                        <!--<input type="radio" name="alertStatus" value="0">未启动-->
-                    <!--</label>-->
-                    <!--<label class="radio-box">-->
-                        <!--<input type="radio" name="alertStatus" value="1">启动-->
-                    <!--</label>-->
-                <!--</div>-->
-            <!--</div>-->
+            </div>-->
         </form>
     </div>
     <th:block th:include="include :: footer" />
@@ -76,14 +93,192 @@
     <th:block th:include="include :: bootstrap-select-js" />
     <script type="text/javascript">
         var prefix = ctx + "system/configuration";
+        // var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
+        var getCompanyListPrefix = "http://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
+
+        $(document).ready(function () {
+            var formArray = $('#form-configuration-edit').serializeArray();
+            var formData = {};
+            $(formArray ).each(function(index, obj){
+                formData[obj.name] = obj.value;
+            });
+            $("#userType").selectpicker('val',formData.userType.split(','));
+            if (formData.salesLevel == 'company_level'){
+                var objhx1 = {
+                    parType: 'company_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                        var objList1 = {
+                            parType: 'company_level',
+                            parValue: result.levelInfo.company_code
+                        }
+                        getCompanyList(objList1,"");
+                    }
+                }
+                $.ajax(confighuixian1)
+            }else if (formData.salesLevel == 'office_level') {
+                var objhx1 = {
+                    parType: 'office_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                        var objList1 = {
+                            parType: 'company_level',
+                            parValue: result.levelInfo.company_code
+                        }
+                        getCompanyList(objList1,result.levelInfo.office_code);
+                        var objList2 = {
+                            parType: 'office_level',
+                            parValue: result.levelInfo.office_code
+                        }
+                        getCompanyList(objList2,"");
+                    }
+                }
+                $.ajax(confighuixian1)
+            }else if (formData.salesLevel == 'suboffice_level') {
+                var objhx1 = {
+                    parType: 'suboffice_level',
+                    parValue: formData.orgCode
+                }
+                var confighuixian1 = {
+                    url: getCompanyListPrefix,
+                    type: "post",
+                    dataType: "json",
+                    data: objhx1,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success: function(result) {
+                        $.modal.closeLoading();
+                        var objList = {
+                            parType: 'diy_level',
+                            parValue: ''
+                        }
+                        getCompanyList(objList,result.levelInfo.company_code);
+                        var objList1 = {
+                            parType: 'company_level',
+                            parValue: result.levelInfo.company_code
+                        }
+                        getCompanyList(objList1,result.levelInfo.office_code);
+                        var objList2 = {
+                            parType: 'office_level',
+                            parValue: result.levelInfo.office_code
+                        }
+                        getCompanyList(objList2,result.levelInfo.suboffice_code);
+                    }
+                }
+                $.ajax(confighuixian1)
+            }else {
+                var objList = {
+                    parType: "diy_level",
+                    parValue: ""
+                }
+                getCompanyList(objList,"");
+            }
+        })
+
         $("#form-configuration-edit").validate({
-            focusCleanup: true
+            focusCleanup: true,
+            rules:{
+                alertContent:{
+                    required:true
+                },
+                alertStartTime:{
+                    required:true
+                },
+                alertEndTime:{
+                    required:true
+                },
+                alertNum: {
+                    required:true
+                },
+                userType: {
+                    required:true
+                }
+            }
         });
 
         function submitHandler() {
             if ($.validate.form()) {
-                $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
+                var alertId = $('#alertId').val();
+                var contentVal = $('#alertContent').val();
+                var startTime = $('#alertStartTime').val();
+                var endTime = $('#alertEndTime').val();
+                var alertNum = $('#alertNum').val();
+                var userType = $('#userType').val().join();
+                var objSubmit = {
+                    alertId:alertId,
+                    alertContent:contentVal,
+                    alertStartTime:startTime,
+                    alertEndTime:endTime,
+                    alertNum:alertNum,
+                    userType:userType,
+                    alertStatus:'0'
+                }
+                if ($('#deptType3').val() != "") {
+                    objSubmit.salesLevel = 'suboffice_level';
+                    objSubmit.orgCode = $('#deptType3').val();
+                    objSubmit.orgName = $('#deptType3').find("option:selected")[0].label
+                }
+                if ($('#deptType2').val() != "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'office_level';
+                    objSubmit.orgCode = $('#deptType2').val();
+                    objSubmit.orgName = $('#deptType2').find("option:selected")[0].label
+                }
+                if ($('#deptType1').val() != "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'company_level';
+                    objSubmit.orgCode = $('#deptType1').val();
+                    objSubmit.orgName = $('#deptType1').find("option:selected")[0].label
+                }
+                if ($('#deptType1').val() == "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
+                    objSubmit.salesLevel = 'diy_level';
+                }
+                console.log('objSubmit', objSubmit);
+                var configSubmit = {
+                    url: prefix + "/edit",
+                    type: "post",
+                    dataType: "json",
+                    data: objSubmit,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success:function (result) {
+                        $.modal.closeLoading();
+                        $.operate.successCallback(result);
+                    }
+                }
+                $.ajax(configSubmit)
             }
+            // $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
         }
 
         $("input[name='alertStartTime']").datetimepicker({
@@ -95,6 +290,101 @@
             format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
+
+        $("#deptType1").on('change',function () {
+            if ($(this).val() != -1){
+                var obj1 = {
+                    parType: "company_level",
+                    parValue: $(this).val()
+                }
+                $("#deptType2").empty().append("");
+                $("#deptType2").selectpicker('refresh');
+                $("#deptType3").empty().append("");
+                $("#deptType3").selectpicker('refresh');
+                getCompanyList(obj1,"");
+            }
+        })
+
+        $("#deptType2").on('change',function () {
+            if ($(this).val() != -1){
+                var obj2 = {
+                    parType: "office_level",
+                    parValue: $(this).val()
+                }
+                $("#deptType3").empty().append("");
+                $("#deptType3").selectpicker('refresh');
+                getCompanyList(obj2,"");
+            }
+        })
+
+        $("#clearSelect").on('click',function () {
+            var obj3 = {
+                parType: "diy_level",
+                parValue: ""
+            }
+            $("#deptType1").empty().append("");
+            $("#deptType1").selectpicker('refresh');
+            $("#deptType2").empty().append("");
+            $("#deptType2").selectpicker('refresh');
+            $("#deptType3").empty().append("");
+            $("#deptType3").selectpicker('refresh');
+            getCompanyList(obj3,"");
+        })
+
+        /* 获取公司列表 */
+        function getCompanyList(obj,chooseId) {
+            var config = {
+                url: getCompanyListPrefix,
+                type: "post",
+                dataType: "json",
+                data: obj,
+                beforeSend: function () {
+                    $.modal.loading("正在处理中,请稍后...");
+                },
+                success: function(result) {
+                    $.modal.closeLoading();
+                    var companyList = result.dataList;
+                    if (companyList && companyList.length != 0){
+                        var options = '';
+                        if (obj.parType == 'diy_level'){
+                            companyList.forEach(item=>{
+                                if(item.company_code == chooseId){
+                                    options += "<option value='" + item.company_code + "' selected='selected'>" + item.company_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.company_code + "'>" + item.company_name + "</option>"
+                                }
+                            })
+                            $("#deptType1").append(options);
+                            $("#deptType1").selectpicker('refresh');
+                            $("#deptType1").selectpicker('render');
+                        } else if (obj.parType == 'company_level') {
+                            companyList.forEach(item=>{
+                                if(item.office_code == chooseId){
+                                    options += "<option value='" + item.office_code + "' selected='selected'>" + item.office_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.office_code + "'>" + item.office_name + "</option>"
+                                }
+                            })
+                            $("#deptType2").append(options);
+                            $("#deptType2").selectpicker('refresh');
+                            $("#deptType2").selectpicker('render');
+                        }else {
+                            companyList.forEach(item=>{
+                                if(item.suboffice_code == chooseId){
+                                    options += "<option value='" + item.suboffice_code + "' selected='selected'>" + item.suboffice_name + "</option>"
+                                }else{
+                                    options += "<option value='" + item.suboffice_code + "'>" + item.suboffice_name + "</option>"
+                                }
+                            })
+                            $("#deptType3").append(options);
+                            $("#deptType3").selectpicker('refresh');
+                            $("#deptType3").selectpicker('render');
+                        }
+                    }
+                }
+            };
+            $.ajax(config)
+        }
     </script>
 </body>
 </html>

+ 75 - 3
suishenbang-api/src/main/java/com/dgtly/api/controller/SysUserController.java

@@ -6,7 +6,9 @@ import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
 import com.dgtly.common.core.domain.ResultType;
 import com.dgtly.common.utils.security.EncryptPassWordClass;
+import com.dgtly.system.domain.OrderSalesParameter;
 import com.dgtly.system.domain.SysUser;
+import com.dgtly.system.service.IAlertConfigurationService;
 import com.dgtly.system.service.ISysUserExtService;
 import com.dgtly.wxportal.domain.WxQyUser;
 import com.dgtly.system.service.ISysUserService;
@@ -16,11 +18,12 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 @Api(tags = "系统用户相关API")
@@ -34,6 +37,8 @@ public class SysUserController extends ApiBaseController {
     private ISysUserService sysUserService;
     @Autowired
     private ISysUserExtService userExtService;
+    @Autowired
+    private IAlertConfigurationService alertConfigurationService;
 
 
     @ApiOperation(value = "绑定微信用户和系统用户",
@@ -165,4 +170,71 @@ public class SysUserController extends ApiBaseController {
         return list.size()>0?AjaxResult.success().putKV("list",list):AjaxResult.error(ResultType.NUll);
     }
 
+//    @PostMapping("/searchOrg")
+//    @ApiOperation(value = "查询组织架构",notes = "参数:{'parType':'1','parValue':'xxx'}" )
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "params" , paramType = "body")
+//    })
+//    public Map searchProductParamByCustomerCode() {
+//        ParameterObject obj =  getParameterObject();
+//        OrderSalesParameter salesManager =new OrderSalesParameter();
+//        String payType = obj.getString("parType");
+//        String payValue = obj.getString("parValue");
+//        if("".equals(payType) ||payType ==null){
+//            salesManager.setParType("diy_level");
+//        }else{
+//            salesManager.setParType(payType);
+//            salesManager.setParValue(payValue);
+//        }
+//        Map map = new HashMap();
+//        List<Map<String,Object>> dataList = alertConfigurationService.searchProductParamByCustomerCode(
+//                salesManager.getParType(),salesManager.getParValue());
+//        if(dataList != null && dataList.size() > 0){
+//            map.put("levelInfo",dataList.get(0));
+//            if ("suboffice_level".equals(salesManager.getParType()) ||
+//                    "customer_level".equals(salesManager.getParType()) ||
+//                    "emp_level".equals(salesManager.getParType()) ||
+//                    "saledept_level".equals(salesManager.getParType())
+//            ){
+//                map.put("dataList",new ArrayList());
+//            }else{
+//                map.put("dataList",dataList);
+//            }
+//            return map;
+//        } else {
+//            Map mapnull = new HashMap();
+//            map.put("levelInfo",mapnull);
+//            map.put("dataList",dataList);
+//            return map;
+//        }
+//    }
+
+    @PostMapping("/searchOrg")
+    public Map searchProductParamByCustomerCode(OrderSalesParameter salesManager) {
+        if("".equals(salesManager.getParType()) || salesManager.getParType() ==null){
+            salesManager.setParType("div_level");
+        }
+        Map map = new HashMap();
+        List<Map<String,Object>> dataList = alertConfigurationService.searchProductParamByCustomerCode(
+                salesManager.getParType(),salesManager.getParValue());
+        if(dataList != null && dataList.size() > 0){
+            map.put("levelInfo",dataList.get(0));
+            if ("suboffice_level".equals(salesManager.getParType()) ||
+                    "customer_level".equals(salesManager.getParType()) ||
+                    "emp_level".equals(salesManager.getParType()) ||
+                    "saledept_level".equals(salesManager.getParType())
+            ){
+                map.put("dataList",new ArrayList());
+            }else{
+                map.put("dataList",dataList);
+            }
+            return map;
+        } else {
+            Map mapnull = new HashMap();
+            map.put("levelInfo",mapnull);
+            map.put("dataList",dataList);
+            return map;
+        }
+    }
+
 }

+ 2 - 0
suishenbang-common/src/main/java/com/dgtly/common/core/controller/BaseController.java

@@ -116,6 +116,8 @@ public class BaseController
 
 
 
+
+
     /**
      * 响应返回结果
      * 

+ 34 - 1
suishenbang-system/src/main/java/com/dgtly/system/domain/AlertConfiguration.java

@@ -47,6 +47,15 @@ public class AlertConfiguration extends BaseEntity
     @Excel(name = "是否启动默认0未启动,1启动")
     private String alertStatus;
 
+    /** 组织级别 */
+    private String salesLevel;
+
+    /** 组织机构 */
+    private String orgCode;
+
+    /** 组织机构名称 */
+    private String orgName;
+
     public void setAlertId(Long alertId) 
     {
         this.alertId = alertId;
@@ -70,7 +79,15 @@ public class AlertConfiguration extends BaseEntity
         this.alertContent = alertContent;
     }
 
-    public String getAlertContent() 
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getAlertContent()
     {
         return alertContent;
     }
@@ -119,6 +136,22 @@ public class AlertConfiguration extends BaseEntity
         this.alertStatus = alertStatus;
     }
 
+    public String getSalesLevel() {
+        return salesLevel;
+    }
+
+    public void setSalesLevel(String salesLevel) {
+        this.salesLevel = salesLevel;
+    }
+
+    public String getOrgCode() {
+        return orgCode;
+    }
+
+    public void setOrgCode(String orgCode) {
+        this.orgCode = orgCode;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 41 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/OrderSalesParameter.java

@@ -0,0 +1,41 @@
+package com.dgtly.system.domain;
+
+import lombok.Data;
+
+/**
+ * @ClassName OrderSalesParameter
+ * @Description: 订单销售目标与达成 请求参数
+ * @Author nsy
+ * @Date 2020/8/10
+ * @Version V1.0
+ **/
+
+public class OrderSalesParameter {
+
+    private String parType;
+
+
+    /**
+     * type 相应类型对应的 code值
+     * 部门级别传部门编号
+     * 销售员级别传人员编号
+     * 经销商级别传经销商编号
+     */
+    private String parValue;
+
+    public String getParType() {
+        return parType;
+    }
+
+    public void setParType(String parType) {
+        this.parType = parType;
+    }
+
+    public String getParValue() {
+        return parValue;
+    }
+
+    public void setParValue(String parValue) {
+        this.parValue = parValue;
+    }
+}

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

@@ -1,7 +1,10 @@
 package com.dgtly.system.mapper;
 
 import com.dgtly.system.domain.AlertConfiguration;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
+import java.util.Map;
 
 /**
  * 弹框配置Mapper接口
@@ -19,7 +22,7 @@ public interface AlertConfigurationMapper
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus);
+    public List<AlertConfiguration> selectAlertConfigurationByAlertStatus(@Param("userType") String userType);
 
 
     /**
@@ -30,7 +33,7 @@ public interface AlertConfigurationMapper
      */
     public List<AlertConfiguration> selectAlertConfigurationList(AlertConfiguration alertConfiguration);
 
-    public int selectAlertConfigurationListFilter();
+    public List<AlertConfiguration> selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration);
 
     /**
      * 新增弹框配置
@@ -63,4 +66,10 @@ public interface AlertConfigurationMapper
      * @return 结果
      */
     public int deleteAlertConfigurationByIds(String[] alertIds);
+
+    public List<String> selectOrgCode(@Param("parType") String parType,@Param("parValue") String parValue);
+
+    public List<String> selectOrgCodeByInterface(@Param("parType") String parType,@Param("parValue") String parValue);
+
+    List<Map<String, Object>> searchProductParamByCustomerCode(@Param("salesLevel")String salesLevel, @Param("orgCode")String orgCode, @Param("groupByStr") String groupByStr);
 }

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

@@ -2,6 +2,7 @@ package com.dgtly.system.service;
 
 import com.dgtly.system.domain.AlertConfiguration;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 弹框配置Service接口
@@ -19,7 +20,7 @@ public interface IAlertConfigurationService
      */
     public AlertConfiguration selectAlertConfigurationById(Long alertId);
 
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String userType,String salesLevel,String orgCode);
 
     /**
      * 查询弹框配置列表
@@ -30,7 +31,7 @@ public interface IAlertConfigurationService
     public List<AlertConfiguration> selectAlertConfigurationList(AlertConfiguration alertConfiguration);
 
 //
-    public int selectAlertConfigurationListFilter();
+    public int selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration);
 
     /**
      * 新增弹框配置
@@ -63,4 +64,6 @@ public interface IAlertConfigurationService
      * @return 结果
      */
     public int deleteAlertConfigurationById(Long alertId);
+
+    List<Map<String, Object>>  searchProductParamByCustomerCode(String salesLevel, String orgCode);
 }

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

@@ -1,6 +1,10 @@
 package com.dgtly.system.service.impl;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+
 import com.dgtly.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,8 +38,28 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public AlertConfiguration selectAlertConfigurationByAlertStatus(int alertStatus) {
-        return alertConfigurationMapper.selectAlertConfigurationByAlertStatus(alertStatus);
+    public AlertConfiguration selectAlertConfigurationByAlertStatus(String userType,String salesLevel,String orgCode) {
+        List<AlertConfiguration> alertConfigurationList = alertConfigurationMapper.selectAlertConfigurationByAlertStatus(userType);
+        if(alertConfigurationList !=null && alertConfigurationList.size()> 0 ){
+            Iterator<AlertConfiguration> it = alertConfigurationList.iterator();
+            while (it.hasNext()) {
+                AlertConfiguration alert = it.next();
+                //diy
+                if(orgCode ==null || ("").equals(orgCode)){
+                    if( alert.getOrgCode() ==null){
+                        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;
     }
 
     /**
@@ -51,8 +75,29 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     }
 
     @Override
-    public int selectAlertConfigurationListFilter() {
-        return alertConfigurationMapper.selectAlertConfigurationListFilter();
+    public int selectAlertConfigurationListFilter(AlertConfiguration alertConfiguration) {
+        List<AlertConfiguration> alertConfigurationList= alertConfigurationMapper.selectAlertConfigurationListFilter(alertConfiguration);
+        if(alertConfigurationList !=null && alertConfigurationList.size()>0){
+            Iterator<AlertConfiguration> it = alertConfigurationList.iterator();
+            List<String> orgCodes =new ArrayList<>();
+            if(alertConfiguration.getOrgCode() !=null &&  !("null").equals(alertConfiguration.getOrgCode() )  ) {
+                 orgCodes = alertConfigurationMapper.selectOrgCode(alertConfiguration.getSalesLevel(), alertConfiguration.getOrgCode());
+            }else{
+                //diy
+                return 1;
+            }
+            while (it.hasNext()) {
+                AlertConfiguration alert = it.next();
+                    if(orgCodes !=null && orgCodes.size()>0){
+                        if(orgCodes.contains(alert.getOrgCode())){
+                            return 1;
+                        }
+                }
+            }
+        }else{
+                    return 0;
+        }
+        return 0;
     }
 
     /**
@@ -102,4 +147,19 @@ public class AlertConfigurationServiceImpl implements IAlertConfigurationService
     {
         return alertConfigurationMapper.deleteAlertConfigurationById(alertId);
     }
+
+    @Override
+    public List<Map<String, Object>> searchProductParamByCustomerCode(String salesLevel, String orgCode) {
+        String groupByStr =null;
+        if(salesLevel !=null && ("diy_level").equals(salesLevel)){
+            groupByStr = "company_code";
+        }else if(salesLevel !=null && ("division_level").equals(salesLevel)){
+            groupByStr = "company_code";
+        }else if(salesLevel !=null && ("company_level").equals(salesLevel)){
+            groupByStr = "office_code";
+        }else if(salesLevel !=null && ("office_level").equals(salesLevel)){
+            groupByStr = "suboffice_code";
+        }
+        return alertConfigurationMapper.searchProductParamByCustomerCode(salesLevel, orgCode,groupByStr);
+    }
 }

+ 151 - 13
suishenbang-system/src/main/resources/mapper/system/AlertConfigurationMapper.xml

@@ -17,10 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="alertNum"    column="alert_num"    />
         <result property="userType"    column="user_type"    />
         <result property="alertStatus"    column="alert_status"    />
+        <result property="salesLevel"    column="sales_level"    />
+        <result property="orgCode"    column="org_code"    />
+        <result property="orgName"    column="org_name"    />
     </resultMap>
 
     <sql id="selectAlertConfigurationVo">
-        select alert_id, create_by, create_time, update_by, update_time, is_delete, alert_content, alert_start_time, alert_end_time, alert_num, user_type, alert_status from alert_configuration
+        select alert_id, create_by, create_time, update_by, update_time, is_delete, alert_content, alert_start_time, alert_end_time, alert_num, user_type, alert_status,sales_level,org_code,org_name from alert_configuration
     </sql>
 
     <select id="selectAlertConfigurationList" parameterType="AlertConfiguration" resultMap="AlertConfigurationResult">
@@ -36,13 +39,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
-    <select id="selectAlertConfigurationListFilter" resultType="java.lang.Integer">
-        SELECT
-            count(*)
-        FROM
-            alert_configuration
-        WHERE alert_configuration.alert_status = 1
-
+    <select id="selectAlertConfigurationListFilter" parameterType="Long" resultMap="AlertConfigurationResult">
+        <include refid="selectAlertConfigurationVo"/>
+        WHERE alert_status = 1
+        <if test="userType !=null and userType !='' and orgCode !='null' ">
+            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 like concat('%', #{userType}, '%')
+        </if>
     </select>
 
     <insert id="insertAlertConfiguration" parameterType="AlertConfiguration" useGeneratedKeys="true" keyProperty="alertId">
@@ -71,6 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="alertNum != null ">alert_num,</if>
             <if test="userType != null  and userType != ''">user_type,</if>
             <if test="alertStatus != null  and alertStatus != ''">alert_status,</if>
+            <if test="salesLevel != null  and salesLevel != ''">sales_level,</if>
+            <if test="orgCode != null  and orgCode != ''">org_code,</if>
+            <if test="orgName != null  and orgName != ''">org_name,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="createBy != null  and createBy != ''">#{createBy},</if>
@@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="alertNum != null ">#{alertNum},</if>
             <if test="userType != null  and userType != ''">#{userType},</if>
             <if test="alertStatus != null  and alertStatus != ''">#{alertStatus},</if>
+            <if test="salesLevel != null  and salesLevel != ''">#{salesLevel},</if>
+            <if test="orgCode != null  and orgCode != ''">#{orgCode},</if>
+            <if test="orgName != null  and orgName != ''">#{orgName},</if>
          </trim>
     </insert>
 
@@ -101,6 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="alertNum != null ">alert_num = #{alertNum},</if>
             <if test="userType != null  and userType != ''">user_type = #{userType},</if>
             <if test="alertStatus != null  and alertStatus != ''">alert_status = #{alertStatus},</if>
+            <if test="salesLevel != null  and salesLevel != ''">sales_level = #{salesLevel},</if>
+            <if test="orgCode != null  and orgCode != ''">org_code = #{orgCode},</if>
+            <if test="orgName != null  and orgName != ''">org_name = #{orgName},</if>
         </trim>
         where alert_id = #{alertId}
     </update>
@@ -115,5 +127,131 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{alertId}
         </foreach>
     </delete>
-    
+
+    <sql id="orgListWhere">
+        and cal_month = date_format( CURDATE(), '%Y%m' )
+        <if test="parType != null and parType == 'company_level'">
+            and company_code = #{parValue}
+        </if>
+        <if test="parType != null and parType == 'saledept_level'  ">
+            and saledept_code = #{parValue}
+        </if>
+        <if test="parType != null and parType == 'office_level'">
+            and office_code = #{parValue}
+        </if>
+        <if test="parType != null and parType == 'suboffice_level'">
+            and suboffice_code = #{parValue}
+        </if>
+    </sql>
+    <select id="selectOrgCodeByInterface" resultType="java.lang.String">
+        <if test="parType != null and parType == 'company_level' or parType == 'diy_level' ">
+        SELECT
+        company_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        company_code UNION
+        </if>
+        <if test="parType != null and parType == 'company_level' or parType == 'saledept_level' or parType == 'office_level' or parType == 'diy_level' ">
+        SELECT
+        saledept_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        saledept_code UNION
+        </if>
+        <if test="parType != null and parType == 'company_level' or parType == 'suboffice_level' or parType == 'saledept_level' or parType == 'office_level' or  parType == 'diy_level'  ">
+        SELECT
+        suboffice_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        suboffice_code UNION
+        </if>
+        SELECT
+        customer_id AS orgCode
+        FROM
+        order_sales_sum_tuc_customer
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        customer_id
+    </select>
+    <select id="selectOrgCode" resultType="java.lang.String">
+
+        SELECT
+        company_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        company_code UNION
+        SELECT
+        saledept_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        saledept_code UNION
+        SELECT
+        suboffice_code AS orgCode
+        FROM
+        order_sales_sum_tuc_group
+        WHERE
+        BUSINESS_UNIT = '零售'
+        <include refid="orgListWhere"/>
+        GROUP BY
+        suboffice_code
+    </select>
+
+    <select id="searchProductParamByCustomerCode" resultType="java.util.Map">
+        SELECT
+        g.company_code,
+        g.company_name,
+        g.office_code,
+        g.office_name,
+        g.suboffice_code,
+        g.suboffice_name
+        FROM
+        order_sales_sum_tuc_group g
+        left join tuc_company_sort sort on g.company_code=sort.company_code
+        WHERE
+        1 = 1 AND g.BUSINESS_UNIT = '零售'
+        <if test="salesLevel != null and salesLevel == 'company_level'  ">
+            and g.office_code  is not null
+            and g.office_code  !=''
+            and g.company_code = #{orgCode}
+
+        </if>
+        <if test="salesLevel != null and salesLevel == 'office_level'">
+            and g.suboffice_code  is not null
+            and g.suboffice_code  !=''
+            and g.office_code = #{orgCode}
+        </if>
+        <if test="salesLevel != null and salesLevel == 'suboffice_level' ">
+            and g.suboffice_code  is not null
+            and g.suboffice_code  !=''
+            and g.suboffice_code = #{orgCode}
+        </if>
+        <if test="groupByStr != null and groupByStr != ''">
+            GROUP BY g.${groupByStr}
+        </if>
+        <if test="salesLevel != null and  salesLevel == 'diy_level' ">
+            ORDER BY sort.company_sort+0 asc
+        </if>
+    </select>
 </mapper>

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

@@ -218,7 +218,7 @@ public class EsignController extends ApiBaseController {
         logger.info("签署完成跳转地址:{}",redirectUrl);
 
         String businessScene = "司机授权";
-        String fileName = deliveryNumber+".pdf";
+        String fileName = UUID.randomUUID()+businessScene+".pdf";
         /*根据userId查询个人注册后accountId*/
         String signerAccountId = "";
             SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
@@ -320,7 +320,7 @@ public class EsignController extends ApiBaseController {
             logger.info("签署完成跳转地址:{}",redirectUrl);
 
             String businessScene = "委托授权";
-            String fileName = UUID.randomUUID()+"_授权.pdf";
+            String fileName = UUID.randomUUID()+businessScene+"_授权.pdf";
             /*根据userId查询个人注册后accountId*/
             String signerAccountId = "";
             SysUser sysUser = userService.selectUserById(Long.parseLong(userId));

+ 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) || ("reseller_level").equals(salesLevel)){
+            userType = "1";
+        }else{
+            userType = "0";
+        }
+        //是否有启动
+        AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(userType,sysUserExt.getSalesLevel(),sysUserExt.getOrgCode());
+
         if (alertConfiguration1!=null){
             //有启动
             Date date = new Date();