Browse Source

进出管理

maoyunfeng 5 years ago
parent
commit
01d5861c5d

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

@@ -24,6 +24,14 @@
           "iconCls": "icon-blank fa fa-align-justify",
           "state": "close",
           "children": []
+        },
+        {
+          "id": "ENT100022",
+          "text": "小区管理",
+          "href": "/app/whepi/scan/xqmanage.js",
+          "iconCls": "icon-blank fa fa-align-justify",
+          "state": "close",
+          "children": []
         }
       ]
     },

+ 197 - 0
admin-ui/app/whepi/scan/xqmanage.js

@@ -0,0 +1,197 @@
+define(function (require) {
+        return function (context) {
+
+            var $grid1, $form;
+
+
+            // 导出
+            function exportExcel() {
+                var row = $grid1.rowData();
+                if (!row) {
+                    $.yvan.msg('请先选择一行数据');
+                    return;
+                }
+                var queryForm = $form.formGet();
+                $.yvan.download({
+                    method: 'post',
+                    url: api('/sweepCode/export?queryProperties=' + queryForm.queryProperties + '&dateSta=' + queryForm.dateSta + '&dateEnd=' + queryForm.dateEnd),
+                    fileName: '进出管理-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
+
+                });
+            }
+
+            // 输入搜索文本后点击回车按钮查询列表
+            function enterQueryGrid1(e) {
+                if (e.keyCode === 13) {
+                    var tmp = $(this).val();
+                    $form.formSet({queryProperties: tmp});
+                    queryGrid1();
+                }
+            }
+
+            // 检索条件查询
+            function queryGrid1() {
+                var queryUrl = '/sweepCode/selectCode';// 自行替换此参数
+                var queryForm = $form.formGet();
+                queryForm.roleCode = App.currentRoleCode;
+                $grid1.reload({
+                    mtype: 'POST',
+                    url: api(queryUrl),
+                    queryParams: queryForm
+                }, true);
+            }
+
+            // 搜索按钮
+            var queryToolbarTitle = '进出管理';// 自行替换此参数
+            var queryToolbar = {
+                xtype: 'toolbar', title: queryToolbarTitle, items: [
+                    {
+                        text: '查询', iconCls: 'fa fa-search', onClick: function () {
+                            queryGrid1();
+                        }
+                    }, {
+                        text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
+                            $form.formClear();
+                            queryGrid1();
+                        }
+                    }, {
+                        text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
+                            App.closeMe(this);
+                        }
+                    }
+                ]
+            };
+
+            // 搜索条件
+            var queryFormPrompt = '名称';// 自行替换此参数
+            var queryForm = {
+                onRender: function () {
+                    $form = $(this);
+                },
+                xtype: 'form',
+                items: [[
+                    {
+                        xtype: 'textbox',
+                        label: '小区名称',
+                        name: 'queryProperties',
+                        prompt: queryFormPrompt,
+                        labelWidth: 'auto',
+                        events: {keydown: enterQueryGrid1}, width: 350
+                    },
+                    {
+                        xtype: 'datebox',
+                        name: 'dateSta',
+                        label: '进出时间',
+                        labelWidth: 'auto',
+                        width: 230,
+                        onChange: function (data) {
+                          /*  var expDateStart = $form.formGet().nextRepairDate;
+                            var expDateEnd = $form.formGet().expDateEnd;
+                            var expDateStart = new Date(expDateStart.replace("-", "/"));
+                            var expDateEnd = new Date(expDateEnd.replace("-", "/"));
+                            if (expDateStart > expDateEnd) {
+                                $.yvan.msg('起止日期必须大于起始日期');
+                                return;
+                            }*/
+                        }
+                    },
+                    {
+                        xtype: 'datebox', label: '--', name: 'dateEnd', labelWidth: 'auto', width: 180,
+                        onChange: function (data) {
+                           /* var expDateStart = $form.formGet().nextRepairDate;
+                            var expDateEnd = $form.formGet().expDateEnd;
+                            var expDateStart = new Date(expDateStart.replace("-", "/"));
+                            var expDateEnd = new Date(expDateEnd.replace("-", "/"));
+                            if (expDateStart > expDateEnd) {
+                                $.yvan.msg('起止日期必须大于起始日期');
+                                return;
+                            }*/
+                        }
+                    }
+                ]]
+            };
+
+            var gridToolbarTitle = '出入列表';// 自行替换此参数
+            var gridToolbar = {
+                xtype: 'toolbar',
+                title: gridToolbarTitle,
+                items: [
+                    {
+                        text: '导出', iconCls: 'fa fa-cloud-upload', onClick: function () {
+                            exportExcel();
+                        }
+                    },
+                ]
+            };
+
+            return {
+                north: {
+                    height: 88,
+                    /* split: true,
+                     border: false,*///底框是否可变动
+                    items: [
+                        queryToolbar,
+                        queryForm
+                    ]
+                },
+                center: {
+                    height: '60%',
+                    split: true,
+                    items:
+                        {
+                            onRender: function () {
+                                $grid1 = $(this);
+                                queryGrid1()
+                            },
+                            xtype: 'grid',
+                            toolbar:
+                            gridToolbar,
+                            idField: 'joId',
+                            autoSizeColumns: true,//序号多  正确显示
+                            columns:
+                                [
+                                    [
+                                        {field: 'uptownId', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
+                                        {field: 'uptownName', title: '小区名称', maxWidth: 200, align: 'left',},
+                                        {field: 'ridgepole', title: '楼栋', maxWidth: 200, align: 'left',},
+                                        {field: 'unit', title: '单元', maxWidth: 200,},
+                                        {
+                                            field: 'doorplate',
+                                            title: '房间号', maxWidth: 200,
+                                        },
+                                        {
+                                            field: 'linkman',
+                                            title: '用户名',
+                                        },
+                                        {
+                                            field: 'doorName',
+                                            title: '小区大门',
+                                            align: 'left',
+                                        },
+                                        {
+                                            field: 'date',
+                                            title: '进出时间',
+                                            align: 'left',
+                                        },
+                                        {
+                                            field: 'inType',
+                                            title: '记录状态',
+                                            align: 'center',
+                                            formatter:function (value) {
+                                                if(value==1){
+                                                    return "进入"
+                                                }else if(value ==2){
+                                                    return "外出"
+                                                }
+
+                                            }
+                                        }
+
+                                    ]
+                                ]
+                        }
+                }
+            };
+        };
+    }
+);

+ 2 - 1
whepi-web/src/main/java/com/bofeng/dao/SweepCodeMapper.java

@@ -1,6 +1,7 @@
 package com.bofeng.dao;
 
 import com.bofeng.entity.SysUptownHouse;
+import com.yvan.PageDb;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
@@ -10,5 +11,5 @@ import java.util.Map;
 @Mapper
 @Repository
 public interface SweepCodeMapper {
-    List<SysUptownHouse> selectCode(Map<String, Object> queryParam);
+    List<SysUptownHouse> selectCode(PageDb pageDb, Map<String, Object> queryParam);
 }

+ 8 - 5
whepi-web/src/main/java/com/bofeng/entity/SysUptownHouse.java

@@ -62,16 +62,19 @@ public class SysUptownHouse implements Serializable {
     private String doorName;
 
     @TableField(exist = false)
-    @ExcelProperty(value = {"进时间"}, index = 6)
-    private String intoDate;
+    @ExcelProperty(value = {"进时间"}, index = 6)
+    private String date;
 
     @TableField(exist = false)
-    @ExcelProperty(value = {"外出时间"}, index = 7)
-    private String outDate;
+    private Integer inType;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"记录状态"}, index = 7)
+    private String inTypeStr;
 
     @TableField(exist = false)
     @ExcelProperty(value = {"用户名"}, index = 4)
-    private String nickName;
+    private String linkman;
 
     @TableField(exist = false)
     private String jcStatus;

+ 10 - 3
whepi-web/src/main/java/com/bofeng/service/SweepCodeService.java

@@ -3,6 +3,7 @@ package com.bofeng.service;
 
 import com.bofeng.dao.SweepCodeMapper;
 import com.bofeng.entity.SysUptownHouse;
+import com.yvan.PageDb;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -18,9 +19,15 @@ public class SweepCodeService {
     private SweepCodeMapper sweepCodeMapper;
 
 
-    public List<SysUptownHouse> selectCode(Map<String, Object> queryParam) {
-        List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(queryParam);
-
+    public List<SysUptownHouse> selectCode(PageDb pageDb, Map<String, Object> queryParam) {
+        List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(pageDb,queryParam);
+        for (int i = 0; i < sysUptownHouses.size(); i++) {
+            if(sysUptownHouses.get(i).getInType() == 1 ){
+                sysUptownHouses.get(i).setInTypeStr("进入");
+            }else if(sysUptownHouses.get(i).getInType() == 2 ){
+                sysUptownHouses.get(i).setInTypeStr("外出");
+            }
+        }
         return sysUptownHouses;
     }
 }

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

@@ -43,19 +43,19 @@ public class ScanAdminController {
     private UptownDoorMapper uptownDoorMapper;
 
     @ApiOperation("出入查询")
-    @GetMapping("/whepi/sweepCode/selectCode")
-    public Model<List<SysUptownHouse>> selectCode(HttpParameterParser parser) {
+    @PostMapping("/whepi/sweepCode/selectCode")
+    public Model<List<SysUptownHouse>> selectCode(PageDb pageDb,HttpParameterParser parser) {
 //        HttpServletResponse response,HttpServletRequest request
-        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
-        return Model.newSuccess(sysUptownHouses);
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(pageDb,parser.getMap());
+        return Model.newSuccess(pageDb,sysUptownHouses);
     }
 
     @ApiOperation("导出")
-    @GetMapping("/whepi/sweepCode/export")
+    @PostMapping("/whepi/sweepCode/export")
     @SneakyThrows
-    public void export(HttpParameterParser parser,HttpServletResponse resp) {
-        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
-        ExcelUtils.writeSheet(SysUptownHouse.class, sysUptownHouses).export(resp,"扫码导出");
+    public void export(HttpParameterParser parser,HttpServletResponse resp,PageDb pageDb) {
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(pageDb,parser.getMap());
+        ExcelUtils.writeSheet(SysUptownHouse.class, sysUptownHouses).export(resp,"出入管理");
     }
 
     @ApiOperation("小区进出二维码")

+ 21 - 29
whepi-web/src/main/resources/mapper/SweepCodeMapper.xml

@@ -2,38 +2,30 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.bofeng.dao.SweepCodeMapper">
     <select id="selectCode" resultType="com.bofeng.entity.SysUptownHouse">
-       select
-        a.uptown_name,
-        d.ridgepole,
-        d.unit,
-        e.doorplate,
-        b.door_name,
-        c.into_date,
-        h.out_date,
-        g.nick_name
-        from sys_uptown a
-        inner join sys_uptown_door b on a.uptown_id = b.uptown_id
-        inner join out_scan c on c.into_door_id = b.door_id
-        inner join out_scan h on h.out_door_id = b.door_id
-        inner join sys_uptown_unit d on d.uptown_id = a.uptown_id
-        inner join sys_uptown_house e on e.unit_id = d.unit_id
-        inner join sys_user_role j on j.property_id = e.house_id and j.role_id = 1
-        inner join sys_user_open g on g.user_id = j.user_id
+     select
+     a.uptown_name,
+     d.ridgepole,
+     d.unit,
+     e.doorplate,
+     b.door_name,
+     c.date,
+     c.in_type,
+     g.linkman
+     from sys_uptown a
+     inner join sys_uptown_door b on a.uptown_id = b.uptown_id
+     inner join out_scan c on c.door_id = b.door_id
+     inner join sys_uptown_unit d on d.uptown_id = a.uptown_id
+     inner join sys_uptown_house e on e.unit_id = d.unit_id
+     inner join sys_uptown_home g on g.house_id = e.house_id
         <where>
-         <if test="uptownName != null and uptownName != ''">
-          a.uptown_name like concat('%',#{uptownName},'%')
+         <if test="queryProperties != null and queryProperties != ''">
+          a.uptown_name like concat('%',#{queryProperties},'%')
          </if>
-         <if test="intoDate != null and intoDate !=''">
-          and c.into_date >= #{intoDate}
+         <if test="dateSta != null and dateSta !=''">
+          and c.date >= #{dateSta}
          </if>
-         <if test="intoDate != null and intoDate !=''">
-          and c.into_date &lt; #{intoDate}
-         </if>
-         <if test="outDate != null and outDate !=''">
-          and h.out_date &lt; #{outDate}
-         </if>
-         <if test="outDate != null and outDate !=''">
-          and h.out_date >= #{outDate}
+         <if test="dateEnd != null and dateEnd !=''">
+          and c.date &lt; #{dateEnd}
          </if>
         </where>
     </select>