Преглед на файлове

凌云集团更改公司

peiguo преди 5 години
родител
ревизия
c074c1bc86

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

@@ -60,7 +60,7 @@
         {
           "id": "ENT100026",
           "text": "凌云特殊人员管理",
-          "href": "/app/whepi/scan/specialPersonnel.js",
+          "href": "/app/whepi/scan/specialPersonnelLY.js",
           "iconCls": "icon-blank fa fa-align-justify",
           "state": "close",
           "children": []

+ 102 - 0
admin-ui/app/whepi/scan/addOutUserLY.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/saveOutUserLY'),
+                            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');
+                    }
+                }
+            ]
+        };
+    };
+});

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

@@ -15,6 +15,7 @@ define(function (require) {
             // 检索条件查询
             function queryGrid1() {
                 var queryForm = $form.formGet();
+                queryForm.tuType = 2;
                 $grid1.reload({
                     mtype: 'POST',
                     url: api('/OutUser/selectAllOutUser'),
@@ -178,6 +179,7 @@ define(function (require) {
                                         {field: 'unit', title: '单元', maxWidth: 200, align: 'left',},
                                         {field: 'name', title: '名字', maxWidth: 200, align: 'left',},
                                         {field: 'phone', title: '电话', maxWidth: 200, align: 'left',},
+                                        {field: 'doorplate', title: '门牌', maxWidth: 200, align: 'left',},
                                         {
                                             field: 'startDateStr', title: '开始时间', minWidth: 120, maxWidth: 300, align: 'left', editor: {
                                                 xtype: 'datebox',

+ 208 - 0
admin-ui/app/whepi/scan/specialPersonnelLY.js

@@ -0,0 +1,208 @@
+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();
+                queryForm.tuType = 1;
+                $grid1.reload({
+                    mtype: 'POST',
+                    url: api('/OutUser/selectAllOutUserLY'),
+                    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/addOutUserLY.js')({
+                                                    isEdit: false,
+                                                    confirm: function () {
+                                                        queryGrid1();
+                                                    }
+                                                })
+                                            );
+                                        }
+                                    },
+                                    {
+                                        text: '保存', iconCls: 'fa fa-pencil-square-o', onClick: function () {
+                                            var row = $grid1.rowData();
+                                            if (!row) {
+                                                $.yvan.msg('请选择一条要保存的数据');
+                                                return;
+                                            }
+                                            var startDateStr = row.startDateStr;
+                                            var endDateStr = row.endDateStr;
+                                            if (startDateStr > endDateStr) {
+                                                $.yvan.msg('开始时间必须小于等于结束时间');
+                                                return;
+                                            }
+                                            $.yvan.ajax({
+                                                url: api('/OutUser/updateOutUser'),
+                                                data: {
+                                                    tuId: row.tuId,
+                                                    startDate: row.startDateStr,
+                                                    endDate: row.endDateStr
+                                                },
+                                                method: 'post',
+                                                async: false,
+                                                success: function (data) {
+                                                    $.yvan.msg("操作成功");
+                                                    $grid1.reload();
+                                                    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.confirm('确定删除勾选的这' + row.length + '条特殊人员吗?', {
+                                                yes: function (index) {
+                                                    $.yvan.ajax({
+                                                        method: 'post',
+                                                        url: api('/OutUser/deleteOutUser'),
+                                                        data: {ids: ids},
+                                                        success: function (data) {
+                                                            $.yvan.msg("删除成功");
+                                                            $grid1.reload();
+                                                            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: 'unit', title: '部门', maxWidth: 200, align: 'left',},
+                                        {field: 'name', title: '名字', maxWidth: 200, align: 'left',},
+                                        {field: 'phone', title: '电话', maxWidth: 200, align: 'left',},
+                                        {field: 'doorplate', 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
+                                            }
+                                        },
+                                    ]
+                                ]
+                        }
+                }
+            };
+        };
+    }
+);

+ 2 - 1
whepi-doc/login.sql

@@ -210,6 +210,7 @@ CREATE TABLE out_scan  (
 DROP TABLE IF EXISTS out_user;
 CREATE TABLE out_user  (
   tu_id             bigint(20) NOT NULL DEFAULT 0 COMMENT '特殊ID',
+  tu_type           int(11) NOT NULL DEFAULT 0 COMMENT '特殊人员类型:1凌云,2非凌云',
   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 '开始时间',
@@ -218,7 +219,7 @@ CREATE TABLE out_user  (
   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,
-  UNIQUE INDEX phone(phone) USING BTREE
+  UNIQUE INDEX phone(phone, tu_type) USING BTREE
 ) ENGINE = InnoDB default charset=utf8mb4 comment = '进出扫码特殊人员';
 
 DROP TABLE IF EXISTS out_scan_estate;

+ 6 - 4
whepi-web/src/main/java/com/bofeng/dao/OutUserMapper.java

@@ -16,13 +16,15 @@ import java.util.Map;
 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 tu_type = #{tuType} and name = #{name} and phone = #{phone} and start_date <= curdate() and end_date >= curdate()")
+    OutUser getOutUserByPhone(@Param("tuType") Integer tuType, @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 queryOutUserByPhone(@Param("phone") Long phone);
+    @Select("SELECT * FROM out_user WHERE tu_type = #{tuType} and phone = #{phone}")
+    OutUser queryOutUserByPhone(@Param("tuType") Integer tuType, @Param("phone") Long phone);
 
     List<OutUser> getAllOutUser(PageDb pageDb, Map<String, Object> queryParam);
 
+    List<OutUser> getAllOutUserLY(PageDb pageDb, Map<String, Object> queryParam);
+
     Integer deleteOutUsers(@Param("ids") String ids);
 }

+ 7 - 0
whepi-web/src/main/java/com/bofeng/entity/OutUser.java

@@ -22,6 +22,10 @@ public class OutUser {
     @TableId("tu_id")
     private Long tuId;
 
+    @ApiModelProperty("特殊人员类型:1凌云,2非凌云")
+    @TableField("tu_type")
+    private Integer tuType;
+
     @ApiModelProperty("特殊人员姓名")
     @TableField("name")
     private String name;
@@ -65,4 +69,7 @@ public class OutUser {
 
     @TableField(exist = false)
     private String endDateStr;
+
+    @TableField(exist = false)
+    private String doorplate;
 }

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

@@ -163,6 +163,13 @@ public class ScanAdminController {
         return Model.newSuccess(pageDb,outUsers);
     }
 
+    @ApiOperation("凌云特殊人员查询")
+    @PostMapping("/whepi/OutUser/selectAllOutUserLY")
+    public Model<List<OutUser>> selectAllOutUserLY(PageDb pageDb,HttpParameterParser parser) {
+        List<OutUser> outUsers = outUserMapper.getAllOutUserLY(pageDb,parser.getMap());
+        return Model.newSuccess(pageDb,outUsers);
+    }
+
     @ApiOperation("检查电话号码")
     @PostMapping("/whepi/OutUser/getUptownHomeByPhone")
     public Model<UptownHome> getUptownHomeByPhone(@Pd(name = "phone") String phone) {
@@ -189,7 +196,26 @@ public class ScanAdminController {
     @ApiOperation("保存特殊人员")
     @PostMapping("/whepi/OutUser/saveOutUser")
     public Model saveOutUser(@JsonBody OutUser outUser) {
-        OutUser outUser1 = outUserMapper.queryOutUserByPhone(outUser.getPhone());
+        OutUser outUser1 = outUserMapper.queryOutUserByPhone(2, 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.setTuType(2);
+        outUser.setStartDate(new Date());
+        outUser.setEndDate(new Date());
+        outUser.setTime(1);
+        return Model.newSuccess(outUserMapper.insert(outUser));
+    }
+
+    @ApiOperation("凌云保存特殊人员")
+    @PostMapping("/whepi/OutUser/saveOutUserLY")
+    public Model saveOutUserLY(@JsonBody OutUser outUser) {
+        OutUser outUser1 = outUserMapper.queryOutUserByPhone(1, outUser.getPhone());
         if (outUser1 != null) {
             return Model.newFail("该号码已经添加为特殊人员,请仔细检查该号码。");
         }
@@ -198,6 +224,7 @@ public class ScanAdminController {
             outUser.setName(uptownHomes.get(0).getLinkman());
         }
         outUser.setTuId(IdWorker.getId());
+        outUser.setTuType(1);
         outUser.setStartDate(new Date());
         outUser.setEndDate(new Date());
         outUser.setTime(1);

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

@@ -138,6 +138,15 @@ public class ScanController {
                     }
                 }
                 if (ly) {
+                    OutUser outUser = outUserMapper.getOutUserByPhone(1, uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
+                    if (outUser != null) {
+                        model.put("collor", "green");
+                        model.put("collor2", "green");
+                        model.put("into", "允许通行");
+                        model.put("errorMsg", "特殊人员允许通行,请保证生产同时注意自身安全。");
+                        scanService.saveOutScan(userOpen.getUserId(), inType, uptownDoor.getUptownId(), uptownDoor.getDoorId(), 1, "");
+                        return new ModelAndView("/user/scan.ftl", model);
+                    }
                     MsReport msReport = msReportMapper.queryMsReportIsXG(userOpen.getUserId());
                     SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
                     if (msReport != null) {
@@ -199,7 +208,7 @@ public class ScanController {
                 }
             }
             if (inType == 2) {
-                OutUser outUser = outUserMapper.getOutUserByPhone(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
+                OutUser outUser = outUserMapper.getOutUserByPhone(2, uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
                 if (outUser != null) {
                     model.put("collor", "green");
                     model.put("into", "允许通行");
@@ -284,7 +293,7 @@ public class ScanController {
                 model.put("errorMsg", "您最近一分钟已经扫码,本次扫码重复。");
                 return new ModelAndView("/user/scanEstate.ftl", model);
             }
-            OutUser outUser = outUserMapper.getOutUserByPhone(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
+            OutUser outUser = outUserMapper.getOutUserByPhone(2, uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
             if (outUser != null) {
                 model.put("collor", "green");
                 model.put("into", "允许通行");
@@ -368,7 +377,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(uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
+                OutUser outUser = outUserMapper.getOutUserByPhone(2, uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
                 if (outUser != null) {
                     model.put("collor", "green");
                     model.put("into", "允许外出");
@@ -445,6 +454,14 @@ public class ScanController {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
             model.put("now", sdf.format(new Date()));
+            OutUser outUser = outUserMapper.getOutUserByPhone(1, uptownHomes.get(0).getLinkman(), Long.parseLong(uptownHomes.get(0).getPhone()));
+            if (outUser != null) {
+                model.put("collor", "green");
+                model.put("collor2", "green");
+                model.put("into", "允许复工");
+                model.put("errorMsg", "特殊人员允许复工,请保证生产同时注意自身安全。");
+                return new ModelAndView("/user/returnWork.ftl", model);
+            }
             MsReport msReport = msReportMapper.queryMsReportIsXG(userId);
             if (msReport != null) {
                 List<MsReport> msReports1 = msReportMapper.queryLateStatus(userId, s.format(msReport.getReportDate()));

+ 30 - 1
whepi-web/src/main/resources/mapper/OutUserMapper.xml

@@ -3,7 +3,7 @@
 <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,
+        select u.tu_id,ur.user_id as userId,su.uptown_name as uptownName,uu.ridgepole,uu.unit,u.name,u.phone,suh.doorplate,
         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
@@ -21,6 +21,35 @@
             <if test="phone != null and phone !=''">
                 and u.phone = #{phone}
             </if>
+            <if test="tuType != null and tuType !=''">
+                and u.tu_type = #{tuType}
+            </if>
+        </where>
+        order by u.time_update desc
+    </select>
+
+    <select id="getAllOutUserLY" resultType="com.bofeng.entity.OutUser">
+        select u.tu_id,ur.user_id as userId,su.uptown_name as uptownName,CONCAT(uu.ridgepole,uu.unit) as unit,u.name,u.phone,suh.doorplate,
+        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 != ''">
+                (
+                suh.doorplate like concat('%',#{queryProperties},'%')
+                or u.name like concat('%',#{queryProperties},'%')
+                )
+            </if>
+            <if test="phone != null and phone !=''">
+                and u.phone = #{phone}
+            </if>
+            <if test="tuType != null and tuType !=''">
+                and u.tu_type = #{tuType}
+            </if>
         </where>
         order by u.time_update desc
     </select>