From 7a84f219c272a93c1dc8206f74505aff2a84b909 Mon Sep 17 00:00:00 2001
From: LSH <1>
Date: 星期五, 17 五月 2024 10:31:58 +0800
Subject: [PATCH] #站点初始化

---
 src/main/java/com/zy/asrs/entity/param/BasDevpInitParam.java         |   41 ++++++++
 src/main/java/com/zy/asrs/controller/BasDevpController.java          |   25 +++++
 src/main/java/com/zy/system/entity/license/CustomLicenseManager.java |   38 +++---
 src/main/webapp/static/js/basDevp/basDevp.js                         |  164 ++++++++++++++++++++------------
 src/main/webapp/views/basDevp/basDevp.html                           |   26 +++++
 5 files changed, 215 insertions(+), 79 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/BasDevpController.java b/src/main/java/com/zy/asrs/controller/BasDevpController.java
index cd89e40..5182bc4 100644
--- a/src/main/java/com/zy/asrs/controller/BasDevpController.java
+++ b/src/main/java/com/zy/asrs/controller/BasDevpController.java
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.zy.asrs.entity.BasDevp;
+import com.zy.asrs.entity.param.BasDevpInitParam;
 import com.zy.asrs.service.BasDevpService;
 import com.zy.common.web.BaseController;
 import com.core.annotations.ManagerAuth;
@@ -24,6 +25,30 @@
     @Autowired
     private BasDevpService basDevpService;
 
+    @RequestMapping(value = "/basDevp/init/auth")
+    @ManagerAuth(memo = "鍒濆鍖栫珯鐐�")
+    public R init(BasDevpInitParam param) {
+        List<BasDevp> list = new ArrayList<>();
+        for (int devNo = param.getStartDev() ; devNo<=param.getEndDev() ; devNo++){
+            BasDevp basDevp = basDevpService.selectById(devNo);
+            if (Cools.isEmpty(basDevp)){
+                BasDevp basDevp1 = new BasDevp();
+                basDevp1.setDevNo(devNo);
+                basDevp1.setInEnable("Y");
+                basDevp1.setOutEnable("Y");
+                basDevp1.setAutoing("Y");
+                basDevp1.setLoading("Y");
+                basDevp1.setCanining("Y");
+                basDevp1.setCanouting("Y");
+                basDevp1.setModiUser(getUserId());
+                basDevp1.setModiTime(new Date());
+                list.add(basDevp1);
+            }
+        }
+        basDevpService.insertBatch(list);
+        return R.ok("鍒濆鍖栨垚鍔�");
+    }
+
     @RequestMapping(value = "/basDevp/{id}/auth")
     @ManagerAuth
     public R get(@PathVariable("id") Long id) {
diff --git a/src/main/java/com/zy/asrs/entity/param/BasDevpInitParam.java b/src/main/java/com/zy/asrs/entity/param/BasDevpInitParam.java
new file mode 100644
index 0000000..8205614
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/BasDevpInitParam.java
@@ -0,0 +1,41 @@
+package com.zy.asrs.entity.param;
+
+import com.core.common.BaseRes;
+import com.core.exception.CoolException;
+
+/**
+ * Created by vincent on 2020/6/13
+ */
+public class BasDevpInitParam {
+
+    // 绔欑偣鍙�
+    // 璧峰绔欑偣鍙�
+    private Integer startDev;
+
+    // 缁堟绔欑偣鍙�
+    private Integer endDev;
+
+
+    public Integer getStartDev() {
+        if (null == startDev) {
+            throw new CoolException(BaseRes.PARAM);
+        }
+        return startDev;
+    }
+
+    public void setStartDev(Integer startDev) {
+        this.startDev = startDev;
+    }
+
+    public Integer getEndDev() {
+        if (null == endDev) {
+            throw new CoolException(BaseRes.PARAM);
+        }
+        return endDev;
+    }
+
+    public void setEndDev(Integer endDev) {
+        this.endDev = endDev;
+    }
+
+}
diff --git a/src/main/java/com/zy/system/entity/license/CustomLicenseManager.java b/src/main/java/com/zy/system/entity/license/CustomLicenseManager.java
index b50f4d5..1ad2cc1 100644
--- a/src/main/java/com/zy/system/entity/license/CustomLicenseManager.java
+++ b/src/main/java/com/zy/system/entity/license/CustomLicenseManager.java
@@ -127,25 +127,25 @@
         LicenseCheck serverCheckModel = getServerInfos();
 
         if(expectedCheckModel != null && serverCheckModel != null){
-//            //鏍¢獙IP鍦板潃
-//            if(!checkIpAddress(expectedCheckModel.getIpAddress(),serverCheckModel.getIpAddress())){
-//                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑IP娌″湪鎺堟潈鑼冨洿鍐�");
-//            }
-//
-//            //鏍¢獙Mac鍦板潃
-//            if(!checkIpAddress(expectedCheckModel.getMacAddress(),serverCheckModel.getMacAddress())){
-//                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑Mac鍦板潃娌″湪鎺堟潈鑼冨洿鍐�");
-//            }
-//
-//            //鏍¢獙涓绘澘搴忓垪鍙�
-//            if(!checkSerial(expectedCheckModel.getMainBoardSerial(),serverCheckModel.getMainBoardSerial())){
-//                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑涓绘澘搴忓垪鍙锋病鍦ㄦ巿鏉冭寖鍥村唴");
-//            }
-//
-//            //鏍¢獙CPU搴忓垪鍙�
-//            if(!checkSerial(expectedCheckModel.getCpuSerial(),serverCheckModel.getCpuSerial())){
-//                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑CPU搴忓垪鍙锋病鍦ㄦ巿鏉冭寖鍥村唴");
-//            }
+            //鏍¢獙IP鍦板潃
+            if(!checkIpAddress(expectedCheckModel.getIpAddress(),serverCheckModel.getIpAddress())){
+                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑IP娌″湪鎺堟潈鑼冨洿鍐�");
+            }
+
+            //鏍¢獙Mac鍦板潃
+            if(!checkIpAddress(expectedCheckModel.getMacAddress(),serverCheckModel.getMacAddress())){
+                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑Mac鍦板潃娌″湪鎺堟潈鑼冨洿鍐�");
+            }
+
+            //鏍¢獙涓绘澘搴忓垪鍙�
+            if(!checkSerial(expectedCheckModel.getMainBoardSerial(),serverCheckModel.getMainBoardSerial())){
+                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑涓绘澘搴忓垪鍙锋病鍦ㄦ巿鏉冭寖鍥村唴");
+            }
+
+            //鏍¢獙CPU搴忓垪鍙�
+            if(!checkSerial(expectedCheckModel.getCpuSerial(),serverCheckModel.getCpuSerial())){
+                throw new LicenseContentException("褰撳墠鏈嶅姟鍣ㄧ殑CPU搴忓垪鍙锋病鍦ㄦ巿鏉冭寖鍥村唴");
+            }
         }else{
             throw new LicenseContentException("涓嶈兘鑾峰彇鏈嶅姟鍣ㄧ‖浠朵俊鎭�");
         }
diff --git a/src/main/webapp/static/js/basDevp/basDevp.js b/src/main/webapp/static/js/basDevp/basDevp.js
index 535e6e7..9e4b732 100644
--- a/src/main/webapp/static/js/basDevp/basDevp.js
+++ b/src/main/webapp/static/js/basDevp/basDevp.js
@@ -195,9 +195,31 @@
                     success: function(layero, index){
                         layer.getChildFrame('#autoing,#loading,#canining,#canouting,#inreq1,#inreq2,#wrkNo,#barcode,#ctnType,#grossWt', index).parent().parent().hide();
                         layer.getChildFrame('#data-detail-submit-edit', index).hide();
-                    	clearFormVal(layer.getChildFrame('#detail', index));
+                        clearFormVal(layer.getChildFrame('#detail', index));
                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                     }
+                });
+                break;
+            case 'init':
+                layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞跺垵濮嬪寲绔欑偣', formType: 1,   shadeClose: true}, function(pass, idx){
+                    http.get(baseUrl+"/locMast/init/pwd", {pwd: pass}, function (res) {
+                        if (res.data) {
+                            layer.open({
+                                type: 1,
+                                title: '鍒濆鍖栫珯鐐�',
+                                area: ["400px"],
+                                maxmin: true,
+                                shadeClose: true,
+                                content: $("#resetLocDiv"),
+                                success: function (layero, index) {
+
+                                }
+                            })
+                        } else {
+                            layer.msg("鍙d护閿欒");
+                        }
+                        layer.close(idx);
+                    })
                 });
                 break;
             case 'refreshData':
@@ -275,6 +297,28 @@
         }
     });
 
+    // 鍒濆鍖栦繚瀛�
+    form.on('submit(initDo)', function (data) {
+        $.ajax({
+            url: baseUrl+"/basDevp/init/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: data.field,
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200){
+                    layer.msg(res.msg);
+                    layer.closeAll();
+                    tableReload(false);
+                } else if (res.code === 403){
+                    parent.location.href = "/";
+                }else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+    });
+
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(basDevp)', function(obj){
         var data = obj.data;
@@ -324,36 +368,36 @@
                 if (param === undefined) {
                     layer.msg("鏃犳暟鎹�");
                 } else {
-                   layer.open({
-                       type: 2,
-                       title: '淇敼璇︽儏',
-                       maxmin: true,
-                       area: [top.detailWidth, top.detailHeight],
-                       shadeClose: false,
-                       content: '../user/user_detail.html',
-                       success: function(layero, index){
-                           $.ajax({
-                               url: baseUrl+"/user/"+ param +"/auth",
-                               headers: {'token': localStorage.getItem('token')},
-                               method: 'GET',
-                               success: function (res) {
-                                   if (res.code === 200){
-                                       setFormVal(layer.getChildFrame('#detail', index), res.data, true);
-                                       top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
-                                       layer.getChildFrame('#password,#createTime\\$,#status', index).parent().parent().hide();
-                                       layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
-                                       layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                                       layero.find('iframe')[0].contentWindow.layui.form.render('select');
-                                       layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
-                                   } else if (res.code === 403){
-                                       parent.location.href = "/";
-                                   }else {
-                                       layer.msg(res.msg)
-                                   }
-                               }
-                           })
-                       }
-                   });
+                    layer.open({
+                        type: 2,
+                        title: '淇敼璇︽儏',
+                        maxmin: true,
+                        area: [top.detailWidth, top.detailHeight],
+                        shadeClose: false,
+                        content: '../user/user_detail.html',
+                        success: function(layero, index){
+                            $.ajax({
+                                url: baseUrl+"/user/"+ param +"/auth",
+                                headers: {'token': localStorage.getItem('token')},
+                                method: 'GET',
+                                success: function (res) {
+                                    if (res.code === 200){
+                                        setFormVal(layer.getChildFrame('#detail', index), res.data, true);
+                                        top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
+                                        layer.getChildFrame('#password,#createTime\\$,#status', index).parent().parent().hide();
+                                        layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
+                                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
+                                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
+                                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
+                                    } else if (res.code === 403){
+                                        parent.location.href = "/";
+                                    }else {
+                                        layer.msg(res.msg)
+                                    }
+                                }
+                            })
+                        }
+                    });
                 }
                 break;
             case 'appeUser':
@@ -361,35 +405,35 @@
                 if (param === undefined) {
                     layer.msg("鏃犳暟鎹�");
                 } else {
-                   layer.open({
-                       type: 2,
-                       title: '鍒涜鎯�',
-                       maxmin: true,
-                       area: [top.detailWidth, top.detailHeight],
-                       shadeClose: false,
-                       content: '../user/user_detail.html',
-                       success: function(layero, index){
-                           $.ajax({
-                               url: baseUrl+"/user/"+ param +"/auth",
-                               headers: {'token': localStorage.getItem('token')},
-                               method: 'GET',
-                               success: function (res) {
-                                   if (res.code === 200){
-                                       setFormVal(layer.getChildFrame('#detail', index), res.data, true);
-                                       top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
-                                       layer.getChildFrame('#data-detail-submit', index).hide();
-                                       layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                                       layero.find('iframe')[0].contentWindow.layui.form.render('select');
-                                       layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
-                                   } else if (res.code === 403){
-                                       parent.location.href = "/";
-                                   }else {
-                                       layer.msg(res.msg)
-                                   }
-                               }
-                           })
-                       }
-                   });
+                    layer.open({
+                        type: 2,
+                        title: '鍒涜鎯�',
+                        maxmin: true,
+                        area: [top.detailWidth, top.detailHeight],
+                        shadeClose: false,
+                        content: '../user/user_detail.html',
+                        success: function(layero, index){
+                            $.ajax({
+                                url: baseUrl+"/user/"+ param +"/auth",
+                                headers: {'token': localStorage.getItem('token')},
+                                method: 'GET',
+                                success: function (res) {
+                                    if (res.code === 200){
+                                        setFormVal(layer.getChildFrame('#detail', index), res.data, true);
+                                        top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
+                                        layer.getChildFrame('#data-detail-submit', index).hide();
+                                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
+                                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
+                                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
+                                    } else if (res.code === 403){
+                                        parent.location.href = "/";
+                                    }else {
+                                        layer.msg(res.msg)
+                                    }
+                                }
+                            })
+                        }
+                    });
                 }
                 break;
 
diff --git a/src/main/webapp/views/basDevp/basDevp.html b/src/main/webapp/views/basDevp/basDevp.html
index 18d4f9f..14b7504 100644
--- a/src/main/webapp/views/basDevp/basDevp.html
+++ b/src/main/webapp/views/basDevp/basDevp.html
@@ -35,6 +35,7 @@
 <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
         <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">鏂板</button>
+        <button class="layui-btn layui-btn-primary" id="btn-init" lay-event="init">鍒濆鍖�</button>
         <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">鍒犻櫎</button>
         <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">瀵煎嚭</button>
     </div>
@@ -53,6 +54,31 @@
 
 <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe>
 
+<!-- 閲嶇疆绔欑偣寮圭獥 -->
+<div id="resetLocDiv" style="margin: 20px 0 10px 30px; display: none">
+    <div class="layui-form layui-form-pane">
+        <!-- 绔欑偣 -->
+        <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">璧锋绔欑偣</label>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="startDev" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+                <div class="layui-form-mid">-</div>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="endDev" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+            </div>
+        </div>
+        <div id="prompt" style="text-indent: 10px;">
+            <span class="not-null">鍒濆鍖栫珯鐐癸紝璇疯皑鎱庢搷浣滐紒</span>
+        </div>
+        <!-- 鎸夐挳 -->
+        <div style="text-align: center; margin-top: 20px">
+            <button class="layui-btn layui-btn-radius layui-btn-normal" id="initDo" lay-submit lay-filter="initDo">纭畾</button>
+        </div>
+    </div>
+</div>
 </body>
 </html>
 

--
Gitblit v1.9.1