Kaynağa Gözat

添加后台页面+

peiguo 5 yıl önce
ebeveyn
işleme
7f1d83c8a1
34 değiştirilmiş dosya ile 1749 ekleme ve 470 silme
  1. 15 15
      admin-ui/app.js
  2. 0 10
      admin-ui/app/404.html
  3. 12 0
      admin-ui/app/whepi/env.js
  4. 173 0
      admin-ui/app/whepi/home/home.js
  5. 23 0
      admin-ui/app/whepi/home/selectUptown.js
  6. 323 0
      admin-ui/app/whepi/index.html
  7. 287 0
      admin-ui/app/whepi/index.js
  8. 180 0
      admin-ui/app/whepi/message.js
  9. 14 0
      admin-ui/app/whepi/mock/menu.json
  10. 97 0
      admin-ui/app/whepi/user/login.html
  11. 16 0
      whepi-doc/login.sql
  12. 9 9
      whepi-web/src/main/java/com/bofeng/JwtHelper.java
  13. 14 17
      whepi-web/src/main/java/com/bofeng/controller/AdminUserController.java
  14. 14 14
      whepi-web/src/main/java/com/bofeng/controller/CashierAccountsController.java
  15. 1 1
      whepi-web/src/main/java/com/bofeng/controller/CashierCustomerAccountsController.java
  16. 26 2
      whepi-web/src/main/java/com/bofeng/controller/EpiAdminController.java
  17. 167 0
      whepi-web/src/main/java/com/bofeng/controller/LoginController.java
  18. 220 224
      whepi-web/src/main/java/com/bofeng/controller/UserController.java
  19. 13 13
      whepi-web/src/main/java/com/bofeng/controller/worker/RoomManageController.java
  20. 3 0
      whepi-web/src/main/java/com/bofeng/dao/RbMapper.java
  21. 6 0
      whepi-web/src/main/java/com/bofeng/dao/UptownHomeMapper.java
  22. 4 0
      whepi-web/src/main/java/com/bofeng/dao/UptownMapper.java
  23. 1 9
      whepi-web/src/main/java/com/bofeng/dao/UserMapper.java
  24. 0 21
      whepi-web/src/main/java/com/bofeng/entity/User.java
  25. 17 4
      whepi-web/src/main/java/com/bofeng/service/SecurityService.java
  26. 31 42
      whepi-web/src/main/java/com/bofeng/service/UserService.java
  27. 23 23
      whepi-web/src/main/java/com/bofeng/service/worker/WorkerService.java
  28. 0 8
      whepi-web/src/main/java/com/bofeng/wx/controller/CustAccountController.java
  29. 4 4
      whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java
  30. 26 24
      whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java
  31. 2 2
      whepi-web/src/main/resources/application.yml
  32. 14 0
      whepi-web/src/main/resources/mapper/UptownMapper.xml
  33. 2 28
      whepi-web/src/main/resources/mapper/User.xml
  34. 12 0
      yvan-platform/src/main/java/com/yvan/springmvc/HttpParameterParser.java

+ 15 - 15
admin-ui/app.js

@@ -2,7 +2,7 @@
 
 var LOGINURL = "/user/login.html";
 
-var YJYDLOGINURL = "/app/yjyd/user/login.html";
+var YJYDLOGINURL = "/app/whepi/user/login.html";
 
 var CURRENTROLEID = 0;
 
@@ -314,22 +314,22 @@ function getFromJoin(value) {
     },
 
     //取业务字典的资源位置
-    bizDict: $.yvan.dictLoadDefine(function (data) {
-      return {
-        url: api('/sys/sysDict/getByKey'),
-        data: data,
-        type: 'get'
-      };
-    }),
+    // bizDict: $.yvan.dictLoadDefine(function (data) {
+    //   return {
+    //     url: api('/sys/sysDict/getByKey'),
+    //     data: data,
+    //     type: 'get'
+    //   };
+    // }),
 
     //取系统字典的资源位置
-    sysDict: $.yvan.dictLoadDefine(function (data) {
-      return {
-        url: api('/sys/sysDict/getByKey'),
-        data: data,
-        type: 'get'
-      };
-    }),
+    // sysDict: $.yvan.dictLoadDefine(function (data) {
+    //   return {
+    //     url: api('/sys/sysDict/getByKey'),
+    //     data: data,
+    //     type: 'get'
+    //   };
+    // }),
   });
 
 })(jQuery);

+ 0 - 10
admin-ui/app/404.html

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title></title>
-</head>
-<body>
-<h2>此功能稍后开放</h2>
-</body>
-</html>

+ 12 - 0
admin-ui/app/whepi/env.js

@@ -0,0 +1,12 @@
+function api(url) {
+  return '/whepi' + url;
+}
+
+function apiMat(url) {
+  // console.log(11);
+  return '/mat' + url;
+}
+
+function jumpApi(url) {
+  return url;
+}

+ 173 - 0
admin-ui/app/whepi/home/home.js

@@ -0,0 +1,173 @@
+define(function (require) {
+    return function (context) {
+
+        var $form, $form1;
+
+        // 弹框的方式
+        var widgets = {
+            // 搜索分类检索
+            selectTable: {
+                url: 'app/whepi/home/selectUptown.js',
+                bind: {
+                    uptownId: 'uptownId',
+                    uptownName: 'uptownName',
+                },
+            },
+        };
+
+        //检查查询
+        function queryGrid1() {
+            var obj = $form.formGet();
+            if (obj.we == "") {
+                $.yvan.msg('请选择电话号码');
+                return false;
+            }
+            return true;
+        }
+        //检查查询
+        function queryGrid2() {
+            var obj = $form1.formGet();
+            if (obj.uptownId == "") {
+                $.yvan.msg('请选择小区');
+                return false;
+            }
+            if (obj.date == "") {
+                $.yvan.msg('请选择导出时间');
+                return false;
+            }
+            return true;
+        }
+
+        return {
+            center: {
+                border: false,
+                title: '数据处理',
+                items: [
+                    {
+                        onRender: function () {
+                            $form = $(this);
+                        },
+                        xtype: 'formgroup',
+                        title: '',
+                        items: [
+                            [
+                                {
+                                    xtype: 'textbox',
+                                    label: '电话号码',
+                                    name: 'we',
+                                    prompt: '请输入要添加的电话号码',
+                                    labelWidth: 'auto',
+                                    id: 'we',
+                                },
+                            ]
+                        ]
+                    },
+                    {
+                        xtype: 'group',
+                        title: '具体操作',
+                        items: [
+                            [{xtype: 'offset'},
+                                {
+                                    xtype: 'button', text: '升级业委会角色', class: 'button-blue', onClick: function () {
+                                        if (!queryGrid1()) {
+                                            return;
+                                        }
+                                        var a = $form.formGet()
+                                        $.yvan.confirm('确定升级该号码的业委会角色?', {
+                                            yes: function (index) {
+                                                $.yvan.ajax({
+                                                    method: 'post',
+                                                    url: api('/epi/admin/addRole'),
+                                                    data: $form.formGet(),
+                                                    success: function (data) {
+                                                        $.yvan.msg('操作成功');
+                                                        return;
+                                                    }
+                                                });
+                                            }
+                                        });
+                                    }
+                                },
+                            ],
+                        ]
+                    },
+                    {
+                        onRender: function () {
+                            $form1 = $(this);
+                        },
+                        xtype: 'formgroup',
+                        title: '导出数据',
+                        items: [
+                            [
+                                {xtype: 'hidden', name: 'uptownId'},
+                                {
+                                    xtype: 'searchbox',
+                                    label: '小区',
+                                    name: 'uptownName',
+                                    prompt: "小区",
+                                    width: '400px',
+                                    widget: widgets.selectTable,// 弹出框方法
+                                    labelWidth: '120px',
+                                    onChange: function (value) {
+                                        if (!isNotNullOrEmpty(value)) {
+                                            $form.formSet({
+                                                userId: ''
+                                            })
+                                        }
+                                    },
+                                },
+                                {
+                                    name: 'date',
+                                    label: '导出时间',
+                                    prompt: '导出时间',
+                                    xtype: 'datebox',
+                                    labelWidth: 'auto',
+                                    width: 250,
+                                },
+                            ]
+                        ]
+                    },
+                    {
+                        xtype: 'group',
+                        title: '具体操作',
+                        items: [
+                            [{xtype: 'offset'},
+                                {
+                                    xtype: 'button', text: '导出小区正常家庭上报', class: 'button-blue', onClick: function () {
+                                        if (!queryGrid2()) {
+                                            return;
+                                        }
+                                        var uptownId = $form1.formGet().uptownId;
+                                        var date = $form1.formGet().date;
+                                        window.open(api('/epi/yeweihui/exportRiBao?uptownId=' + uptownId + '&date=' + date));
+                                    }
+                                },
+                                {
+                                    xtype: 'button', text: '导出凌云正常家庭上报', class: 'button-blue', onClick: function () {
+                                        var obj = $form1.formGet();
+                                        if (obj.date == "") {
+                                            $.yvan.msg('请选择导出时间');
+                                            return false;
+                                        }
+                                        var date = $form1.formGet().date;
+                                        window.open(api('/epi/lun/exportRiBao?date=' + date));
+                                    }
+                                },
+                                {
+                                    xtype: 'button', text: '导出小区家庭上报明细', class: 'button-blue', onClick: function () {
+                                        if (!queryGrid2()) {
+                                            return;
+                                        }
+                                        var uptownId = $form1.formGet().uptownId;
+                                        var date = $form1.formGet().date;
+                                        window.open(api('/epi/yeweihui/EXR?uptownId=' + uptownId + '&date=' + date));
+                                    }
+                                },
+                            ],
+                        ]
+                    },
+                ]
+            },
+        };
+    };
+});

+ 23 - 0
admin-ui/app/whepi/home/selectUptown.js

@@ -0,0 +1,23 @@
+// 查询类型
+define(function (require) {
+  return function (context) {
+    return {
+      xtype: 'widget',
+      title: '小区搜索',
+      width: 550,
+      height: 600,
+      grid: {
+        url: api('/getAllUptown'),
+        mtype: 'post',
+        pagination: true,
+        autoSizeColumns: true,
+        queryParams: {query: context.query},
+        // idField: 'userId',
+        columns: [[
+          {title: 'ID', field: 'uptownId', hidden: true},
+          {title: '名称', field: 'uptownName'},
+        ]]
+      }
+    };
+  };
+});

+ 323 - 0
admin-ui/app/whepi/index.html

@@ -0,0 +1,323 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <!-- 避免IE使用兼容模式 -->
+    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
+    <meta name="renderer" content="webkit">
+    <link rel="shortcut icon" href="/static/logo.png"/>
+    <title>家园公众号</title>
+    <link type="text/css" rel="stylesheet" href="/static/css/themes/default/easyui.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/jquery-ui-1.12.1.custom/jquery-ui.min.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/jqgrid_4.15.6/css/ui.jqgrid.min.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/font-awesome/css/font-awesome.min.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/css/themes/default/yvanui.grid.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/webuploader-0.1.5/webuploader.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/css/themes/default/yvanui.css"/>
+    <link type="text/css" rel="stylesheet" href="/yvanui/themes/default/protal.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/css/date.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/jqwidgets/styles/jqx.base.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/jqwidgets/styles/jqx.classic.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/daterangepicker/daterangepicker.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/select2-3.5/select2.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/toastr/toastr.min.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/css/hust.css"/>
+    <style>
+        .ii {
+            /*display: none;*/
+            background: #f00;
+            width: 80px;
+            height: 18px;
+            border-radius: 10px;
+            color: white;
+            text-align: center;
+            margin-top: -20px;
+            margin-left: 10px;
+            /*border-radius: 50%;*/
+            -moz-border-radius: 50%;
+            /*-webkit-border-radius: 50%;*/
+            z-index: 99999;
+
+        }
+
+        .circle {
+            width: 20px;
+            height: 18px;
+            margin-top: -2px;
+            padding-top: 2px;
+            background-color: red;
+            color: white;
+            text-align: center;
+            border-radius: 50%;
+            -moz-border-radius: 50%;
+            -webkit-border-radius: 50%;
+            float: right;
+        }
+
+        .circle1 {
+            width: 20px;
+            height: 18px;
+            margin-left: -10px;
+            margin-top: 5px;
+            padding-top: 2px;
+            background-color: red;
+            color: white;
+            text-align: center;
+            border-radius: 50%;
+            -moz-border-radius: 50%;
+            -webkit-border-radius: 50%;
+            vertical-align: middle;
+            float: right;
+        }
+    </style>
+</head>
+<body>
+
+<div id="loading" class="loading-wrap" style="top:0;left:0;bottom:0;right:0">
+    <div class="loading-content">
+        <div class="loading-round"></div>
+        <div class="loading-dot"></div>
+    </div>
+</div>
+
+<div id='body' class="easyui-layout" data-options="fit:true">
+    <div data-options="region:'north',border:false,bodyCls:'theme-header-layout'" style="height:65px;padding: 0;">
+        <div class="logo"></div>
+        <div id="topBar" class="theme-navigate" style="display: flex;justify-content: flex-end">
+
+            <div id="csMenu" class="right hide">
+                <ul class="easyui-menu hide dropdown-menu user-menu"></ul>
+                <a href="javascript:;" class="easyui-menubutton admin"
+                   data-options="hasDownArrow:false,menuAlign:'right',menu:'#csMenuList',showEvent:'click'">
+                    <i class="yvan-icon fa fa-bank"></i>
+                    <span>CS端</span>
+                    <i class="yvan-icon fa fa-caret-down"></i>
+                </a>
+                <ul id="csMenuList" class="dropdown-menu user-menu hide">
+                    <li>
+                        <a id="csMenuTest1">
+                            <i class="yvan-icon fa fa-cog"></i> 调用CS-Test
+                        </a>
+                    </li>
+                </ul>
+            </div>
+
+            <div class="right">
+                <ul id="switSysMenu" class="easyui-menu hide dropdown-menu user-menu"></ul>
+                <a href="javascript:;" class="easyui-menubutton admin"
+                   data-options="hasDownArrow:false,menuAlign:'right',menu:'#systemList',showEvent:'click'">
+<!--                    <i class="yvan-icon fa fa-bank"></i>-->
+<!--                    <span id="sys-name">${staffName()!系统设置}</span>-->
+<!--                    <i class="yvan-icon fa fa-caret-down"></i>-->
+                </a>
+                <ul id="systemList" class="dropdown-menu user-menu hide">
+
+                </ul>
+            </div>
+
+            <div id="roleSwith" class="right">
+                <ul id="switRoleMenu" class="easyui-menu hide dropdown-menu user-menu"></ul>
+<!--                <a id="roleSwithButton" href="javascript:;" class="easyui-menubutton admin"-->
+<!--                   data-options="hasDownArrow:false,menuAlign:'right',menu:'#roleList',showEvent:'click',hideEvent:'closeSB'">-->
+<!--                    <i class="yvan-icon fa fa-address-book-o"></i>-->
+<!--                    <span id="role-name"></span>-->
+<!--                    <i class="yvan-icon fa fa-caret-down"></i>-->
+<!--                </a>-->
+                <ul id="roleList" class="dropdown-menu user-menu hide">
+
+                </ul>
+            </div>
+            <span id="role-name-num" class="circle1"></span>
+
+            <div class="right">
+                <ul id="switchWhMenu" class="easyui-menu hide dropdown-menu user-menu"></ul>
+                <a href="javascript:;" class="easyui-menubutton admin"
+                   data-options="hasDownArrow:false,menuAlign:'right',menu:'#profile',showEvent:'click'">
+                    <span id="user-name">${staffName()!系统设置}</span>
+                    <i class="yvan-icon fa fa-caret-down"></i>
+                </a>
+                <ul id="profile" class="dropdown-menu user-menu hide">
+                    <li>
+                        <a onclick="App.resetPWD()">
+                            <i class="yvan-icon fa fa-cog"></i> 修改密码
+                        </a>
+                    </li>
+                    <li>
+                        <a onclick="App.onFullScreen()" class="full-screen">
+                            <i class="yvan-icon fa fa-arrows-alt"></i> <span>全屏显示</span>
+                        </a>
+                    </li>
+                    <li class="divider"></li>
+                    <li>
+                        <a onclick="App.logout()">
+                            <i class="yvan-icon fa fa-power-off"></i> 退出登录
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </div>
+
+    <div data-options="region:'west',title:'',split:true,title:'系统功能导航'"
+         style="width:300px; padding:5px;overflow-x: hidden;">
+        <input id='treesearch' class="easyui-searchbox" style="width:100%;"/>
+        <ul id="menutree" class="easyui-tree" style="margin: 5px -5px">
+        </ul>
+    </div>
+
+    <div data-options="region:'center',border:false">
+        <div id="tt" class="easyui-tabs" data-options="fit:true">
+        </div>
+
+        <div id="mm" class="easyui-menu" style="width:140px; display: none;">
+            <div id="Div1" name="1" iconCls="fa fa-close">关闭</div>
+            <div class="menu-sep"></div>
+            <div id="mm-tabcloseother" name="3">关闭其他</div>
+            <div id="mm-tabcloseall" name="2">关闭全部</div>
+        </div>
+    </div>
+
+    <!--<div data-options="region:'south',border:false"-->
+    <!--style="height:30px;border-top: 1px solid rgb(220, 220, 220);line-height: 20px;padding: 6px 0 6px 8px;background-color: #fff;overflow: hidden">-->
+    <!--华中科技大学系统所 Copyright © 2018 - 2019 All Rights Reserved-->
+    <!--<span style="float:right;padding-right:5px;width:30%;text-align: right;" id='yvanVersion'></span>-->
+    <!--<div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all" style="position:absolute;top:-9999px">-->
+    <!--<div class="ui-jqgrid-view">-->
+    <!--<div class="ui-jqgrid-bdiv">-->
+    <!--<div style="position: relative;">-->
+    <!--<table cellspacing="0" cellpadding="0" border="0">-->
+    <!--<tr class="ui-widget-content jqgrow ui-row-ltr" style="table-layout:table">-->
+    <!--<td id="tdCompute" style="background:#eee;width:auto"></td>-->
+    <!--</tr>-->
+    <!--</table>-->
+    <!--</div>-->
+    <!--</div>-->
+    <!--</div>-->
+    <!--</div>-->
+    <!--</div>-->
+</div>
+
+<!--[if lte IE 8]>
+<div id="ie6-warning">
+    <p>您正在使用低版本浏览器,在本页面可能会导致部分功能无法使用,建议您升级到
+        <a href="http://www.microsoft.com/china/windows/internet-explorer/" target="_blank">IE9或以上版本的浏览器</a>
+        或使用<a href="http://se.360.cn/" target="_blank">360安全浏览器</a>的极速模式浏览
+    </p>
+</div>
+<![endif]-->
+
+</body>
+
+</html>
+<!-- jQuery相关引用 -->
+<script type="text/javascript" src="/static/plugins/jquery/jquery.min.js"></script>
+<script type="text/javascript" src="/static/plugins/jquery/jquery.cookie.js"></script>
+<script type="text/javascript" src="/static/plugins/moment/moment.min.js"></script>
+<script type="text/javascript" src="/static/plugins/vue/vue.min.js"></script>
+<script type="text/javascript" src="/static/plugins/echarts4.2.0/echarts.common.min.js"></script>
+<script type="text/javascript" src="/static/plugins/jquery-easyui-1.6.10/jquery.easyui.min.js"></script>
+<script type="text/javascript" src="/static/plugins/pinyin/pinyin.js"></script>
+<script type="text/javascript" src="/static/plugins/sea/sea.js"></script>
+<script type="text/javascript" src="/static/plugins/jquery-easyui-1.6.10/jquery.easyui.min.js"></script>
+<script type="text/javascript" src="/static/plugins/jqgrid_4.15.6/jquery.jqgrid.min.js"></script>
+<script type="text/javascript" src="/static/plugins/jqgrid_4.15.6/i18n/grid.locale-cn.js"></script>
+<script type="text/javascript" src="/static/plugins/jqwidgets/jqx-all.js"></script>
+<script type="text/javascript" src="/static/plugins/select2-3.5/select2.js"></script>
+<script type="text/javascript" src="/static/plugins/select2-3.5/select2_locale_zh-CN.js"></script>
+<script type="text/javascript" src="/static/plugins/toastr/toastr.min.js"></script>
+<script type="text/javascript" src="/static/plugins/daterangepicker/daterangepicker.js"></script>
+
+<!-- yvanui start -->
+<script type="text/javascript" src="/yvanui/yvanui.edatagrid.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.treesearch.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.searchbox.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvselect.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.calendar.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.datebox.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.core.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.combobox.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.toolbar.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.radiobutton.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.checkbox.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.checkgroup.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.radiogroup.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.msg.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.power.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.echarts.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.vm.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.dialog.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.dict.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.widget.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.shortcut.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.valid.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.time.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.grid.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.grid.edit.js"></script>
+<script type="text/javascript" src="/static/plugins/webuploader-0.1.5/webuploader.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.upload.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.excel.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.iframe.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.md5.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvgrid.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvtreegrid.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvgrid.edit.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvgrid.selection.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvgrid.filter.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvsearch.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvnumber.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvdate.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvcheck.js"></script>
+<script type="text/javascript" src="/yvanui/yvanui.yvsearch.widget.js"></script>
+<script type="text/javascript" src="/yvanui/locale/zh_cn.js"></script>
+<script type="text/javascript" src="/static/language/cn/local-ui-CN.js"></script>
+<!-- yvanui end -->
+
+<!-- Device -->
+<!--<script type="text/javascript" src='/device/deviceHandler.js'></script>-->
+<!--<script type="text/javascript" src='/device/deviceConnection.js'></script>-->
+<!--<script type="text/javascript" src='/device/camera/camera.js'></script>-->
+<!--<script type="text/javascript" src='/device/labelPrinter/labelPrinter.js'></script>-->
+<!-- Device end -->
+
+<script type="text/javascript" src="/app.js"></script>
+<script type="text/javascript" src="/fileApi.js"></script>
+<script type="text/javascript" src="/format.js"></script>
+<script type="text/javascript" src="/app/whepi/env.js"></script>
+<script type="text/javascript">
+  var version = "190723";
+  seajs.config({
+    base: "/",
+    map: [
+      ['.js', '.js?v=' + version]
+    ]
+  });
+
+  // $(function () {
+  //
+  //   ('#wrap')
+  //   {
+  //     display: flex;
+  //     justify - content
+  //   :
+  //     flex - start;
+  //   }
+  //   });
+  function clearAllSeaCache() {
+    $.each(seajs.cache, function (k) {
+      delete seajs.cache[k];
+    });
+
+    $.each(seajs.fetchedList, function (k) {
+      delete seajs.fetchedList[k];
+    });
+  }
+
+</script>
+<script type="text/javascript" src="/js-big-decimal.js"></script>
+<script type="text/javascript" src="/app/whepi/index.js"></script>
+<script type="text/javascript" src="/app/whepi/message.js"></script>
+
+
+
+
+

+ 287 - 0
admin-ui/app/whepi/index.js

@@ -0,0 +1,287 @@
+$(function () {
+  //隐藏角色上的提示红点
+  $('#role-name-num').hide();
+  function doSearch(text) {
+    $('#menutree').tree('search', text);
+  }
+  App.init(function () {
+    document.onkeydown = function (event) {
+      if (event.ctrlKey && event.keyCode === 191) {
+        console.log($(document.activeElement));
+      }
+    };
+
+    $('#body').layout();
+    $('#treesearch').searchbox({
+      prompt: '搜索',
+      searcher: doSearch,
+      icons: [
+        {
+          iconCls: 'icon-clear',
+          handler: function (e) {
+            $(e.data.target).textbox('clear').textbox('textbox').focus();
+            doSearch('');
+          }
+        }]
+    });
+    $('.easyui-menubutton').menubutton();
+    $('#menutree').tree({
+      url: '/app/whepi/mock/menu.json', //api('/menu_tree'),
+      onDblClick: function (node) {
+        var $this = $(this);
+        if (!$this.tree('isLeaf', node.target)) {
+          $this.tree(node.state === 'closed' ? 'expand' : 'collapse', node.target);
+        }
+      },
+      onSelect: function () {
+        return false;
+      },
+      onClick: function (node) {
+        var href = node.href;
+        if ($.trim(href)) {
+          App.addTab({title: node.text, url: node.href, id: node.id, iconCls: node.iconCls});
+        }
+      },
+      onLoadSuccess: function (node, data) {
+      }
+    });
+
+    $('#mm').menu({
+      onClick: function (item) {
+        App.tabMenuOprate(this, item.name);
+      }
+    });
+    $('#tt').tabs({
+      onContextMenu: function (e, title, index) {
+        e.preventDefault();
+        if (index >= 0) {
+          $('#mm').menu('show', {
+            left: e.pageX,
+            top: e.pageY
+          }).data("tabTitle", title);
+        }
+      },
+      onSelect: function (title, index) {
+        if (index >= 0) {
+          var node = $('#tt').tabs('getTab', index).panel('options').node;
+          if (node && node.id) {
+            window.location.hash = $.param(node);
+            node = $('#menutree').tree('find', node.id);
+            $('#menutree').tree('select', node.target).tree('expandTo', node.target).tree('scrollTo', node.target);
+          }
+        }
+      },
+      onBeforeClose: function (title, index) {
+        var tab = $('#tt').tabs('getSelected');
+        var curTabIndex = $('#tt').tabs('getTabIndex', tab);
+        if (index === curTabIndex) {
+          window.location.hash = '';
+        }
+      }
+    });
+
+  });
+});
+var App = {
+
+  init: function (success) {
+    $.yvan.ajax({
+      url: api("/api/me"),
+      method: 'get',
+      loadingMask: false,
+      success: function (data) {
+        if (!$.trim(data.data.userId)) {
+          top.window.location.href = jumpApi(YJYDLOGINURL);
+          return;
+        }
+
+        $('#user-name').html(data.data.staffName);
+        success();
+        $("#loading").remove();
+      },
+      error: function () {
+        top.window.location.href = jumpApi(YJYDLOGINURL);
+      }
+    });
+  },
+
+  //打开Tab窗口
+  addTab: function (params) {
+    var $tt = $('#tt');
+
+    if ($tt.tabs('exists', params.title)) {
+      $tt.tabs('select', params.title);
+      return;
+    }
+
+    var lastMenuClickTime = $.cookie("menuClickTime");
+    var nowTime = new Date().getTime();
+    if ((nowTime - lastMenuClickTime) < 500) {
+      $.yvan.msg('操作过快,请稍后重试');
+      return;
+    }
+
+    var id = $.yvan.createId('t');
+    var iframe;
+    if (params.url.slice(-3) === '.js') {
+      iframe = $('<div></div>');
+      iframe.progress();
+
+    } else {
+      iframe = '<iframe src="' + params.url +
+          '" scrolling="auto" frameborder="0" style="width:100%;height:100%;"></iframe>';
+    }
+
+    $tt.tabs('add', {
+      id: id,
+      title: params.title,
+      closable: true,
+      iconCls: $.trim(params.iconCls) ? params.iconCls + ' fa-lg' : 'fa fa-file-text-o',
+      content: iframe,
+      border: params.border || true,
+      fit: true,
+      node: {
+        url: params.url,
+        title: params.title,
+        id: params.id
+      }
+    });
+
+    if ($.type(iframe) !== 'string') {
+      seajs.use([params.url], function (powerOpt) {
+        if ($.type(powerOpt) === 'function') {
+          powerOpt = powerOpt();
+        }
+        console.log(powerOpt);
+        $.extend(powerOpt, {
+          class: 'bizWindow'
+        });
+        iframe.parent().power(powerOpt);
+        iframe.progress('close');
+      });
+    }
+  },
+
+  closeMe: function () {
+    var $tt = $('#tt');
+    var tab = $tt.tabs('getSelected');
+    var index = $tt.tabs('getTabIndex', tab);
+    $tt.tabs("close", index);
+  },
+
+  // Tab菜单操作
+  tabMenuOprate: function (menu, type) {
+    var $tt = $('#tt');
+    var allTabs = $tt.tabs('tabs');
+    var allTabtitle = [];
+    $.each(allTabs, function (i, n) {
+      var opt = $(n).panel('options');
+      if (opt.closable)
+        allTabtitle.push(opt.title);
+    });
+    var curTabTitle = $(menu).data("tabTitle");
+    var curTabIndex = $tt.tabs("getTabIndex", $tt.tabs("getTab", curTabTitle));
+    switch (type) {
+      case "1": //关闭当前
+        $tt.tabs("close", curTabTitle);
+        break;
+      case "2": //全部关闭
+        for (var i = 0; i < allTabtitle.length; i++) {
+          $tt.tabs('close', allTabtitle[i]);
+        }
+        break;
+      case "3": //除此之外全部关闭
+        for (var i = 0; i < allTabtitle.length; i++) {
+          if (curTabTitle != allTabtitle[i])
+            $tt.tabs('close', allTabtitle[i]);
+        }
+        $tt.tabs('select', curTabTitle);
+        $tt.tabs('scrollBy', 0);
+        break;
+      case "4": //当前侧面右边
+        for (var i = curTabIndex; i < allTabtitle.length; i++) {
+          $tt.tabs('close', allTabtitle[i]);
+        }
+        $tt.tabs('select', curTabTitle);
+        break;
+      case "5": //当前侧面左边
+        for (var i = 0; i < curTabIndex - 1; i++) {
+          $tt.tabs('close', allTabtitle[i]);
+        }
+        $tt.tabs('select', curTabTitle);
+        break;
+      case "6": //刷新
+        var currentTab = $tt.tabs('getSelected');
+        var opts = $.data(currentTab[0], 'panel').options;
+        if (opts.iframe) {
+          var currentIframe = currentTab.find('iframe')[0];
+          currentIframe.contentWindow.location.href = currentIframe.src;
+        } else {
+          $(currentTab[0]).panel('refresh');
+        }
+        break;
+      case "7": //在新窗口打开
+        var refresh_tab = $tt.tabs('getSelected');
+        var refresh_iframe = refresh_tab.find('iframe')[0];
+        window.open(refresh_iframe.src);
+        break;
+    }
+  },
+
+  //退出登录
+  logout: function () {
+    $.cookie('auth', null);
+    top.window.location.href = jumpApi(YJYDLOGINURL);
+  },
+
+  //修改密码
+  resetPWD: function () {
+    var me = this;
+    seajs.use('/user/resetPWD', function (opt) {
+      $.yvan.showDialog(me, opt());
+    });
+  },
+
+  //全屏显示
+  onFullScreen: function () {
+    //头部全屏显示
+    var text = $('.full-screen span').text();
+    if (text === "全屏显示") {
+      var el = document.documentElement;
+      var rfs = el.requestFullScreen || el.webkitRequestFullScreen;
+      if (typeof rfs !== "undefined" && rfs) {
+        rfs.call(el);
+      } else if (typeof window.ActiveXObject !== "undefined") {
+        var wscript = new ActiveXObject("WScript.Shell");
+        if (wscript != null) {
+          wscript.SendKeys("{F11}");
+        }
+      } else if (el.msRequestFullscreen) {
+        el.msRequestFullscreen();
+      } else if (el.oRequestFullscreen) {
+        el.oRequestFullscreen();
+      } else {
+        $.yvan.msg('浏览器不支持全屏调用!请更换浏览器或按F11键切换全屏!');
+      }
+      $('.full-screen span').text('退出全屏');
+    } else {
+      var el = document;
+      var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullScreen;
+      if (typeof cfs !== "undefined" && cfs) {
+        cfs.call(el);
+      } else if (typeof window.ActiveXObject !== "undefined") {
+        var wscript = new ActiveXObject("WScript.Shell");
+        if (wscript != null) {
+          wscript.SendKeys("{F11}");
+        }
+      } else if (el.msExitFullscreen) {
+        el.msExitFullscreen();
+      } else if (el.oRequestFullscreen) {
+        el.oCancelFullScreen();
+      } else {
+        $.yvan.msg('浏览器不支持全屏调用!请更换浏览器或按F11键切换全屏!');
+      }
+      $('.full-screen span').text('全屏显示');
+    }
+  }
+};

+ 180 - 0
admin-ui/app/whepi/message.js

@@ -0,0 +1,180 @@
+Message = {
+
+  MSG_TYPE_TASK: 'task',
+  MSG_TYPE_ALERT: 'alert',
+  MSG_TYPE_PROMPT: 'prompt',
+
+  menuTree: '',
+
+  lockReconnect: false, //避免重复连接
+
+  socket: null,
+
+  wsUrl: '',
+
+  connectWebSocket: function () {
+
+    Message.wsUrl = 'ws://' + window.location.host + '/yjyd/websocket';
+
+    Message.socket = new WebSocket(Message.wsUrl);
+
+    Message.socket.onopen = function (msg) {
+      Message.heartCheck.reset().start(); //传递信息
+      console.log('WebSocket opened!');
+    };
+    Message.socket.onmessage = function (message) {
+
+      Message.heartCheck.reset().start();
+      if (message.data == 'pong') {
+        return;
+      }
+      var data = JSON.parse(message.data);
+      Message.messageRouter(data);
+      console.log('receive message: ' + message.data);
+    };
+    Message.socket.onerror = function (error) {
+      Message.reconnect(Message.wsUrl);
+      console.log('Error: ' + error.name + error.number);
+    };
+    Message.socket.onclose = function () {
+      Message.reconnect(Message.wsUrl);
+      console.log('WebSocket closed!');
+    };
+  },
+  messageRouter: function (data) {
+    switch (data.msgType) {
+      case Message.MSG_TYPE_TASK: {
+        Message.cacheTempData(data);
+        Message.onMessageTask(data);
+        break;
+      }
+    }
+  },
+
+
+  /**收到任务提示*/
+  onMessageTask: function (data) {
+    $.yvan.notify({
+      autoClose: 5000,
+      type: 'info',
+      body: data.msg,
+      title: data.msgTitle,
+      onClick: function () {
+        if (data.data) {
+
+          console.log(data.data);
+
+          // // 解析路径
+          // var path = data.data.linkedMenuPath;
+          // var menuIds = path.split('/');
+          // for (var i = menuIds.length - 1; i >= 0; i--) {
+          //   if (menuIds[i] == '' || menuIds[i] == null) {
+          //     menuIds.splice(i, 1);
+          //   }
+          // }
+          //
+          // //根据menuId在menuTree里面查找菜单
+          // if (Message.menuTree == '') {
+          //   return;
+          // }
+          // for (var i = 0; i < Message.menuTree.length; i++) {
+          //   var menu1 = Message.menuTree[i];
+          //   // 找到第一级菜单
+          //   if (menu1.id == menuIds[0]) {
+          //     var menu = Message.getTargetMenu(menu1, 1, menuIds);
+          //     App.addTab(
+          //       {
+          //         title: menu.text,
+          //         iconCls: menu.iconCls,
+          //         url: menu.href,
+          //         id: menu.id,
+          //         _: App.currentUrId,
+          //       });
+          //   }
+          // }
+          // console.log(menuIds);
+          top.window.open(".." + data.data.linkedMenuPath);
+        }
+      }
+    });
+  },
+
+  /**递归查找子菜单,直到找到为止*/
+  getTargetMenu: function (menu, level, menuIds) {
+    var children = menu.children;
+    if (children == '' || children == null || menuIds.length < level + 1) {
+      return menu;
+    } else {
+      for (var i = 0; i < children.length; i++) {
+        var child = children[i];
+        if (menuIds[level] == child.id) {
+          level++;
+          return Message.getTargetMenu(child, level, menuIds);
+        }
+      }
+    }
+  },
+
+  cacheTempData: function (data) {
+    if (data.data) {
+      localStorage.setItem("tempData" + top.window.location.host + "/app" + data.data.linkedMenuPath, JSON.stringify(data.data));
+    }
+  },
+
+  cacheHomeTempData: function (data, patchKey) {
+    if (data) {
+      localStorage.setItem("tempData" + top.window.location.host + top.window.location.pathname + "#" + patchKey, JSON.stringify(data));
+    }
+  },
+
+  getCacheData: function () {
+    var key = "tempData" + top.window.location.host + top.window.location.pathname + top.window.location.hash;
+    dataStr = localStorage.getItem(key);
+    localStorage.removeItem(key);
+    if (dataStr) {
+      return JSON.parse(dataStr);
+    }
+    return null;
+  },
+
+  getTempParamData: function () {
+    var d = Message.getCacheData();
+    if (d) {
+      return d.param;
+    }
+    return null;
+  },
+
+  reconnect: function (url) {
+    if (Message.lockReconnect) return;
+    Message.lockReconnect = true;
+    //没连接上会一直重连,设置延迟避免请求过多
+    setTimeout(function () {
+      Message.connectWebSocket();
+      Message.lockReconnect = false;
+    }, 2000);
+  },
+
+  //心跳检测
+  heartCheck: {
+    timeout: 6000, //60秒
+    timeoutObj: null,
+    serverTimeoutObj: null,
+    reset: function () {
+      clearTimeout(this.timeoutObj);
+      clearTimeout(this.serverTimeoutObj);
+      return this;
+    },
+    start: function () {
+      var self = this;
+      this.timeoutObj = setTimeout(function () {
+        //这里发送一个心跳,后端收到后,返回一个心跳消息,
+        //onmessage拿到返回的心跳就说明连接正常
+        Message.socket.send("ping");
+        self.serverTimeoutObj = setTimeout(function () { //如果超过一定时间还没重置,说明后端主动断开了
+          Message.socket.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
+        }, self.timeout)
+      }, this.timeout)
+    }
+  }
+};

+ 14 - 0
admin-ui/app/whepi/mock/menu.json

@@ -0,0 +1,14 @@
+{
+  "success": true,
+  "msg": "",
+  "data": [
+    {
+      "id": "ENT10000",
+      "text": "系统首页",
+      "href": "/app/whepi/home/home.js",
+      "iconCls": "icon-blank fa fa-desktop",
+      "state": "close",
+      "children": []
+    }
+  ]
+}

+ 97 - 0
admin-ui/app/whepi/user/login.html

@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <!-- 避免IE使用兼容模式 -->
+    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
+    <meta name="renderer" content="webkit">
+    <title>系统登录</title>
+    <link rel="shortcut icon" href="/static/logo.png"/>
+    <link type="text/css" rel="stylesheet" href="/static/plugins/font-awesome/css/font-awesome.min.css"/>
+    <link type="text/css" rel="stylesheet" href="/static/css/login.css"/>
+</head>
+<body>
+<div class="login-body">
+    <div class="login-body-box">
+        <form id="form" method="post">
+            <dl class="login-dl-form">
+                <dt class="login-dl-title">家园公众号管理系统</dt>
+                <dd>
+                    <div class="login-dl-name">用户名</div>
+                    <div class="login-dl-info">
+                        <input id="loginName" name="loginName" type="text" placeholder="请输入用户名/工卡号"
+                               style="font-size:14px;"/>
+                        <i class="fa fa-user"></i>
+                    </div>
+                </dd>
+                <dd>
+                    <div class="login-dl-name">密码</div>
+                    <div class="login-dl-info">
+                        <input id="loginPwd" name="loginPwd" type="password" placeholder="请输入密码"
+                               style="font-size:14px;"/>
+                        <i class="fa fa-unlock-alt"></i>
+                    </div>
+                </dd>
+                <dd class="errorinfo"></dd>
+            </dl>
+            <dl class="login-dl-submit"><a class="submit">登录</a></dl>
+        </form>
+    </div>
+</div>
+</body>
+
+</html>
+<!-- jQuery相关引用 -->
+<script type="text/javascript" src="/static/plugins/jquery/jquery.min.js"></script>
+<script type="text/javascript" src="/static/plugins/jquery/jquery.cookie.js"></script>
+<script type="text/javascript" src="/app.js"></script>
+<script type="text/javascript" src="/app/whepi/env.js"></script>
+<script>
+  $(function () {
+    $('.submit').click(function () {
+      $('.errorinfo').html('');
+
+      if (!$('#loginName').val()) {
+        $('.errorinfo').html('请填写用户名');
+        return;
+      }
+
+      if (!$('#loginPwd').val()) {
+        $('.errorinfo').html('请填写密码');
+        return;
+      }
+      $('#form').submit();
+    });
+
+    $(document).keyup(function (event) {
+      if (event.keyCode === 13) {
+        $(".submit").trigger("click");
+      }
+    });
+
+    $('#form').submit(function () {
+      $.ajax({
+        url: api('/user/login.json'),
+        crossDomain: true,
+        type: 'post',
+        data: {
+          loginName: $('#loginName').val(),
+          loginPwd: $('#loginPwd').val()
+        },
+        success: function (root) {
+          if (!root.success) {
+            $('.errorinfo').html(root.msg);
+          } else {
+            $.cookie('auth', root.data.token, {path: '/'});
+            window.location.href = '/app/whepi/index.html#';
+          }
+        },
+        error: function () {
+          $('.errorinfo').html('网络异常');
+        }
+      });
+
+      return false;
+    });
+  });
+</script>

+ 16 - 0
whepi-doc/login.sql

@@ -1,16 +1,22 @@
 -- ----------------------------
 -- Table structure for sys_user
 -- ----------------------------
+drop table if exists sys_user;
+create table sys_user
+(
+  user_id             BIGINT          not null             comment '用户编号',
+  login_name          VARCHAR(50)     not null default ''  comment '登录账户',
+  login_pwd           VARCHAR(50)     not null default '123456'  comment '登录密码',
+  user_type           VARCHAR(1)      not null             comment '角色ID:1居民,2业委会,3商家',
+  staff_name          VARCHAR(20)     not null             comment '用户姓名',
+
+  be_active           CHAR(1)         not null default 'Y' comment '是否活动 Y=活动/N=禁用/D=删除',
+  create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP   COMMENT '建立时间',
+  update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新日期',
+  primary key ( user_id )
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT = '用户资料';
+
+
 
 drop table if exists sys_user_open;
 create table sys_user_open

+ 9 - 9
whepi-web/src/main/java/com/bofeng/JwtHelper.java

@@ -6,6 +6,7 @@ import com.auth0.jwt.algorithms.Algorithm;
 import com.auth0.jwt.interfaces.Claim;
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableMap;
+import com.yvan.platform.Conv;
 import com.yvan.springmvc.HttpUtils;
 import lombok.val;
 import org.joda.time.DateTime;
@@ -50,7 +51,7 @@ public class JwtHelper {
     /**
      * 校验 jwtToken 是否正确
      */
-    public static boolean verify(String jwtToken, String userId, String tokenVersion, String secret) {
+    public static boolean verify(String jwtToken, Long userId, String tokenVersion, String secret) {
         try {
             Algorithm algorithm = Algorithm.HMAC256(secret);
             JWTVerifier verifier = JWT.require(algorithm)
@@ -68,18 +69,18 @@ public class JwtHelper {
     /**
      * 获得 userId
      */
-    public static String getUserId(String token) {
+    public static Long getUserId(String token) {
         if (Strings.isNullOrEmpty(token)) {
-            return "";
+            return 0L;
         }
         Map<String, Claim> m = JWT.decode(token).getClaims();
-        return m.get(USER_ID).asString();
+        return m.get(USER_ID).asLong();
     }
 
     /**
      * 获取当前请求的 agentId
      */
-    public static String getUserId() {
+    public static Long getUserId() {
         return getUserId(getAuthHeader(HttpUtils.currentRequest()));
     }
 
@@ -164,7 +165,7 @@ public class JwtHelper {
     /**
      * 生成签名
      */
-    public static String sign(String userAgentId, String tokenVersion, String role, String staffName, String secret, int expireOfMinutes) {
+    public static String sign(Long userAgentId, String role, String staffName, String secret, int expireOfMinutes) {
 
         DateTime now = DateTime.now();
 
@@ -172,7 +173,6 @@ public class JwtHelper {
         return JWT.create()
                 .withHeader(HEADER)
                 .withClaim(USER_ID, userAgentId)
-                .withClaim(TOKEN_VERSION, tokenVersion)
                 .withClaim(STAFF_NAME, staffName)
                 .withClaim(USER_TYPE, role)
                 .withIssuedAt(now.toDate())
@@ -210,10 +210,10 @@ public class JwtHelper {
 
         String secret = "jzt600998";
         String role = "custom";
-        String userId = "CUST_1";
+        Long userId = 123465L;
         String staffName = "张三";
         String version = "1";
-        String token = sign(userId, version, role, staffName, secret, 6 * 30 * 24 * 60);
+        String token = sign(userId, role, staffName, secret, 6 * 30 * 24 * 60);
         System.out.println("token=" + token);
         System.out.println("getAgentId=" + getUserId(token));
         System.out.println("getTokenVersion=" + getTokenVersion(token));

+ 14 - 17
whepi-web/src/main/java/com/bofeng/controller/AdminUserController.java

@@ -1,6 +1,7 @@
 package com.bofeng.controller;
 
 import com.bofeng.Consts;
+import com.bofeng.dao.UserMapper;
 import com.bofeng.entity.Place;
 import com.bofeng.entity.ScanParam;
 import com.bofeng.entity.User;
@@ -45,6 +46,8 @@ public class AdminUserController {
 
     @Autowired
     private UserService userService;
+    @Autowired
+    private UserMapper userMapper;
 
     @Autowired
     private QrCodeService qrCodeService;
@@ -62,11 +65,6 @@ public class AdminUserController {
         return new ModelAndView("/admin/user.ftl");
     }
 
-    @GetMapping("/admin/user.json")
-    public Model<List<User>> getUser(PageDb pageDb) {
-        return Model.newSuccess(pageDb, userService.selectAll(pageDb));
-    }
-
     @GetMapping("/admin/get_place_role.json")
     public Model<Map<String, List<Map>>> getPlaceAndRole() {
         List<Place> placeList = placeService.selectAllPlace();
@@ -101,22 +99,21 @@ public class AdminUserController {
 
     @PostMapping("/admin/user_addnew.json")
     public ModelOps userInsert(@RequestBody User user) {
-
-        val msg = userService.insert(user);
-        if (Strings.isNullOrEmpty(msg)) {
+        Integer msg = userMapper.insert(user);
+        if (Strings.isNullOrEmpty(msg.toString())) {
             return ModelOps.newSuccess();
         }
-        return ModelOps.newFail(msg);
+        return ModelOps.newFail(msg.toString());
     }
 
-    @PostMapping("/admin/user_edit.json")
-    public ModelOps userEdit(@RequestBody User user) {
-        val msg = userService.updateById(user);
-        if (Strings.isNullOrEmpty(msg)) {
-            return ModelOps.newSuccess();
-        }
-        return ModelOps.newFail(msg);
-    }
+//    @PostMapping("/admin/user_edit.json")
+//    public ModelOps userEdit(@RequestBody User user) {
+//        val msg = userService.updateById(user);
+//        if (Strings.isNullOrEmpty(msg)) {
+//            return ModelOps.newSuccess();
+//        }
+//        return ModelOps.newFail(msg);
+//    }
 
     //@PostMapping("/admin/user_bind_qr.png")
     @GetMapping(value = "/admin/user_bind_qr_png", produces = MediaType.IMAGE_PNG_VALUE)

+ 14 - 14
whepi-web/src/main/java/com/bofeng/controller/CashierAccountsController.java

@@ -51,23 +51,23 @@ public class CashierAccountsController {
         queryParam.put("orderStartAt", orderStartAt);
         queryParam.put("orderEndAt", orderEndAt);
         User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-        queryParam.put("placeId", currentUser.getPlaceId());
+//        queryParam.put("placeId", currentUser.getPlaceId());
 
         return Model.newSuccess(pageDb, cashierService.getSettleOrder(pageDb, queryParam));
     }
 
-    @PostMapping("/cashier/order_settle.json")
-    public ModelOps ordersSettle(@Pd(name = "orderStartAt", required = false, defaultValue = "") String orderStartAt,
-                                 @Pd(name = "orderEndAt", required = false, defaultValue = "") String orderEndAt,
-                                 @RequestBody List<Long> saleIdList) {
-
-
-        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-        Long placeId = currentUser.getPlaceId();
-        for (int i = 0; i < saleIdList.size(); i++) {
-            orderService.ordersSettle(orderStartAt, orderEndAt, saleIdList.get(i), placeId);
-        }
-        return ModelOps.newSuccess(saleIdList.size());
-    }
+//    @PostMapping("/cashier/order_settle.json")
+//    public ModelOps ordersSettle(@Pd(name = "orderStartAt", required = false, defaultValue = "") String orderStartAt,
+//                                 @Pd(name = "orderEndAt", required = false, defaultValue = "") String orderEndAt,
+//                                 @RequestBody List<Long> saleIdList) {
+//
+//
+//        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
+//        Long placeId = currentUser.getPlaceId();
+//        for (int i = 0; i < saleIdList.size(); i++) {
+//            orderService.ordersSettle(orderStartAt, orderEndAt, saleIdList.get(i), placeId);
+//        }
+//        return ModelOps.newSuccess(saleIdList.size());
+//    }
 
 }

+ 1 - 1
whepi-web/src/main/java/com/bofeng/controller/CashierCustomerAccountsController.java

@@ -54,7 +54,7 @@ public class CashierCustomerAccountsController {
         queryParam.put("customerName", customerName);
         queryParam.put("paid", Consts.PAID_NO);
         User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-        queryParam.put("placeId", currentUser.getPlaceId());
+//        queryParam.put("placeId", currentUser.getPlaceId());
 
         return Model.newSuccess(pageDb, cashierService.search(pageDb, queryParam));
     }

+ 26 - 2
whepi-web/src/main/java/com/bofeng/controller/EpiAdminController.java

@@ -1,23 +1,47 @@
 package com.bofeng.controller;
 
+import com.bofeng.dao.UptownHomeMapper;
+import com.bofeng.dao.UserRoleMapper;
+import com.bofeng.entity.UptownHome;
+import com.bofeng.entity.UserRole;
 import com.bofeng.service.EpiAdminService;
 import com.yvan.ModelOps;
 import com.yvan.mvc.Pd;
+import com.yvan.platform.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 public class EpiAdminController {
 
     @Autowired
     private EpiAdminService epiAdminService;
+    @Autowired
+    private UptownHomeMapper uptownHomeMapper;
+    @Autowired
+    private UserRoleMapper userRoleMapper;
 
     @ApiOperation("升级业委会角色")
-    @GetMapping("/epi/admin/addRole")
+    @PostMapping("/whepi/epi/admin/addRole")
     public ModelOps adminAddRole(@Pd(name = "we", desc = "手机号码") String we){
-        return ModelOps.newSuccess(epiAdminService.addYwhRole(we));
+        if (!StringUtils.isNullOrEmpty(we)) {
+            List<UptownHome> list = uptownHomeMapper.getUptownHomeByPhone(we);
+            if (list.size() != 1) {
+                return ModelOps.newFail("该电话号码不存在,或多人注册该号码");
+            }
+            Long userId = uptownHomeMapper.getUserIdByPhone(we);
+            List<UserRole> list1 = userRoleMapper.getUserRoleByUserId(userId);
+            if (list1.size() >= 2) {
+                return ModelOps.newFail("该电话已经升级过业委会角色");
+            }
+            return ModelOps.newSuccess(epiAdminService.addYwhRole(we));
+        }
+        return null;
     }
 
 }

+ 167 - 0
whepi-web/src/main/java/com/bofeng/controller/LoginController.java

@@ -0,0 +1,167 @@
+package com.bofeng.controller;
+
+import com.baomidou.mybatisplus.toolkit.IdWorker;
+import com.bofeng.JwtHelper;
+import com.bofeng.dao.UserMapper;
+import com.bofeng.entity.LoginResult;
+import com.bofeng.entity.User;
+import com.bofeng.service.SecurityService;
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import com.yvan.Model;
+import com.yvan.ModelOps;
+import com.yvan.mvc.Pd;
+import com.yvan.platform.JsonWapper;
+import com.yvan.springmvc.HttpUtils;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authc.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Slf4j
+@RestController
+public class LoginController {
+
+    @Autowired
+    private UserMapper userMapper;
+
+    @Autowired
+    private SecurityService securityService;
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+
+    @ApiOperation("获取当前用户信息")
+    @GetMapping("/whepi/api/me")
+    public Model<Map<String, Object>> me() {
+        Map<String, Object> model = Maps.newLinkedHashMap();
+        model.put("userId", JwtHelper.getUserId());
+        model.put("staffName", JwtHelper.getStaffName());
+        model.put("expireTime", JwtHelper.getExpireTime());
+//        ResultModel model = new ResultModel()
+//                .set("userId", JwtHelper.getUserId())
+//                .set("staffName", JwtHelper.getStaffName())
+//                .set("expireTime", JwtHelper.getExpireTime());
+        return Model.newSuccess(model);
+    }
+
+    @ApiOperation("用户登录")
+    @PostMapping("/whepi/user/login.json")
+    public Model<LoginResult> userLogin(HttpServletResponse response,
+                                        HttpServletRequest request,
+                                        @Pd(name = "loginName", desc = "登录账号") String loginName,
+                                        @Pd(name = "loginPwd", desc = "登录密码") String loginPwd,
+                                        @Pd(name = "platformKey", desc = "一次性标记,区分当前网页的平台", required = false) String platformKey) {
+        Model<LoginResult> loginResultModel = login(response, request, loginName, loginPwd, 0L, false);
+        if (!Strings.isNullOrEmpty(platformKey)) {
+            if (stringRedisTemplate.hasKey(platformKey)) {
+                String platform = stringRedisTemplate.opsForValue().get(platformKey);
+                stringRedisTemplate.delete(platformKey);
+                response.setHeader("platform", platform);
+            }
+        }
+        return loginResultModel;
+    }
+
+    private Model<LoginResult> login(HttpServletResponse response,
+                                     HttpServletRequest request,
+                                     String loginName,
+                                     String loginPwd,
+                                     Long accountType,
+                                     Boolean isCs) {
+        User user = null;
+        try {
+            user = userMapper.selectByLoginName(loginName);
+            //校验密码
+            if (user == null) {
+                throw new UnknownAccountException();
+            }
+            if (!loginPwd.equals(user.getLoginPwd())) {
+                throw new IncorrectCredentialsException();
+            }
+        } catch (Exception e) {
+            return processException(e);
+        }
+        return loginResult(response, request, user, isCs);
+    }
+
+    private Model<LoginResult> loginResult(HttpServletResponse response,
+                                           HttpServletRequest request,
+                                           User user,
+                                           Boolean isCs) {
+        //生成 Auth
+        String jwt = securityService.createJwt(user, false);
+        //redis记录登录信息
+        securityService.setAccountUserId(user.getUserId());
+//        securityService.setTokenVersion(sysAccount.getAccId(), sysAccount.getTokenVersion());
+        //返回客户端
+        LoginResult loginResult = new LoginResult();
+        loginResult.setUser(user);
+        loginResult.setToken(jwt);
+        loginResult.setHref("/admin/home.html");
+        response.setHeader("Access-Control-Expose-Headers", JwtHelper.AUTH_HEADER_NAME);
+        response.setHeader(JwtHelper.AUTH_HEADER_NAME, JwtHelper.getAuthHeader(request));
+        return Model.newSuccess(loginResult).setMsg("登录成功");
+    }
+
+    private Model<LoginResult> processException(Exception e) {
+        Model<LoginResult> r = new Model<LoginResult>().setSuccess(false);
+        if (e instanceof UnknownAccountException) {
+            return r.setMsg("登录账号不存在!");
+        }
+        if (e instanceof LockedAccountException) {
+            return r.setMsg("用户已经被锁定不能登录,请与管理员联系!");
+        }
+        if (e instanceof DisabledAccountException) {
+            return r.setMsg("用户已经被禁用,请与管理员联系!");
+        }
+        if (e instanceof ExcessiveAttemptsException) {
+            return r.setMsg("登录失败次数过多!");
+        }
+        if (e instanceof ExpiredCredentialsException) {
+            return r.setMsg("凭证过期!");
+        }
+        if (e instanceof IncorrectCredentialsException) {
+            return r.setMsg("密码错误!");
+        }
+        if (e instanceof AuthenticationException) {
+            return r.setMsg("用户或密码不正确!");
+        }
+        log.error("e", e);
+        return r.setMsg("未知错误:" + e.getMessage());
+    }
+
+    @PostMapping("/sys/account/resetPwd")
+    public ModelOps resetPwd(@Pd(name = "oldPwd") String oldPwd,
+                             @Pd(name = "newPwd") String newPwd,
+                             @Pd(name = "rePwd") String repwd){
+        if (Strings.isNullOrEmpty(newPwd) || newPwd.length()<6) {
+            return ModelOps.newFail("密码长度不能低于6位");
+        }
+        if (!newPwd.equals(repwd)) {
+            return ModelOps.newFail("两次密码不一致");
+        }
+        return resertPwd(JwtHelper.getUserId(),oldPwd,newPwd);
+    }
+
+    public ModelOps resertPwd(Long userId, String oldPwd, String newPwd) {
+        int a = userMapper.updatePassword(userId,  oldPwd, newPwd);
+        if (a > 0) {
+            User user = userMapper.selectById(userId);
+            return (ModelOps) ModelOps.newSuccess(a).setMsg("密码修改成功,请重新登录");
+        }
+        return ModelOps.newFail("密码修改失败,请输入正确的原始密码!");
+    }
+}

+ 220 - 224
whepi-web/src/main/java/com/bofeng/controller/UserController.java

@@ -51,230 +51,226 @@ public class UserController {
     @Autowired
     private PlaceService placeService;
 
-    @GetMapping("/user/logout.html")
-    @PostMapping("/user/logout.html")
-    public ModelAndView logout() {
-        HttpUtils.removeCookie(JwtHelper.AUTH_COOKIE_NAME, "/");
-        SecurityUtils.getSubject().logout();
-        return new ModelAndView(new RedirectViewJs("/"));
-    }
-
-    @GetMapping("/user/login.html")
-    public ModelAndView login() {
-        return new ModelAndView("/user/login.ftl");
-    }
-
-    @PostMapping("/user/login.json")
-    public Model<LoginResult> loginPost(HttpServletResponse response,
-                                        HttpServletRequest request,
-                                        @Pd(name = "ig_username") final String loginName,
-                                        @Pd(name = "ig_password") final String loginPwd) {
-
-        User user;
-        try {
-            user = userService.login(loginName);
-
-            //校验密码
-            String secretPwd = securityService.createPassword(user, loginPwd);
-            if (!secretPwd.equals(user.getLoginPwd())) {
-                throw new IncorrectCredentialsException();
-            }
-
-        } catch (Exception e) {
-            return processException(e);
-        }
-
-        //生成 Auth
-        String jwt = securityService.createJwt(user, false);
-
-        //写入头部和cookie
-        HttpUtils.currentResponse().addHeader(JwtHelper.AUTH_HEADER_NAME, jwt);
-
-        //更新登录成功次数和日期
-        userService.updateLoginCount(user.getUserId());
-
-        //返回客户端
-        LoginResult loginResult = new LoginResult();
-        loginResult.setUser(user);
-        loginResult.setToken(jwt);
-        if (Consts.USER_TYPE_ADMIN.equals(user.getUserType())) {
-            loginResult.setHref("/admin/index.html");
-        } else if (Consts.USER_TYPE_CASHIER.equals(user.getUserType())) {
-            loginResult.setHref("/cashier/customer_accounts.html");
-        } else if (Consts.USER_TYPE_WORKER.equals(user.getUserType())) {
-            loginResult.setHref("/worker/room_manage.html");
-        }
-
-
-        response.setHeader("Access-Control-Expose-Headers", JwtHelper.AUTH_HEADER_NAME);
-        response.setHeader(JwtHelper.AUTH_HEADER_NAME, JwtHelper.getAuthHeader(request));
-
-        return Model.newSuccess(loginResult).setMsg("登录成功");
-    }
-
-    @PostMapping("/user/reset_password.json")
-    public ModelOps resetPassword(@RequestBody Map map) {
-        String userId = JwtHelper.getUserId();
-        if (Strings.isNullOrEmpty(userId)) {
-            return ModelOps.newFail("用户不存在或登录已经过期");
-        }
-        if (Strings.isNullOrEmpty(Conv.NS(map.get("password")))) {
-            return ModelOps.newFail("密码不能为空");
-        }
-        if (Strings.isNullOrEmpty(Conv.NS(map.get("newPassword")))) {
-            return ModelOps.newFail("新密码不能为空");
-        }
-        if (!Conv.NS(map.get("newPassword")).equals(Conv.NS(map.get("repeatPassword")))) {
-            return ModelOps.newFail("两次密码不一致");
-        }
-        int result = userService.updatePassword(Conv.NL(userId), Conv.NS(map.get("password")),Conv.NS(map.get("newPassword")));
-        if (result<=0) {
-            return ModelOps.newFail("修改失败");
-        }
-        HttpUtils.removeCookie(JwtHelper.AUTH_COOKIE_NAME, "/");
-        SecurityUtils.getSubject().logout();
-        return ModelOps.newSuccess(result).setMsg("密码修改成功,请重新登录");
-    }
-
-    private Model<LoginResult> processException(Exception e) {
-        Model<LoginResult> r = new Model<LoginResult>().setSuccess(false);
-
-        if (e instanceof UnknownAccountException) {
-            return r.setMsg("登录账号不存在!");
-        }
-        if (e instanceof LockedAccountException) {
-            return r.setMsg("用户已经被锁定不能登录,请与管理员联系!");
-        }
-        if (e instanceof DisabledAccountException) {
-            return r.setMsg("用户已经被禁用,请与管理员联系!");
-        }
-        if (e instanceof ExcessiveAttemptsException) {
-            return r.setMsg("登录失败次数过多!");
-        }
-        if (e instanceof ExpiredCredentialsException) {
-            return r.setMsg("凭证过期!");
-        }
-        if (e instanceof IncorrectCredentialsException) {
-            return r.setMsg("密码错误!");
-        }
-        if (e instanceof AuthenticationException) {
-            return r.setMsg("用户或密码不正确!");
-        }
-
-        log.error("e", e);
-        return r.setMsg("未知错误:" + e.getMessage());
-    }
-
-    @GetMapping("/cust/user_bind.html")
-    public ModelAndView userBind(@RequestParam(name = "userType", required = false, defaultValue = "") String userType,
-                                 @RequestParam(name = "higherId", required = false, defaultValue = "") String higherId,
-                                 @RequestParam(name = "placeId", required = false, defaultValue = "") String placeId,
-                                 @RequestParam(name = "code", required = false, defaultValue = "") String code,
-                                 ModelMap model) throws WxErrorException {
-        if (!Strings.isNullOrEmpty(code)) {
-            WxMpOAuth2AccessToken accessToken = mpService.oauth2getAccessToken(code);
-            WxMpUser wxMpUser = mpService.oauth2getUserInfo(accessToken, null);
+//    @GetMapping("/user/logout.html")
+//    @PostMapping("/user/logout.html")
+//    public ModelAndView logout() {
+//        HttpUtils.removeCookie(JwtHelper.AUTH_COOKIE_NAME, "/");
+//        SecurityUtils.getSubject().logout();
+//        return new ModelAndView(new RedirectViewJs("/"));
+//    }
+//
+//    @GetMapping("/user/login.html")
+//    public ModelAndView login() {
+//        return new ModelAndView("/user/login.ftl");
+//    }
+//
+//    @PostMapping("/whepi/user/login.json")
+//    public Model<LoginResult> loginPost(HttpServletResponse response,
+//                                        HttpServletRequest request,
+//                                        @Pd(name = "loginName") final String loginName,
+//                                        @Pd(name = "loginPwd") final String loginPwd) {
+//
+//        User user;
+//        try {
+//            user = userService.login(loginName);
+//            //校验密码
+//            String secretPwd = securityService.createPassword(user, loginPwd);
+//            if (!secretPwd.equals(user.getLoginPwd())) {
+//                throw new IncorrectCredentialsException();
+//            }
+//
+//        } catch (Exception e) {
+//            return processException(e);
+//        }
+//
+//        //生成 Auth
+//        String jwt = securityService.createJwt(user, false);
+//
+//        //写入头部和cookie
+//        HttpUtils.currentResponse().addHeader(JwtHelper.AUTH_HEADER_NAME, jwt);
+//
+//        //返回客户端
+//        LoginResult loginResult = new LoginResult();
+//        loginResult.setUser(user);
+//        loginResult.setToken(jwt);
+//        if (Consts.USER_TYPE_ADMIN.equals(user.getUserType())) {
+//            loginResult.setHref("/admin/index.html");
+//        } else if (Consts.USER_TYPE_CASHIER.equals(user.getUserType())) {
+//            loginResult.setHref("/cashier/customer_accounts.html");
+//        } else if (Consts.USER_TYPE_WORKER.equals(user.getUserType())) {
+//            loginResult.setHref("/worker/room_manage.html");
+//        }
+//
+//
+//        response.setHeader("Access-Control-Expose-Headers", JwtHelper.AUTH_HEADER_NAME);
+//        response.setHeader(JwtHelper.AUTH_HEADER_NAME, JwtHelper.getAuthHeader(request));
+//
+//        return Model.newSuccess(loginResult).setMsg("登录成功");
+//    }
+//
+//    @PostMapping("/user/reset_password.json")
+//    public ModelOps resetPassword(@RequestBody Map map) {
+//        String userId = JwtHelper.getUserId();
+//        if (Strings.isNullOrEmpty(userId)) {
+//            return ModelOps.newFail("用户不存在或登录已经过期");
+//        }
+//        if (Strings.isNullOrEmpty(Conv.NS(map.get("password")))) {
+//            return ModelOps.newFail("密码不能为空");
+//        }
+//        if (Strings.isNullOrEmpty(Conv.NS(map.get("newPassword")))) {
+//            return ModelOps.newFail("新密码不能为空");
+//        }
+//        if (!Conv.NS(map.get("newPassword")).equals(Conv.NS(map.get("repeatPassword")))) {
+//            return ModelOps.newFail("两次密码不一致");
+//        }
+//        int result = userService.updatePassword(Conv.NL(userId), Conv.NS(map.get("password")),Conv.NS(map.get("newPassword")));
+//        if (result<=0) {
+//            return ModelOps.newFail("修改失败");
+//        }
+//        HttpUtils.removeCookie(JwtHelper.AUTH_COOKIE_NAME, "/");
+//        SecurityUtils.getSubject().logout();
+//        return ModelOps.newSuccess(result).setMsg("密码修改成功,请重新登录");
+//    }
+//
+//    private Model<LoginResult> processException(Exception e) {
+//        Model<LoginResult> r = new Model<LoginResult>().setSuccess(false);
+//
+//        if (e instanceof UnknownAccountException) {
+//            return r.setMsg("登录账号不存在!");
+//        }
+//        if (e instanceof LockedAccountException) {
+//            return r.setMsg("用户已经被锁定不能登录,请与管理员联系!");
+//        }
+//        if (e instanceof DisabledAccountException) {
+//            return r.setMsg("用户已经被禁用,请与管理员联系!");
+//        }
+//        if (e instanceof ExcessiveAttemptsException) {
+//            return r.setMsg("登录失败次数过多!");
+//        }
+//        if (e instanceof ExpiredCredentialsException) {
+//            return r.setMsg("凭证过期!");
+//        }
+//        if (e instanceof IncorrectCredentialsException) {
+//            return r.setMsg("密码错误!");
+//        }
+//        if (e instanceof AuthenticationException) {
+//            return r.setMsg("用户或密码不正确!");
+//        }
+//
+//        log.error("e", e);
+//        return r.setMsg("未知错误:" + e.getMessage());
+//    }
+//
+//    @GetMapping("/cust/user_bind.html")
+//    public ModelAndView userBind(@RequestParam(name = "userType", required = false, defaultValue = "") String userType,
+//                                 @RequestParam(name = "higherId", required = false, defaultValue = "") String higherId,
+//                                 @RequestParam(name = "placeId", required = false, defaultValue = "") String placeId,
+//                                 @RequestParam(name = "code", required = false, defaultValue = "") String code,
+//                                 ModelMap model) throws WxErrorException {
+//        if (!Strings.isNullOrEmpty(code)) {
+//            WxMpOAuth2AccessToken accessToken = mpService.oauth2getAccessToken(code);
+//            WxMpUser wxMpUser = mpService.oauth2getUserInfo(accessToken, null);
+////            model.put("user", user);
+//            UserOpen userOpen = userOpenService.getUserByOpenId(wxMpUser.getOpenId());
+//            UserPlace userPlace = null;
+//            User user = null;
+//
+//            if (userOpen != null) {
+//                userPlace = userPlaceService.getByUserIdAndPlaceId(userOpen.getUserId(), Conv.NL(placeId));
+//                user = userService.getUserById(userOpen.getUserId());
+//                if (user != null) {
+//                    model.put("user", user);
+//                }
+//
+//            }
+//            if (userPlace == null) {
+//                Place place = placeService.getById(Conv.NL(placeId));
+//                model.put("placeName", place.getPlaceName());
+//                model.put("placeId", placeId);
+//                model.put("userType", userType);
+//                model.put("higherId", higherId);
+//                model.put("openId", wxMpUser.getOpenId());
+//                model.put("nickName", wxMpUser.getNickname());
+//                model.put("sexDesc", wxMpUser.getSexDesc());
+//                model.put("sex", wxMpUser.getSex());
+//                model.put("city", wxMpUser.getCity());
+//                model.put("province", wxMpUser.getProvince());
+//                model.put("country", wxMpUser.getCountry());
+//                model.put("headImgUrl", wxMpUser.getHeadImgUrl());
+//                return new ModelAndView("/cust/user_bind.ftl", model);
+//
+//            } else {
+//                model.put("title", "您已经绑定过账号了!");
+//                if (userPlace.getUserType().equals(Consts.USER_TYPE_L1)) {
+//                    model.put("message", "一级分销");
+//                } else if (userPlace.getUserType().equals(Consts.USER_TYPE_L2)) {
+//                    model.put("message", "二级分销");
+//                }
+//            }
+//            return new ModelAndView("/prompt/prompt.ftl", model);
+//
+//        } else {
+//            User user = new User();
+//            user.setUserType("1");
 //            model.put("user", user);
-            UserOpen userOpen = userOpenService.getUserByOpenId(wxMpUser.getOpenId());
-            UserPlace userPlace = null;
-            User user = null;
-
-            if (userOpen != null) {
-                userPlace = userPlaceService.getByUserIdAndPlaceId(userOpen.getUserId(), Conv.NL(placeId));
-                user = userService.getUserById(userOpen.getUserId());
-                if (user != null) {
-                    model.put("user", user);
-                }
-
-            }
-            if (userPlace == null) {
-                Place place = placeService.getById(Conv.NL(placeId));
-                model.put("placeName", place.getPlaceName());
-                model.put("placeId", placeId);
-                model.put("userType", userType);
-                model.put("higherId", higherId);
-                model.put("openId", wxMpUser.getOpenId());
-                model.put("nickName", wxMpUser.getNickname());
-                model.put("sexDesc", wxMpUser.getSexDesc());
-                model.put("sex", wxMpUser.getSex());
-                model.put("city", wxMpUser.getCity());
-                model.put("province", wxMpUser.getProvince());
-                model.put("country", wxMpUser.getCountry());
-                model.put("headImgUrl", wxMpUser.getHeadImgUrl());
-                return new ModelAndView("/cust/user_bind.ftl", model);
-
-            } else {
-                model.put("title", "您已经绑定过账号了!");
-                if (userPlace.getUserType().equals(Consts.USER_TYPE_L1)) {
-                    model.put("message", "一级分销");
-                } else if (userPlace.getUserType().equals(Consts.USER_TYPE_L2)) {
-                    model.put("message", "二级分销");
-                }
-            }
-            return new ModelAndView("/prompt/prompt.ftl", model);
-
-        } else {
-            User user = new User();
-            user.setUserType("1");
-            model.put("user", user);
-            model.put("openId", "2345");
-            return new ModelAndView("/cust/user_bind.ftl");
-
-        }
-
-    }
-
-    @PostMapping("/admin/deleteOpenId.json")
-    public ModelOps bindUser(@RequestParam("userId") Long userId) {
-        return ModelOps.newSuccess(userService.deleteOpenId(userId));
-    }
-
-    @PostMapping("/cust/user_bind.json")
-    public ModelOps bindUser(HttpServletResponse response,
-                             HttpServletRequest request,
-                             @RequestBody Map map) {
-
-
-        UserOpen userOpen = userOpenService.getUserByOpenId((String) map.get("openId"));
-        if (userOpen == null) {
-            userOpen = new UserOpen();
-            userOpen.setUserId(IdWorker.getId());
-            userOpen.setBeActive("Y");
-            userOpen.setOpenId((String) map.get("openId"));
-            userOpen.setNickName((String) map.get("nickName"));
-            userOpen.setSex(Integer.valueOf((String) map.get("sex")));
-            userOpen.setSexDesc((String) map.get("sexDesc"));
-            userOpen.setCity((String) map.get("city"));
-            userOpen.setProvince((String) map.get("province"));
-            userOpen.setCountry((String) map.get("country"));
-            userOpen.setHeadImgUrl((String) map.get("headImgUrl"));
-        }
-        User user = userService.getUserById(userOpen.getUserId());
-        UserPlace userPlace = userPlaceService.getByUserIdAndPlaceId(userOpen.getUserId(), Conv.NL(map.get("placeId")));
-        if (user == null) {
-            user = new User();
-            user.setUserId(userOpen.getUserId());
-            user.setBeActive("Y");
-            user.setUserType("S");
-            user.setStaffName((String) map.get("staffName"));
-            user.setPhone((String) map.get("phone"));
-            user.setLoginName("");
-            user.setVersion("1.1");
-//            return ModelOps.newSuccess(userOpenService.bindUserOpen(userOpen, user));
-        }
-        if (userPlace == null) {
-            userPlace = new UserPlace();
-            userPlace.setHigherId(Conv.NL(map.get("higherId")));
-            userPlace.setPlaceId(Conv.NL(map.get("placeId")));
-            userPlace.setUserId(userOpen.getUserId());
-            userPlace.setUserType(Conv.NS(map.get("userType")));
-        } else {
-
-            return ModelOps.newFail("已经绑定");
-        }
-
-        return ModelOps.newSuccess(userOpenService.bindUser(userOpen, user, userPlace));
-
-    }
+//            model.put("openId", "2345");
+//            return new ModelAndView("/cust/user_bind.ftl");
+//
+//        }
+//
+//    }
+//
+//    @PostMapping("/admin/deleteOpenId.json")
+//    public ModelOps bindUser(@RequestParam("userId") Long userId) {
+//        return ModelOps.newSuccess(userService.deleteOpenId(userId));
+//    }
+//
+//    @PostMapping("/cust/user_bind.json")
+//    public ModelOps bindUser(HttpServletResponse response,
+//                             HttpServletRequest request,
+//                             @RequestBody Map map) {
+//
+//
+//        UserOpen userOpen = userOpenService.getUserByOpenId((String) map.get("openId"));
+//        if (userOpen == null) {
+//            userOpen = new UserOpen();
+//            userOpen.setUserId(IdWorker.getId());
+//            userOpen.setBeActive("Y");
+//            userOpen.setOpenId((String) map.get("openId"));
+//            userOpen.setNickName((String) map.get("nickName"));
+//            userOpen.setSex(Integer.valueOf((String) map.get("sex")));
+//            userOpen.setSexDesc((String) map.get("sexDesc"));
+//            userOpen.setCity((String) map.get("city"));
+//            userOpen.setProvince((String) map.get("province"));
+//            userOpen.setCountry((String) map.get("country"));
+//            userOpen.setHeadImgUrl((String) map.get("headImgUrl"));
+//        }
+//        User user = userService.getUserById(userOpen.getUserId());
+//        UserPlace userPlace = userPlaceService.getByUserIdAndPlaceId(userOpen.getUserId(), Conv.NL(map.get("placeId")));
+//        if (user == null) {
+//            user = new User();
+//            user.setUserId(userOpen.getUserId());
+//            user.setBeActive("Y");
+//            user.setUserType("S");
+//            user.setStaffName((String) map.get("staffName"));
+////            user.setPhone((String) map.get("phone"));
+////            user.setLoginName("");
+////            user.setVersion("1.1");
+////            return ModelOps.newSuccess(userOpenService.bindUserOpen(userOpen, user));
+//        }
+//        if (userPlace == null) {
+//            userPlace = new UserPlace();
+//            userPlace.setHigherId(Conv.NL(map.get("higherId")));
+//            userPlace.setPlaceId(Conv.NL(map.get("placeId")));
+//            userPlace.setUserId(userOpen.getUserId());
+//            userPlace.setUserType(Conv.NS(map.get("userType")));
+//        } else {
+//
+//            return ModelOps.newFail("已经绑定");
+//        }
+//
+//        return ModelOps.newSuccess(userOpenService.bindUser(userOpen, user, userPlace));
+//
+//    }
 
 }

+ 13 - 13
whepi-web/src/main/java/com/bofeng/controller/worker/RoomManageController.java

@@ -40,21 +40,21 @@ public class RoomManageController {
         return new ModelAndView("/worker/room_manage.ftl");
     }
 
-    @GetMapping("/worker/room")
-    public Model<List<Room>> getRoom(PageDb pageDb) {
-        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-        return Model.newSuccess(pageDb, roomService.selectByPlaceId(currentUser.getPlaceId(),pageDb));
-    }
+//    @GetMapping("/worker/room")
+//    public Model<List<Room>> getRoom(PageDb pageDb) {
+//        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
+//        return Model.newSuccess(pageDb, roomService.selectByPlaceId(currentUser.getPlaceId(),pageDb));
+//    }
 
-    @GetMapping("/worker/room_enable.json")
-    public ModelOps roomEnable(@Pd(name = "roomId") Long roomId){
-        return ModelOps.newSuccess(workerService.enableRoomById(roomId));
-    }
+//    @GetMapping("/worker/room_enable.json")
+//    public ModelOps roomEnable(@Pd(name = "roomId") Long roomId){
+//        return ModelOps.newSuccess(workerService.enableRoomById(roomId));
+//    }
 
-    @GetMapping("/worker/room_use.json")
-    public ModelOps roomUse(@Pd(name = "roomId") Long roomId){
-        return ModelOps.newSuccess(workerService.useRoomById(roomId));
-    }
+//    @GetMapping("/worker/room_use.json")
+//    public ModelOps roomUse(@Pd(name = "roomId") Long roomId){
+//        return ModelOps.newSuccess(workerService.useRoomById(roomId));
+//    }
 
     @GetMapping("/worker/room_order.json")
     public Model<Order> roomOrder(@Pd(name = "roomId") Long roomId){

+ 3 - 0
whepi-web/src/main/java/com/bofeng/dao/RbMapper.java

@@ -117,4 +117,7 @@ public interface RbMapper extends BaseMapper<sysUptownUnit> {
     List<Uptown> selectUptown(@Param("userId") Long userId);
 
 
+    @Select("select ur.* from sys_uptown ur where ur.uptown_name = #{uptownName} and ur.status = 1")
+    List<Uptown> selectUptownByName(@Param("uptownName") String uptownName);
+
 }

+ 6 - 0
whepi-web/src/main/java/com/bofeng/dao/UptownHomeMapper.java

@@ -15,4 +15,10 @@ public interface UptownHomeMapper extends BaseMapper<UptownHome> {
 
     @Select("select * from sys_uptown_home where house_id = #{houseId} and status = 1")
     List<UptownHome> getUptownHomeBy(@Param("houseId") Long houseId);
+
+    @Select("select * from sys_uptown_home where phone = #{phone} and status = 1")
+    List<UptownHome> getUptownHomeByPhone(@Param("phone") String phone);
+
+    @Select("select ur.user_id from sys_uptown_home uh left join sys_user_role ur on ur.property_id = uh.house_id where uh.phone = #{phone} and uh.status = 1")
+    Long getUserIdByPhone(@Param("phone") String phone);
 }

+ 4 - 0
whepi-web/src/main/java/com/bofeng/dao/UptownMapper.java

@@ -2,12 +2,14 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.Uptown;
+import com.yvan.PageDb;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 @Repository
@@ -15,4 +17,6 @@ public interface UptownMapper extends BaseMapper<Uptown> {
 
     @Select("select * from sys_uptown where status = 1 and area = #{area}")
     List<Uptown> getAllUptown(@Param("area") Integer area);
+
+    List<Uptown> getUptowns(PageDb pageDb, Map<String, Object> queryParam);
 }

+ 1 - 9
whepi-web/src/main/java/com/bofeng/dao/UserMapper.java

@@ -15,17 +15,9 @@ import java.util.Map;
 @Repository
 public interface UserMapper extends BaseMapper<User> {
 
-    @Select("select * from tb_user where login_name=#{login_name}")
+    @Select("select * from sys_user where login_name=#{login_name}")
     User selectByLoginName(@Param("login_name") String loginName);
 
-    String selectVersionById(Long userId);
-
-    int updateLoginCount(@Param("user_id") Long userId);
-
-    List<User> selectAll(PageDb pageDb);
-
-    int updateInfo(Map p);
-
     int updatePassword(@Param("userId") Long userId,  @Param("password") String password, @Param("newPassword") String newPassword);
 
     int checkLoginName(User user);

+ 0 - 21
whepi-web/src/main/java/com/bofeng/entity/User.java

@@ -22,33 +22,12 @@ public class User {
     @JsonIgnore
     private String loginPwd;
 
-    @TableField("phone")
-    private String phone;
-
     @TableField("user_type")
     private String userType;
 
-    @TableField("place_id")
-    private Long placeId;
-
-    //用户表没有此字段
-    @TableField(exist = false)
-    private String placeName;
-
     @TableField("staff_name")
     private String staffName;
 
-    @TableField("version")
-    private String version;
-
     @TableField("be_active")
     private String beActive;
-
-    @TableField(exist = false)
-    private Long loginCount;
-
-    @TableField(exist = false)
-    private DateTime lastLoginTime;
-
-
 }

+ 17 - 4
whepi-web/src/main/java/com/bofeng/service/SecurityService.java

@@ -10,9 +10,13 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 
+import java.util.concurrent.TimeUnit;
+
 @Service
 public class SecurityService {
 
+    private static final int EXPIRE_MINUTES = 24 * 60;
+
     @Value("${secret:jztd}")
     private String secret = "jztd";
 
@@ -33,7 +37,17 @@ public class SecurityService {
         stringRedisTemplate.opsForValue().set(key, tokenVersion);
     }
 
-    public String getVersion(String userId) {
+    public void setAccountUserId(Long accountId, Long userId) {
+        val key = "account_user:" + accountId;
+        stringRedisTemplate.opsForValue().set(key, userId.toString(), EXPIRE_MINUTES, TimeUnit.MINUTES);
+    }
+
+    public void setAccountUserId(Long userId) {
+        val key = "account_user:" + userId;
+        stringRedisTemplate.opsForValue().set(key, userId.toString(), EXPIRE_MINUTES, TimeUnit.MINUTES);
+    }
+
+    public String getVersion(Long userId) {
         val key = "token:" + userId;
         return stringRedisTemplate.opsForValue().get(key);
     }
@@ -43,8 +57,7 @@ public class SecurityService {
     }
 
     public String createJwt(User user, boolean isMobile) {
-        return JwtHelper.sign(Conv.NS(user.getUserId()),
-                user.getVersion(),
+        return JwtHelper.sign(user.getUserId(),
                 user.getUserType(),
                 user.getStaffName(),
                 secret,
@@ -52,7 +65,7 @@ public class SecurityService {
     }
 
     public void verify(String jwtToken) {
-        final String userId = JwtHelper.getUserId(jwtToken);
+        final Long userId = JwtHelper.getUserId(jwtToken);
         String tokenVersion = getVersion(userId);
         if (!JwtHelper.verify(jwtToken, userId, tokenVersion, secret)) {
             throw new AuthenticationException("tokenVersion expire!");

+ 31 - 42
whepi-web/src/main/java/com/bofeng/service/UserService.java

@@ -67,51 +67,40 @@ public class UserService {
         return userMapper.selectById(userId);
     }
 
-    @Transactional
-    public int updateLoginCount(Long userId) {
-        return userMapper.updateLoginCount(userId);
-    }
-
-    public List<User> selectAll(PageDb pageDb) {
-        return userMapper.selectAll(pageDb);
-    }
-
-    @Transactional
-    public String updateById(User user) {
 
-        if (!Strings.isNullOrEmpty(user.getLoginName())) {
-            int checkLoginNameCount = userMapper.checkLoginName(user);
-            if (checkLoginNameCount > 0) {
-                return "登录名不能重复!";
-            }
-        }
-
-        userMapper.updateById(user);
-        user.setVersion(YvanUtil.createUUID());
-        return "";
-    }
 
-    @Transactional
-    public String insert(User user) {
-        user.setUserId(IdWorker.getId());
-        user.setVersion(YvanUtil.createUUID());
-        user.setBeActive(Consts.ACT_ENABLE);
-
-        if (!Strings.isNullOrEmpty(user.getLoginName())) {
-            int checkLoginNameCount = userMapper.checkLoginName(user);
-            if (checkLoginNameCount > 0) {
-                return "登录名不能重复!";
-            }
-        }
-
-        userMapper.insert(user);
-        return "";
-    }
+//    @Transactional
+//    public String updateById(User user) {
+//
+//        if (!Strings.isNullOrEmpty(user.getLoginName())) {
+//            int checkLoginNameCount = userMapper.checkLoginName(user);
+//            if (checkLoginNameCount > 0) {
+//                return "登录名不能重复!";
+//            }
+//        }
+//
+//        userMapper.updateById(user);
+//        user.setVersion(YvanUtil.createUUID());
+//        return "";
+//    }
+
+//    @Transactional
+//    public String insert(User user) {
+//        user.setUserId(IdWorker.getId());
+//        user.setVersion(YvanUtil.createUUID());
+//        user.setBeActive(Consts.ACT_ENABLE);
+//
+//        if (!Strings.isNullOrEmpty(user.getLoginName())) {
+//            int checkLoginNameCount = userMapper.checkLoginName(user);
+//            if (checkLoginNameCount > 0) {
+//                return "登录名不能重复!";
+//            }
+//        }
+//
+//        userMapper.insert(user);
+//        return "";
+//    }
 
-    @Transactional
-    public int updateInfo(Map p) {
-        return userMapper.updateInfo(p);
-    }
 
     @Transactional
     public int updatePassword(Long userId, String password, String newPassword) {

+ 23 - 23
whepi-web/src/main/java/com/bofeng/service/worker/WorkerService.java

@@ -28,30 +28,30 @@ public class WorkerService {
     @Autowired
     private OrderMapper orderMapper;
 
-    @Transactional
-    public int enableRoomById(Long roomId) {
-
-        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-
-        Room currentRoom = roomMapper.selectById(roomId);
-
-        if (currentUser.getPlaceId().equals(currentRoom.getPlaceId())){
-            return roomMapper.enableRoomById(roomId) + orderMapper.discardByRoomId(roomId);
-        }
-        throw new RuntimeException("场地和包厢不匹配");
-    }
-
-    @Transactional
-    public int useRoomById(Long roomId) {
-        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
-
-        Room currentRoom = roomMapper.selectById(roomId);
+//    @Transactional
+//    public int enableRoomById(Long roomId) {
+//
+//        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
+//
+//        Room currentRoom = roomMapper.selectById(roomId);
+//
+//        if (currentUser.getPlaceId().equals(currentRoom.getPlaceId())){
+//            return roomMapper.enableRoomById(roomId) + orderMapper.discardByRoomId(roomId);
+//        }
+//        throw new RuntimeException("场地和包厢不匹配");
+//    }
 
-        if (currentUser.getPlaceId().equals(currentRoom.getPlaceId())){
-            return roomMapper.useRoomById(roomId);
-        }
-        throw new RuntimeException("场地和包厢不匹配");
-    }
+//    @Transactional
+//    public int useRoomById(Long roomId) {
+//        User currentUser = userService.getUserById(Conv.NL(JwtHelper.getUserId()));
+//
+//        Room currentRoom = roomMapper.selectById(roomId);
+//
+//        if (currentUser.getPlaceId().equals(currentRoom.getPlaceId())){
+//            return roomMapper.useRoomById(roomId);
+//        }
+//        throw new RuntimeException("场地和包厢不匹配");
+//    }
 
     public Order getRoomOrderById(Long roomId) {
         return orderMapper.selectByRoomId(roomId);

+ 0 - 8
whepi-web/src/main/java/com/bofeng/wx/controller/CustAccountController.java

@@ -53,14 +53,6 @@ public class CustAccountController {
         return new ModelAndView("/cust/account.ftl", model);
     }
 
-    @PostMapping("/cust/update_account.json")
-    public ModelOps updateAccount(@RequestBody Map map) {
-//        Long userId = Conv.NL(map.get("userId"));
-//        String phone = (String)map.get("phone");
-//        String staffName = (String)map.get("staffName");
-        return ModelOps.newSuccess(userService.updateInfo(map));
-
-    }
 
     @GetMapping("/cust/modify_bind.json")
     public ModelOps unbind(@RequestParam(name = "userId") Long userId,

+ 4 - 4
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -64,10 +64,10 @@ public class UserOpenController {
                              @RequestParam(value = "userType", required = false,defaultValue = "0") Integer userType) throws JsonProcessingException {
         List<UserRole> list = new ArrayList<>();
         if (userId == 0) {
-            UserOpen userOpen = homeService.getUserOpen();
-            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
-//            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
-//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+//            UserOpen userOpen = homeService.getUserOpen();
+//            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
+            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user_id", "\""+userOpen.getUserId()+"\"");

+ 26 - 24
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -13,10 +13,12 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.yvan.Model;
 import com.yvan.ModelOps;
+import com.yvan.PageDb;
 import com.yvan.mvc.Pd;
 import com.yvan.platform.Conv;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.YvanUtil;
+import com.yvan.springmvc.HttpParameterParser;
 import io.swagger.annotations.ApiOperation;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -187,7 +189,7 @@ public class YeWeiHuiController {
         return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
     }
 
-    @GetMapping("/yeweihui/ribaohuiz")
+    @GetMapping("/epi/yeweihui/ribaohuiz")
     public Model<Map<String, Object>> yeweihuiRibaohuiz(Long userCreate,String reportDate) {
 //        Long userCreate = 1225321682867105793L;
 
@@ -214,18 +216,17 @@ public class YeWeiHuiController {
 
     }
 
-    @ApiOperation("导出家庭上报明细")
-    @GetMapping("/yeweihui/exportRiBao")
+    @ApiOperation("导出正常家庭上报明细")
+    @GetMapping("/whepi/epi/yeweihui/exportRiBao")
     @SneakyThrows
-    public void exportRiBao(@Pd(name = "userId") Long userId,
+    public void exportRiBao(@Pd(name = "uptownId") Long uptownId,
                             @Pd(name = "date") String date,
                             HttpServletResponse resp) {
 
-        List<Uptown> uptowns = rbMapper.selectUptown(userId);
-
-        if (uptowns!=null && uptowns.size()>0) {
-            Long upId = uptowns.get(0).getUptownId();
-            String fileName = uptowns.get(0).getUptownName();
+        Uptown uptown = uptownMapper.selectById(uptownId);
+        if (uptown!=null && uptown.getUptownId()>0) {
+            Long upId = uptown.getUptownId();
+            String fileName = uptown.getUptownName();
             fileName += "上报信息-";
             fileName += date;
             List<ExcelRiBao> list = rbMapper.selectExcelRiBao(upId,date);
@@ -233,15 +234,13 @@ public class YeWeiHuiController {
         }
     }
 
-    @ApiOperation("导出家庭上报明细")
-    @GetMapping("/epi/lun/exportRiBao")
+    @ApiOperation("导出凌云家庭上报明细")
+    @GetMapping("/whepi/epi/lun/exportRiBao")
     @SneakyThrows
-    public void lunExportRiBao(@Pd(name = "userId") Long userId,
-                            @Pd(name = "date") String date,
+    public void lunExportRiBao(@Pd(name = "date") String date,
                             HttpServletResponse resp) {
 
-        List<Uptown> uptowns = rbMapper.selectUptown(userId);
-
+        List<Uptown> uptowns = rbMapper.selectUptownByName("金湖家园");
         if (uptowns!=null && uptowns.size()>0) {
             Long upId = uptowns.get(0).getUptownId();
             String fileName = uptowns.get(0).getUptownName();
@@ -252,21 +251,19 @@ public class YeWeiHuiController {
         }
     }
 
-    @ApiOperation("导出家庭上报明细")
-    @GetMapping("/epi/yeweihui/EXR")
+    @ApiOperation("导出小区家庭上报明细")
+    @GetMapping("/whepi/epi/yeweihui/EXR")
     @SneakyThrows
-    public void exportRiBaoByXiaoQu(@Pd(name = "xid") Long xid,
-                            @Pd(name = "d") String d,
+    public void exportRiBaoByXiaoQu(@Pd(name = "uptownId") Long uptownId,
+                            @Pd(name = "date") String date,
                             HttpServletResponse resp) {
-
-        Uptown uptown = uptownMapper.selectById(xid);
-
+        Uptown uptown = uptownMapper.selectById(uptownId);
         if (uptown!=null && uptown.getUptownId()>0) {
             Long upId = uptown.getUptownId();
             String fileName = uptown.getUptownName();
             fileName += "上报信息-";
-            fileName += d;
-            List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId,d);
+            fileName += date;
+            List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId,date);
             ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
         }
     }
@@ -277,4 +274,9 @@ public class YeWeiHuiController {
 
         return new ModelAndView("/yeweihui/tgPublish.ftl", model);
     }
+
+    @PostMapping("/whepi/getAllUptown")
+    public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
+        return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));
+    }
 }

+ 2 - 2
whepi-web/src/main/resources/application.yml

@@ -43,10 +43,10 @@ endpoints:
 #  whitelabel.enabled: false
 
 spring:
-  profiles.active: guojing
+  profiles.active: peig
 
   application:
-    name: whepi-web
+    name: bofeng-web
 
   #mvc:
   #  throw-exception-if-no-handler-found: true

+ 14 - 0
whepi-web/src/main/resources/mapper/UptownMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.bofeng.dao.UptownMapper">
+    <select id="getUptowns" resultType="com.bofeng.entity.Uptown">
+        select * from sys_uptown
+        <where>
+            and status = 1
+            <if test="query!=null and query!=''">
+                and uptown_name like concat('%',#{query},'%')
+            </if>
+        </where>
+        order by time_create desc
+    </select>
+</mapper>

+ 2 - 28
whepi-web/src/main/resources/mapper/User.xml

@@ -2,42 +2,16 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.bofeng.dao.UserMapper">
 
-    <update id="updateLoginCount">
-      update tb_user set
-        login_count=login_count+1,
-        last_login_time=CURRENT_TIMESTAMP
-      where
-        user_id=#{user_id}
-    </update>
-
-    <select id="selectByLoginName" resultType="com.bofeng.entity.User">
-        select * from tb_user where login_name=#{login_name}
-    </select>
-
-    <select id="selectVersionById" resultType="java.lang.String">
-        select version from tb_user where user_id=#{user_id}
-    </select>
 
-    <select id="selectAll" resultType="com.bofeng.entity.User">
-        select a.*, b.place_name as placeName from tb_user a left join tb_place b on (a.place_id = b.place_id)
-    </select>
-
-    <update id="updateInfo">
-        update tb_user set
-        phone=#{phone},
-        staff_name=#{staffName}
-        where
-        user_id=#{userId}
-    </update>
 
     <update id="updatePassword">
-        update tb_user set
+        update sys_user set
         login_pwd=#{newPassword}
         where
         user_id=#{userId} and login_pwd = #{password}
     </update>
 
     <select id="checkLoginName" resultType="integer">
-select count(*) from tb_user u where u.user_id!=#{userId} and u.login_name=#{loginName}
+select count(*) from sys_user u where u.user_id!=#{userId} and u.login_name=#{loginName}
     </select>
 </mapper>

+ 12 - 0
yvan-platform/src/main/java/com/yvan/springmvc/HttpParameterParser.java

@@ -1,6 +1,7 @@
 package com.yvan.springmvc;
 
 import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -428,4 +429,15 @@ public class HttpParameterParser {
         }
         return sb.toString();
     }
+
+    /**
+     * 变成Map
+     */
+    public Map<String, Object> getMap() {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        for (String key : parameters.keySet()) {
+            map.put(key, getString(key));
+        }
+        return map;
+    }
 }