Quellcode durchsuchen

巡检扫码记录

peiguo vor 5 Jahren
Ursprung
Commit
51304ad5bb

+ 9 - 1
admin-ui/app/whepi/mock/menu.json

@@ -27,11 +27,19 @@
         },
         {
           "id": "ENT100022",
-          "text": "小区管理",
+          "text": "小区出入记录",
           "href": "/app/whepi/scan/xqmanage.js",
           "iconCls": "icon-blank fa fa-align-justify",
           "state": "close",
           "children": []
+        },
+        {
+          "id": "ENT100023",
+          "text": "巡检扫码记录",
+          "href": "/app/whepi/scan/xunJian.js",
+          "iconCls": "icon-blank fa fa-align-justify",
+          "state": "close",
+          "children": []
         }
       ]
     },

+ 211 - 0
admin-ui/app/whepi/scan/xunJian.js

@@ -0,0 +1,211 @@
+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/exportXunJian?queryProperties=' + queryForm.queryProperties + '&goStatus=' + queryForm.goStatus + '&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/selectXunJian';// 自行替换此参数
+                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: 'yvselect', label: '通行状态', name: 'goStatus', labelWidth: 'auto', value: '', width: 220,
+                        data: [
+                            {id: '1', text: '允许'},
+                            {id: '-1', text: '禁止'},
+                        ],
+                        onChange: function () {
+                            queryGrid1();
+                        }
+                    },
+                    {
+                        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: 'phone',
+                                            title: '电话',
+                                        },
+                                        {
+                                            field: 'date',
+                                            title: '问询时间',
+                                            align: 'left',
+                                        },
+                                        {
+                                            field: 'goStatus',
+                                            title: '通行状态',
+                                            align: 'center',
+                                            formatter:function (value) {
+                                                if(value==1){
+                                                    return "允许"
+                                                }else if(value ==-1){
+                                                    return "禁止"
+                                                }
+
+                                            }
+                                        },
+                                        {
+                                            field: 'errorInfo',
+                                            title: '禁止提示',
+                                            align: 'left',
+                                        },
+
+                                    ]
+                                ]
+                        }
+                }
+            };
+        };
+    }
+);

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

@@ -2,12 +2,14 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.OutScanEstate;
+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
@@ -28,4 +30,8 @@ public interface OutScanEstateMapper extends BaseMapper<OutScanEstate> {
      */
     @Select("SELECT * FROM out_scan_estate WHERE user_id = #{userId} and go_status = 1 order by time_create desc LIMIT 1")
     OutScanEstate getOutScanEstatLately(@Param("userId") Long userId);
+
+    List<OutScanEstate> selectXunJian(PageDb pageDb, Map<String, Object> queryParam);
+
+    List<OutScanEstate> exportXunJian(Map<String, Object> queryParam);
 }

+ 35 - 0
whepi-web/src/main/java/com/bofeng/entity/OutScanEstate.java

@@ -1,5 +1,6 @@
 package com.bofeng.entity;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
@@ -38,6 +39,7 @@ public class OutScanEstate {
     @TableField("go_status")
     private Integer goStatus;
 
+    @ExcelProperty(value = {"禁止提示"}, index = 8)
     @ApiModelProperty("错误信息")
     @TableField("error_info")
     private String errorInfo;
@@ -53,4 +55,37 @@ public class OutScanEstate {
 
     @TableField(exist = false)
     private DateTime timeUpdate;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"小区名称"}, index = 0)
+    private String uptownName;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"楼栋"}, index = 1)
+    private String ridgepole;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"单元"}, index = 2)
+    private String unit;
+
+    @TableField("doorplate")
+    @ExcelProperty(value = {"房间号"}, index = 3)
+    private String doorplate;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"用户名"}, index = 4)
+    private String linkman;
+
+    @TableField(exist = false)
+    @ExcelProperty(value = {"电话"}, index = 5)
+    private String phone;
+
+    @ExcelProperty(value = {"问询时间"}, index = 6)
+    @TableField("date")
+    private String date;
+
+    @ExcelProperty(value = {"通行状态"}, index = 7)
+    @ApiModelProperty("通行状态:1允许,-1禁止")
+    @TableField(exist = false)
+    private String goStatusStr;
 }

+ 24 - 2
whepi-web/src/main/java/com/bofeng/service/SweepCodeService.java

@@ -1,7 +1,9 @@
 package com.bofeng.service;
 
 
+import com.bofeng.dao.OutScanEstateMapper;
 import com.bofeng.dao.SweepCodeMapper;
+import com.bofeng.entity.OutScanEstate;
 import com.bofeng.entity.SysUptownHouse;
 import com.yvan.PageDb;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,11 +19,12 @@ public class SweepCodeService {
 
     @Autowired
     private SweepCodeMapper sweepCodeMapper;
+    @Autowired
+    private OutScanEstateMapper outScanEstateMapper;
 
 
     public List<SysUptownHouse> selectCode(PageDb pageDb, Map<String, Object> queryParam) {
         List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(pageDb,queryParam);
-
         return sysUptownHouses;
     }
 
@@ -42,7 +45,26 @@ public class SweepCodeService {
                 }
             }
         }
-
         return sysUptownHouses;
     }
+
+    public List<OutScanEstate> selectXunJian(PageDb pageDb, Map<String, Object> queryParam) {
+        List<OutScanEstate> outScanEstates = outScanEstateMapper.selectXunJian(pageDb,queryParam);
+        return outScanEstates;
+    }
+
+
+    public List<OutScanEstate> exportXunJian(Map<String, Object> queryParam) {
+        List<OutScanEstate> outScanEstates = outScanEstateMapper.exportXunJian(queryParam);
+        if(outScanEstates.size() != 0){
+            for (int i = 0; i < outScanEstates.size(); i++) {
+                if(outScanEstates.get(i).getGoStatus() == 1 ){
+                    outScanEstates.get(i).setGoStatusStr("允许");
+                }else if(outScanEstates.get(i).getGoStatus() == -1 ){
+                    outScanEstates.get(i).setGoStatusStr("禁止");
+                }
+            }
+        }
+        return outScanEstates;
+    }
 }

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

@@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.OutScanConfMapper;
 import com.bofeng.dao.UptownDoorMapper;
 import com.bofeng.dao.UptownMapper;
-import com.bofeng.entity.OutScanConf;
-import com.bofeng.entity.SysUptownHouse;
-import com.bofeng.entity.Uptown;
-import com.bofeng.entity.UptownDoor;
+import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
 import com.bofeng.service.ScanAdminService;
 import com.bofeng.service.SweepCodeService;
@@ -73,6 +70,21 @@ public class ScanAdminController {
         ExcelUtils.writeSheet(SysUptownHouse.class, sysUptownHouses).export(resp,"出入管理");
     }
 
+    @ApiOperation("出入查询")
+    @PostMapping("/whepi/sweepCode/selectXunJian")
+    public Model<List<OutScanEstate>> selectXunJian(PageDb pageDb,HttpParameterParser parser) {
+        List<OutScanEstate> outScanEstates = sweepCodeService.selectXunJian(pageDb,parser.getMap());
+        return Model.newSuccess(pageDb,outScanEstates);
+    }
+
+    @ApiOperation("导出")
+    @PostMapping("/whepi/sweepCode/exportXunJian")
+    @SneakyThrows
+    public void exportXunJian(HttpParameterParser parser,HttpServletResponse resp) {
+        List<OutScanEstate> outScanEstates = sweepCodeService.exportXunJian(parser.getMap());
+        ExcelUtils.writeSheet(OutScanEstate.class, outScanEstates).export(resp,"问询管理");
+    }
+
     @ApiOperation("小区进出二维码")
     @PostMapping("/whepi/qrImg/scanQrImg")
     public Model<List<UptownDoor>> scanQrImg(HttpParameterParser parser, PageDb pagination) throws IOException, WriterException {

+ 75 - 0
whepi-web/src/main/resources/mapper/OutScanEstateMapper.xml

@@ -0,0 +1,75 @@
+<?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.OutScanEstateMapper">
+
+    <select id="selectXunJian" resultType="com.bofeng.entity.OutScanEstate">
+        select
+        a.uptown_name,
+        d.ridgepole,
+        d.unit,
+        e.doorplate,
+        DATE_FORMAT(ce.scan_date,'%y-%m-%d %h:%i:%s') as date,
+        ce.go_status as goStatus,
+        ce.error_info as errorInfo,
+        g.linkman,
+        g.phone,
+        ce.time_update
+        from out_scan_estate ce
+        inner join sys_user_role t on ce.user_id = t.user_id and role_id =1
+        inner join sys_uptown_house e on e.house_id = t.property_id
+        inner join sys_uptown_home g on g.house_id = t.property_id
+        inner join sys_uptown_unit d on d.unit_id = e.unit_id
+        inner join sys_uptown a on d.uptown_id = a.uptown_id
+        <where>
+            <if test="queryProperties != null and queryProperties != ''">
+                a.uptown_name like concat('%',#{queryProperties},'%')
+            </if>
+            <if test="goStatus != null and goStatus !=''">
+                and ce.go_status = #{goStatus}
+            </if>
+            <if test="dateSta != null and dateSta !=''">
+                and ce.scan_date >= #{dateSta}
+            </if>
+            <if test="dateEnd != null and dateEnd !=''">
+                and ce.scan_date &lt; #{dateEnd}
+            </if>
+        </where>
+        order by ce.time_update desc
+    </select>
+    <select id="exportXunJian" resultType="com.bofeng.entity.OutScanEstate">
+        select
+        a.uptown_name,
+        d.ridgepole,
+        d.unit,
+        e.doorplate,
+        DATE_FORMAT(ce.scan_date,'%y-%m-%d %h:%i:%s') as date,
+        ce.go_status as goStatus,
+        ce.error_info as errorInfo,
+        g.linkman,
+        g.phone,
+        ce.time_update
+        from out_scan_estate ce
+        inner join sys_user_role t on ce.user_id = t.user_id and role_id =1
+        inner join sys_uptown_house e on e.house_id = t.property_id
+        inner join sys_uptown_home g on g.house_id = t.property_id
+        inner join sys_uptown_unit d on d.unit_id = e.unit_id
+        inner join sys_uptown a on d.uptown_id = a.uptown_id
+        <where>
+            <if test="queryProperties != null and queryProperties != ''">
+                a.uptown_name like concat('%',#{queryProperties},'%')
+            </if>
+            <if test="goStatus != null and goStatus !=''">
+                and ce.go_status = #{goStatus}
+            </if>
+            <if test="dateSta != null and dateSta !=''">
+                and ce.scan_date >= #{dateSta}
+            </if>
+            <if test="dateEnd != null and dateEnd !=''">
+                and ce.scan_date &lt; #{dateEnd}
+            </if>
+        </where>
+        order by ce.time_update desc
+    </select>
+
+
+</mapper>