peiguo 5 роки тому
батько
коміт
4469ed564f

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

@@ -40,6 +40,14 @@
           "iconCls": "icon-blank fa fa-align-justify",
           "state": "close",
           "children": []
+        },
+        {
+          "id": "ENT100024",
+          "text": "特殊人员管理",
+          "href": "/app/whepi/scan/specialPersonnel.js",
+          "iconCls": "icon-blank fa fa-align-justify",
+          "state": "close",
+          "children": []
         }
       ]
     },

+ 102 - 0
admin-ui/app/whepi/scan/addOutUser.js

@@ -0,0 +1,102 @@
+define(function (require) {
+    return function (context) {
+
+        var $dlg, $form, isEdit = false;
+
+        return {
+            xtype: 'dialog',
+            dialogId: 'dialogEnvLog',
+            title: context.isEdit ? '编辑特殊人员信息' : '新增特殊人员信息',
+            width: 450,
+            height: 300,
+            onOpen: function () {
+                $dlg = $(this);
+                if (context.isEdit) {
+                    $.yvan.ajax({
+                        loadingMask: false,
+                        url: api('/qrImg/getDoorById'),
+                        type: 'GET',
+                        data: {tuId: context.tuId},
+                        success: function (data) {
+                            $dlg.find('form');
+                            $form.formSet(data.data);
+                        }
+                    });
+                }
+            },
+            center: {
+                items: {
+                    width: 450,
+                    height: 756,
+                    autoSizeColumns: true,
+                    xtype: 'formgroup',
+                    onRender: function () {
+                        $form = $(this);
+                    },
+                    items: [
+                        [
+                            {name: 'tuId', xtype: 'hidden'},
+                            {
+                                name: 'phone',
+                                label: '电话',
+                                required: true,
+                                validType: 'phoneNum',
+                                maxlength: 60,
+                                width: 350,
+                            },
+                            {
+                                name: 'name',
+                                label: '联系人姓名',
+                                required: true,
+                                maxlength: 60,
+                                width: 350,
+                            },
+                        ]
+                    ],
+                }
+            },
+            buttons: [
+                {
+                    text: "检查电话", iconCls: "fa fa-save", onClick: function () {
+                        var queryForm = $form.formGet();
+                        if (queryForm.phone == "") {
+                            $.yvan.msg('请先选输入电话号码');
+                            return;
+                        }
+                        $.yvan.ajax({
+                            url: api('/OutUser/getUptownHomeByPhone'),
+                            data: {phone: queryForm.phone},
+                            method: 'post',
+                            async: false,
+                            success: function (data) {
+                                if (data.data.linkman != null) {
+                                    $form.formSet({name: data.data.linkman});
+                                }
+                            }
+                        });
+                    }
+                },
+                {
+                    text: "保存", iconCls: "fa fa-save", onClick: function () {
+                        $.yvan.postForm($form, {
+                            url: api('/OutUser/saveOutUser'),
+                            success: function (data) {
+                                if (data.data == 1) {
+                                    $.yvan.msg('保存成功');
+                                    $dlg.window('close');
+                                    if ($.type(context.confirm) === 'function') {
+                                        context.confirm();
+                                    }
+                                }
+                            }
+                        });
+                    }
+                }, {
+                    text: "关闭", iconCls: "fa fa-times", onClick: function () {
+                        $dlg.dialog('close');
+                    }
+                }
+            ]
+        };
+    };
+});

+ 0 - 23
admin-ui/app/whepi/scan/qrImg.js

@@ -3,29 +3,6 @@ define(function (require) {
 
             var $grid1, $form;
 
-
-            //查询小区
-            function queryGrid2() {
-                var _datas = [];
-                $.yvan.ajax({
-                    async: false,
-                    method: 'post',
-                    url: api('/getAllUptown'),
-                    data: {userId: 0},
-                    success: function (data) {
-                        if (data.data != null && data.data != undefined) {
-                            for (var i = 0; i < data.data.length; i++) {
-                                _datas.push({
-                                    "id": data.data[i].uptownId,
-                                    "text": data.data[i].uptownName
-                                })
-                            }
-                        }
-                    }
-                });
-                return _datas;
-            }
-
             // 输入搜索文本后点击回车按钮查询列表
             function enterQueryGrid1(e) {
                 if (e.keyCode === 13) {

+ 173 - 0
admin-ui/app/whepi/scan/specialPersonnel.js

@@ -0,0 +1,173 @@
+define(function (require) {
+        return function (context) {
+
+            var $grid1, $form;
+
+            // 输入搜索文本后点击回车按钮查询列表
+            function enterQueryGrid1(e) {
+                if (e.keyCode === 13) {
+                    var tmp = $(this).val();
+                    $form.formSet({queryProperties: tmp});
+                    queryGrid1();
+                }
+            }
+
+            // 检索条件查询
+            function queryGrid1() {
+                var queryForm = $form.formGet();
+                $grid1.reload({
+                    mtype: 'POST',
+                    url: api('/OutUser/selectAllOutUser'),
+                    queryParams: queryForm
+                }, true);
+            }
+
+            var queryToolbar = {
+                xtype: 'toolbar',
+                title: '特殊人员详情',
+                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 queryForm = {
+                onRender: function () {
+                    $form = $(this);
+                },
+                xtype: 'form',
+                items: [[
+                    {
+                        xtype: 'textbox',
+                        label: '检索条件',
+                        name: 'queryProperties',
+                        prompt: "小区名称/联系人姓名",
+                        labelWidth: 'auto',
+                        events: {keydown: enterQueryGrid1}, width: 350
+                    },
+                    {
+                        xtype: 'textbox',
+                        label: '电话',
+                        name: 'phone',
+                        prompt: "小区名称",
+                        labelWidth: 'auto',
+                        events: {keydown: enterQueryGrid1}, width: 350
+                    },
+                ]]
+            };
+
+            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: {
+                                xtype: 'toolbar',
+                                title: '特殊人员详情',
+                                items: [
+                                    {
+                                        text: '添加', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
+                                            $.yvan.showDialog(this,
+                                                require('/app/whepi/scan/addOutUser.js')({
+                                                    isEdit: false,
+                                                    confirm: function () {
+                                                        queryGrid1();
+                                                    }
+                                                })
+                                            );
+                                        }
+                                    },
+                                    {
+                                        text: '删除', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
+                                            var row = $grid1.checkedData();
+                                            if (row.length == 0) {
+                                                $.yvan.msg('请至少选择一行数据');
+                                                return;
+                                            }
+                                            var ids = "";
+                                            for (var i=0; i<row.length; i++) {
+                                                ids += row[i].tuId + ","
+                                            }
+                                            $.yvan.ajax({
+                                                url: api('/OutUser/deleteOutUser'),
+                                                data: {ids: ids},
+                                                method: 'post',
+                                                async: false,
+                                                success: function (data) {
+                                                    queryGrid1();
+                                                }
+                                            });
+                                        }
+                                    }
+                                ]
+                            },
+                            multiselect: true, /// 表格多选
+                            idField: 'tuId',
+                            editable: true,
+                            editOnSelected: true,
+                            autoSizeColumns: true,
+                            columns:
+                                [
+                                    [
+                                        {field: 'tuId', title: '用户ID', hidden: true},
+                                        {field: 'userId', title: '用户ID', hidden: true},
+                                        {field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
+                                        {field: 'ridgepole', title: '栋', maxWidth: 200, align: 'left',},
+                                        {field: 'unit', title: '单元', maxWidth: 200, align: 'left',},
+                                        {field: 'name', title: '名字', maxWidth: 200, align: 'left',},
+                                        {field: 'phone', title: '电话', maxWidth: 200, align: 'left',},
+                                        {
+                                            field: 'startDateStr', title: '开始时间', minWidth: 120, maxWidth: 300, align: 'left', editor: {
+                                                xtype: 'datebox',
+                                                required: true,
+                                                onChange: function (value) {
+                                                    console.log(value)
+                                                },
+                                                maxlength: 50
+                                            }
+                                        },
+                                        {
+                                            field: 'endDateStr', title: '结束时间', minWidth: 120, maxWidth: 200, align: 'left', editor: {
+                                                xtype: 'datebox',
+                                                required: true,
+                                                onChange: function (value) {
+                                                    console.log(value)
+                                                },
+                                                maxlength: 50
+                                            }
+                                        },
+                                    ]
+                                ]
+                        }
+                }
+            };
+        };
+    }
+);

+ 3 - 1
whepi-doc/login.sql

@@ -210,13 +210,15 @@ CREATE TABLE out_scan  (
 DROP TABLE IF EXISTS out_user;
 CREATE TABLE out_user  (
   tu_id             bigint(20) NOT NULL DEFAULT 0 COMMENT '特殊ID',
+  name              varchar(100)  NOT NULL DEFAULT '' COMMENT '特殊人员姓名',
   phone             bigint(20) NOT NULL DEFAULT 0 COMMENT '电话号码',
   start_date        date NOT NULL DEFAULT '0000-01-01' COMMENT '开始时间',
   end_date          date NOT NULL DEFAULT '0000-01-01' COMMENT '结束时间',
   time              int(11) NOT NULL DEFAULT 0 COMMENT '总共时间(天)',
   time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
   time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
-  PRIMARY KEY (tu_id) USING BTREE
+  PRIMARY KEY (tu_id) USING BTREE,
+  UNIQUE INDEX phone(phone) USING BTREE
 ) ENGINE = InnoDB default charset=utf8mb4 comment = '进出扫码特殊人员';
 
 DROP TABLE IF EXISTS out_scan_estate;

+ 11 - 0
whepi-web/src/main/java/com/bofeng/dao/OutUserMapper.java

@@ -2,15 +2,26 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.OutUser;
+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
 public interface OutUserMapper extends BaseMapper<OutUser> {
 
+    @Select("SELECT * FROM out_user WHERE name = #{name} and phone = #{phone} and start_date <= curdate() and end_date >= curdate()")
+    OutUser getOutUserByPhone(@Param("name") String name, @Param("phone") Long phone);
+
     @Select("SELECT * FROM out_user WHERE phone = #{phone} and start_date <= curdate() and end_date >= curdate()")
     OutUser getOutUserByPhone(@Param("phone") Long phone);
+
+    List<OutUser> getAllOutUser(PageDb pageDb, Map<String, Object> queryParam);
+
+    Integer deleteOutUsers(@Param("ids") String ids);
 }

+ 23 - 1
whepi-web/src/main/java/com/bofeng/entity/OutUser.java

@@ -20,7 +20,11 @@ public class OutUser {
 
     @ApiModelProperty("特殊ID")
     @TableId("tu_id")
-    private Long tu_id;
+    private Long tuId;
+
+    @ApiModelProperty("特殊人员姓名")
+    @TableField("name")
+    private String name;
 
     @ApiModelProperty("电话号码")
     @TableField("phone")
@@ -43,4 +47,22 @@ public class OutUser {
 
     @TableField(exist = false)
     private DateTime timeUpdate;
+
+    @TableField(exist = false)
+    private Long userId;
+
+    @TableField(exist = false)
+    private String uptownName;
+
+    @TableField(exist = false)
+    private String ridgepole;
+
+    @TableField(exist = false)
+    private String unit;
+
+    @TableField(exist = false)
+    private String startDateStr;
+
+    @TableField(exist = false)
+    private String endDateStr;
 }

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

@@ -2,9 +2,7 @@ package com.bofeng.wx.controller;
 
 import cn.afterturn.easypoi.cache.manager.IFileLoader;
 import com.baomidou.mybatisplus.toolkit.IdWorker;
-import com.bofeng.dao.OutScanConfMapper;
-import com.bofeng.dao.UptownDoorMapper;
-import com.bofeng.dao.UptownMapper;
+import com.bofeng.dao.*;
 import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
 import com.bofeng.service.ScanAdminService;
@@ -38,6 +36,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.util.Date;
 import java.util.List;
 
 @Api("进出扫码后台信息")
@@ -53,6 +52,10 @@ public class ScanAdminController {
     private UptownMapper uptownMapper;
     @Autowired
     private ScanAdminService scanAdminService;
+    @Autowired
+    private OutUserMapper outUserMapper;
+    @Autowired
+    private UptownHomeMapper uptownHomeMapper;
 
     @ApiOperation("出入查询")
     @PostMapping("/whepi/sweepCode/selectCode")
@@ -85,6 +88,59 @@ public class ScanAdminController {
         ExcelUtils.writeSheet(OutScanEstate.class, outScanEstates).export(resp,"问询管理");
     }
 
+    @ApiOperation("特殊人员查询")
+    @PostMapping("/whepi/OutUser/selectAllOutUser")
+    public Model<List<OutUser>> selectAllOutUser(PageDb pageDb,HttpParameterParser parser) {
+        List<OutUser> outUsers = outUserMapper.getAllOutUser(pageDb,parser.getMap());
+        return Model.newSuccess(pageDb,outUsers);
+    }
+
+    @ApiOperation("检查电话号码")
+    @PostMapping("/whepi/OutUser/getUptownHomeByPhone")
+    public Model<UptownHome> getUptownHomeByPhone(@Pd(name = "phone") String phone) {
+        List<UptownHome> outUsers = uptownHomeMapper.getUptownHomeByPhone(phone);
+        if (outUsers.size() > 0) {
+            return Model.newSuccess(outUsers.get(0));
+        } else {
+            return Model.newFail("该号码并未注册");
+        }
+    }
+
+    @ApiOperation("更改特殊人员的时间")
+    @PostMapping("/whepi/OutUser/updateTime")
+    public Model<UptownHome> updateTime(@Pd(name = "phone") String phone) {
+        List<UptownHome> uptownHomes = uptownHomeMapper.getUptownHomeByPhone(phone);
+        if (uptownHomes.size() > 0) {
+            return Model.newSuccess(uptownHomes.get(0));
+        } else {
+            return Model.newFail("该号码并未注册");
+        }
+    }
+
+    @ApiOperation("保存特殊人员")
+    @PostMapping("/whepi/OutUser/saveOutUser")
+    public Model saveOutUser(@JsonBody OutUser outUser) {
+        OutUser outUser1 = outUserMapper.getOutUserByPhone(outUser.getPhone());
+        if (outUser1 != null) {
+            return Model.newFail("该号码已经添加为特殊人员,请仔细检查该号码。");
+        }
+        List<UptownHome> uptownHomes = uptownHomeMapper.getUptownHomeByPhone(outUser.getPhone().toString());
+        if (uptownHomes.size() > 0) {
+            outUser.setName(uptownHomes.get(0).getLinkman());
+        }
+        outUser.setTuId(IdWorker.getId());
+        outUser.setStartDate(new Date());
+        outUser.setEndDate(new Date());
+        outUser.setTime(1);
+        return Model.newSuccess(outUserMapper.insert(outUser));
+    }
+
+    @ApiOperation("删除特殊人员的时间")
+    @PostMapping("/whepi/OutUser/deleteOutUser")
+    public Model deleteOutUser(@Pd(name = "ids") String ids) {
+        return Model.newSuccess(outUserMapper.deleteOutUsers(ids));
+    }
+
     @ApiOperation("小区进出二维码")
     @PostMapping("/whepi/qrImg/scanQrImg")
     public Model<List<UptownDoor>> scanQrImg(HttpParameterParser parser, PageDb pagination) throws IOException, WriterException {

+ 3 - 3
whepi-web/src/main/java/com/bofeng/wx/controller/ScanController.java

@@ -125,7 +125,7 @@ public class ScanController {
                 }
             }
             if (inType == 2) {
-                OutUser outUser = outUserMapper.getOutUserByPhone(Long.parseLong(uptownHomes.get(0).getPhone()));
+                OutUser outUser = outUserMapper.getOutUserByPhone(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
                 if (outUser != null) {
                     model.put("collor", "green");
                     model.put("into", "允许通行");
@@ -210,7 +210,7 @@ public class ScanController {
                 model.put("errorMsg", "您最近一分钟已经扫码,本次扫码重复。");
                 return new ModelAndView("/user/scanEstate.ftl", model);
             }
-            OutUser outUser = outUserMapper.getOutUserByPhone(Long.parseLong(uptownHomes.get(0).getPhone()));
+            OutUser outUser = outUserMapper.getOutUserByPhone(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
             if (outUser != null) {
                 model.put("collor", "green");
                 model.put("into", "允许通行");
@@ -289,7 +289,7 @@ public class ScanController {
             model.put("name", uptownHomes.get(0).getLinkman());
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
             model.put("now", sdf.format(new Date()));
-            OutUser outUser = outUserMapper.getOutUserByPhone(Long.parseLong(uptownHomes.get(0).getPhone()));
+            OutUser outUser = outUserMapper.getOutUserByPhone(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
             if (outUser != null) {
                 model.put("collor", "green");
                 model.put("into", "允许外出");

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

@@ -8,7 +8,7 @@
         d.ridgepole,
         d.unit,
         e.doorplate,
-        DATE_FORMAT(ce.scan_date,'%y-%m-%d %h:%i:%s') as date,
+        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,
@@ -42,7 +42,7 @@
         d.ridgepole,
         d.unit,
         e.doorplate,
-        DATE_FORMAT(ce.scan_date,'%y-%m-%d %h:%i:%s') as date,
+        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,

+ 37 - 0
whepi-web/src/main/resources/mapper/OutUserMapper.xml

@@ -0,0 +1,37 @@
+<?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.OutUserMapper">
+
+    <select id="getAllOutUser" resultType="com.bofeng.entity.OutUser">
+        select u.tu_id,ur.user_id as userId,su.uptown_name as uptownName,uu.ridgepole,uu.unit,u.name,u.phone,
+        DATE_FORMAT(u.start_date,'%Y-%m-%d') as startDateStr,DATE_FORMAT(u.end_date,'%Y-%m-%d') as endDateStr
+        from out_user u
+        left join sys_uptown_home uh on uh.phone = u.phone and uh.linkman = u.name
+        left join sys_user_role ur on ur.property_id = uh.house_id and ur.role_id = 1
+        left join sys_uptown_house suh on suh.house_id = uh.house_id
+        left join sys_uptown_unit uu on uu.unit_id = suh.unit_id
+        left join sys_uptown su on su.uptown_id = uu.uptown_id
+        <where>
+            <if test="queryProperties != null and queryProperties != ''">
+                (
+                su.uptown_name like concat('%',#{queryProperties},'%')
+                or u.name like concat('%',#{queryProperties},'%')
+                )
+            </if>
+            <if test="phone != null and phone !=''">
+                and u.phone = #{phone}
+            </if>
+        </where>
+        order by u.time_update desc
+    </select>
+
+    <delete id="deleteOutUsers">
+        delete  from out_user
+        WHERE tu_id in
+        <foreach item="id" index="index" collection="ids.split(',')" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+
+
+</mapper>

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

@@ -8,7 +8,7 @@
      d.unit,
      e.doorplate,
      b.door_name,
-     DATE_FORMAT(c.date,'%y-%m-%d %h:%i:%s') as date,
+     DATE_FORMAT(c.date,'%Y-%m-%d %H:%i:%s') as date,
      c.in_type,
      c.go_status as goStatus,
      c.error_info as errorInfo,
@@ -45,7 +45,7 @@
      d.unit,
      e.doorplate,
      b.door_name,
-     DATE_FORMAT(c.date,'%y-%m-%d %h:%i:%s') as date,
+     DATE_FORMAT(c.date,'%Y-%m-%d %H:%i:%s') as date,
      c.in_type,
      c.go_status as goStatus,
      c.error_info as errorInfo,