From 63db319f978f21dde1c7d9150244b2dca44f0a6a Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 03 一月 2024 13:34:54 +0800
Subject: [PATCH] #

---
 zy-asrs-openapi/src/main/webapp/views/generatePakIn.html                        |    1 
 zy-asrs-openapi/src/main/webapp/views/getOrderType.html                         |  219 ++++++++++++++++++++++++
 zy-asrs-openapi/src/main/webapp/views/md/getOrderType.md                        |  274 ++++++++++++++++++++++++++++++
 zy-asrs-openapi/src/main/java/com/zy/asrs/openapi/controller/ApiController.java |   22 ++
 zy-asrs-openapi/src/main/webapp/views/index.html                                |    1 
 5 files changed, 513 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-openapi/src/main/java/com/zy/asrs/openapi/controller/ApiController.java b/zy-asrs-openapi/src/main/java/com/zy/asrs/openapi/controller/ApiController.java
index c2e9ada..123c454 100644
--- a/zy-asrs-openapi/src/main/java/com/zy/asrs/openapi/controller/ApiController.java
+++ b/zy-asrs-openapi/src/main/java/com/zy/asrs/openapi/controller/ApiController.java
@@ -7,6 +7,8 @@
 import com.zy.asrs.common.openapi.entity.param.GenerateOrderPakInParam;
 import com.zy.asrs.common.openapi.service.HostKeyService;
 import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.common.wms.entity.DocType;
+import com.zy.asrs.common.wms.service.DocTypeService;
 import com.zy.asrs.framework.common.BaseRes;
 import com.zy.asrs.framework.common.Cools;
 import com.zy.asrs.framework.common.R;
@@ -16,6 +18,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -25,11 +28,13 @@
 
     @Autowired
     private HostKeyService hostKeyService;
+    @Autowired
+    private DocTypeService docTypeService;
 
     @PostMapping("/generateOrderPakIn")
-    public synchronized R pakinOrderCreate(@RequestHeader(required = false) String appkey,
+    public synchronized R generateOrderPakIn(@RequestHeader(required = false) String appkey,
                                            @RequestBody GenerateOrderPakInParam param) {
-        auth(appkey, param);
+        auth(appkey, param, true);
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
         }
@@ -46,7 +51,14 @@
         return R.ok();
     }
 
-    private void auth(String appkey, Object obj) {
+    @PostMapping("/getOrderType")
+    public synchronized R getOrderType(@RequestHeader(required = false) String appkey) {
+        auth(appkey, null, false);
+        List<DocType> list = docTypeService.list();
+        return R.ok().add(list);
+    }
+
+    private HostKey auth(String appkey, Object obj, boolean signCheck) {
         if (Cools.isEmpty(appkey)) {
             throw new CoolException("璁よ瘉澶辫触锛岃纭appKey鏃犺锛�");
         }
@@ -56,7 +68,7 @@
             throw new CoolException("璁よ瘉澶辫触锛岃纭appKey鏃犺锛�");
         }
 
-        if (hostKey.getSignStatus() == 1) {
+        if (hostKey.getSignStatus() == 1 && signCheck) {
             //闇�瑕佽繘琛岀鍚嶆牎楠�
             //鍒涘缓鑷劧鎺掑簭map
             JSONObject param = new JSONObject(true);
@@ -72,6 +84,8 @@
                 throw new CoolException("绛惧悕鏍¢獙澶辫触");
             }
         }
+
+        return hostKey;
     }
 
 }
diff --git a/zy-asrs-openapi/src/main/webapp/views/generatePakIn.html b/zy-asrs-openapi/src/main/webapp/views/generatePakIn.html
index 4cc6ce9..fda466b 100644
--- a/zy-asrs-openapi/src/main/webapp/views/generatePakIn.html
+++ b/zy-asrs-openapi/src/main/webapp/views/generatePakIn.html
@@ -22,6 +22,7 @@
             <div><el-button type="text" @click="switchPage('reportCompleted.html')">搴撳瓨涓婃姤</el-button></div>
             <div><el-button type="text" @click="switchPage('reportApiManage.html')">涓婃姤API绠$悊</el-button></div>
             <el-divider></el-divider>
+            <div><el-button type="text" @click="switchPage('getOrderType.html')">鑾峰彇璁㈠崟绫诲瀷</el-button></div>
             <div><el-button type="text" @click="switchPage('generatePakIn.html')">鐢熸垚鍏ュ簱璁㈠崟</el-button></div>
             <el-divider></el-divider>
             <div><el-button type="text" @click="keyList()">瀵嗛挜绠$悊</el-button></div>
diff --git a/zy-asrs-openapi/src/main/webapp/views/getOrderType.html b/zy-asrs-openapi/src/main/webapp/views/getOrderType.html
new file mode 100644
index 0000000..d96a3cd
--- /dev/null
+++ b/zy-asrs-openapi/src/main/webapp/views/getOrderType.html
@@ -0,0 +1,219 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>API寮�鏀惧钩鍙� - 鑾峰彇璁㈠崟绫诲瀷</title>
+    <link rel="stylesheet" href="../static/css/element.css">
+    <link rel="stylesheet" href="../static/css/common.css">
+    <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
+    <script type="text/javascript" src="../static/js/vue.min.js"></script>
+    <script type="text/javascript" src="../static/js/showdown.min.js"></script>
+    <script type="text/javascript" src="../static/js/common.js"></script>
+    <script type="text/javascript" src="../static/js/element.js"></script>
+</head>
+<body>
+    <div id="app">
+        <div id="content"></div>
+        <div class="slider">
+            <div><el-button type="text" @click="switchPage('index.html')">瑙勮寖璇存槑</el-button></div>
+            <el-divider></el-divider>
+            <div><el-button type="text" @click="switchPage('reportCompleted.html')">浠诲姟瀹屾垚涓婃姤</el-button></div>
+            <div><el-button type="text" @click="switchPage('reportCompleted.html')">浠诲姟鍙栨秷涓婃姤</el-button></div>
+            <div><el-button type="text" @click="switchPage('reportCompleted.html')">搴撳瓨涓婃姤</el-button></div>
+            <div><el-button type="text" @click="switchPage('reportApiManage.html')">涓婃姤API绠$悊</el-button></div>
+            <el-divider></el-divider>
+            <div><el-button type="text" @click="switchPage('getOrderType.html')">鑾峰彇璁㈠崟绫诲瀷</el-button></div>
+            <div><el-button type="text" @click="switchPage('generatePakIn.html')">鐢熸垚鍏ュ簱璁㈠崟</el-button></div>
+            <el-divider></el-divider>
+            <div><el-button type="text" @click="keyList()">瀵嗛挜绠$悊</el-button></div>
+        </div>
+
+        <el-dialog title="瀵嗛挜绠$悊" :visible.sync="keyTableVisible">
+            <el-table :data="keyTableData" v-loading="loading">
+                <el-table-column property="hostId$" label="浠撳簱"></el-table-column>
+                <el-table-column property="signKey" label="绛惧悕瀵嗛挜" width="150"></el-table-column>
+                <el-table-column property="appKey" label="鎺ュ彛璇锋眰瀵嗛挜" width="250"></el-table-column>
+                <el-table-column property="createTime$" label="鏃堕棿" width="200"></el-table-column>
+                <el-table-column label="鎿嶄綔" width="400">
+                    <template slot-scope="scope">
+                        <el-button size="mini" @click="generateSignKey(scope.row.hostId)">绛惧悕瀵嗛挜</el-button>
+                        <el-button size="mini" @click="generateAppKey(scope.row.hostId)">鎺ュ彛瀵嗛挜</el-button>
+                        <el-switch
+                                v-model="scope.row.signStatus"
+                                @change="switchChange(scope.row.hostId,scope.row.signStatus)"
+                                active-text="寮�鍚鍚�"
+                                inactive-text="鍏抽棴绛惧悕">
+                        </el-switch>
+                    </template>
+                </el-table-column>
+            </el-table>
+        </el-dialog>
+    </div>
+
+    <script>
+        showdown.setOption('tables', true);
+        var converter = new showdown.Converter()
+
+        var app = new Vue({
+            el: '#app',
+            data: {
+                keyTableVisible: false,
+                keyTableData: [],
+                loading: true,
+            },
+            created() {
+                this.init()
+            },
+            methods: {
+                init() {
+                    this.introduceClick()
+                },
+                introduceClick() {
+                    $.ajax({
+                        url: "md/getOrderType.md",
+                        headers: {'token': localStorage.getItem('token')},
+                        method: 'GET',
+                        success: function (res) {
+                            // $("#content").html(marked.parse(res))
+                            // console.log(converter.makeHtml(res))
+                            $("#content").html(converter.makeHtml(res))
+                        }
+                    });
+                },
+                keyList() {
+                    let that = this
+                    this.keyTableVisible = true
+                    $.ajax({
+                        url: baseUrl + "/hostKey/list/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: {},
+                        dataType:'json',
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            let tmp = []
+                            res.data.forEach((item, index) => {
+                                item.signStatus = item.signStatus == 1 ? true : false;
+                                tmp.push(item)
+                            });
+                            that.keyTableData = tmp
+                            that.loading = false
+                        }
+                    });
+                },
+                generateSignKey(hostId) {
+                    let that = this
+                    this.$confirm('姝ゆ搷浣滃皢瑕嗙洊鍘熺鍚嶅瘑閽�, 鏄惁缁х画?', '鎻愮ず', {
+                        confirmButtonText: '纭畾',
+                        cancelButtonText: '鍙栨秷',
+                        type: 'warning'
+                    }).then(() => {
+                        $.ajax({
+                            url: baseUrl + "/hostKey/generateSignKey/auth",
+                            headers: {'token': localStorage.getItem('token')},
+                            data: {
+                                hostId: hostId
+                            },
+                            dataType: 'json',
+                            contentType: 'application/json;charset=UTF-8',
+                            method: 'GET',
+                            success: function (res) {
+                                if (res.code === 200) {
+                                    that.$message({
+                                        type: 'success',
+                                        message: '鐢熸垚鎴愬姛'
+                                    });
+
+                                    that.keyTableData.forEach((item, index) => {
+                                        if (item.hostId == hostId) {
+                                            item.signKey = res.data.signKey
+                                        }
+                                    });
+                                } else {
+                                    that.$message({
+                                        type: 'error',
+                                        message: res.msg
+                                    });
+                                }
+                            }
+                        });
+                    }).catch(() => {
+                        //鍙栨秷
+                    });
+                },
+                generateAppKey(hostId) {
+                    let that = this
+                    this.$confirm('姝ゆ搷浣滃皢瑕嗙洊鍘熸帴鍙e瘑閽�, 鏄惁缁х画?', '鎻愮ず', {
+                        confirmButtonText: '纭畾',
+                        cancelButtonText: '鍙栨秷',
+                        type: 'warning'
+                    }).then(() => {
+                        $.ajax({
+                            url: baseUrl + "/hostKey/generateAppKey/auth",
+                            headers: {'token': localStorage.getItem('token')},
+                            data: {
+                                hostId: hostId
+                            },
+                            dataType: 'json',
+                            contentType: 'application/json;charset=UTF-8',
+                            method: 'GET',
+                            success: function (res) {
+                                if (res.code === 200) {
+                                    that.$message({
+                                        type: 'success',
+                                        message: '鐢熸垚鎴愬姛'
+                                    });
+
+                                    that.keyTableData.forEach((item, index) => {
+                                        if (item.hostId == hostId) {
+                                            item.appKey = res.data.appKey
+                                        }
+                                    });
+                                } else {
+                                    that.$message({
+                                        type: 'error',
+                                        message: res.msg
+                                    });
+                                }
+                            }
+                        });
+                    }).catch(() => {
+                        //鍙栨秷
+                    });
+                },
+                switchChange(hostId, signStatus) {
+                    let that = this
+                    //绛惧悕鏍¢獙寮�鍏�
+                    $.ajax({
+                        url: baseUrl + "/hostKey/switchSign/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: {
+                            hostId: hostId,
+                            signStatus: signStatus ? 1 : 0,
+                        },
+                        dataType: 'json',
+                        contentType: 'application/json;charset=UTF-8',
+                        method: 'GET',
+                        success: function (res) {
+                            if (res.code === 200) {
+                                that.$message({
+                                    type: 'success',
+                                    message: '鍒囨崲鎴愬姛'
+                                });
+                            } else {
+                                that.$message({
+                                    type: 'error',
+                                    message: res.msg
+                                });
+                            }
+                        }
+                    });
+                },
+                switchPage(url) {
+                    location.href = url
+                },
+            }
+        })
+    </script>
+</body>
+</html>
\ No newline at end of file
diff --git a/zy-asrs-openapi/src/main/webapp/views/index.html b/zy-asrs-openapi/src/main/webapp/views/index.html
index ad90b99..2a6e8e2 100644
--- a/zy-asrs-openapi/src/main/webapp/views/index.html
+++ b/zy-asrs-openapi/src/main/webapp/views/index.html
@@ -22,6 +22,7 @@
             <div><el-button type="text" @click="switchPage('reportCompleted.html')">搴撳瓨涓婃姤</el-button></div>
             <div><el-button type="text" @click="switchPage('reportApiManage.html')">涓婃姤API绠$悊</el-button></div>
             <el-divider></el-divider>
+            <div><el-button type="text" @click="switchPage('getOrderType.html')">鑾峰彇璁㈠崟绫诲瀷</el-button></div>
             <div><el-button type="text" @click="switchPage('generatePakIn.html')">鐢熸垚鍏ュ簱璁㈠崟</el-button></div>
             <el-divider></el-divider>
             <div><el-button type="text" @click="keyList()">瀵嗛挜绠$悊</el-button></div>
diff --git a/zy-asrs-openapi/src/main/webapp/views/md/getOrderType.md b/zy-asrs-openapi/src/main/webapp/views/md/getOrderType.md
new file mode 100644
index 0000000..a8d2057
--- /dev/null
+++ b/zy-asrs-openapi/src/main/webapp/views/md/getOrderType.md
@@ -0,0 +1,274 @@
+## 鑾峰彇璁㈠崟绫诲瀷
+
+- **鎺ュ彛璇存槑锛�** 鑾峰彇璁㈠崟绫诲瀷
+- **鎺ュ彛鍦板潃锛�** /api/getOrderType
+
+#### 璇锋眰鍙傛暟
+
+鍙傛暟鍚嶇О						|绫诲瀷		|鍑虹幇瑕佹眰	|鎻忚堪  
+:----						|:---		|:------	|:---	
+Header						|&nbsp;		|蹇呭~			|璇锋眰鎶ユ枃澶�
+&emsp;appkey					|string		|蹇呭~			|瀵嗛挜绠$悊涓敓鎴恆ppkey
+Body						|&nbsp;		|			|&nbsp;
+
+
+璇锋眰绀轰緥锛�
+
+```
+{}
+```
+
+
+#### 杩斿洖缁撴灉
+
+鍙傛暟鍚嶇О						|绫诲瀷		|鍑虹幇瑕佹眰	|鎻忚堪  
+:----						|:---		|:------	|:---	
+code						|int		|蹇呭~			|鍝嶅簲鐮侊紝浠g爜瀹氫箟璇疯鈥滈檮褰旳 鍝嶅簲鍚楄鏄庘��
+msg							|string		|蹇呭~			|&nbsp;
+data						|object		|鍙��			|&nbsp;
+
+绀轰緥锛�
+
+```
+{
+    "msg": "鎿嶄綔鎴愬姛",
+    "code": 200,
+    "data": [
+        {
+            "docId": 1,
+            "docName": "閲囪喘鍏ュ簱",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 2,
+            "docName": "鐢熶骇鍏ュ簱",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 3,
+            "docName": "棰嗘枡閫�鍥炲叆搴�",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 4,
+            "docName": "閿�鍞��鍥炲叆搴�",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 5,
+            "docName": "璋冩嫧鍏ュ簱",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 6,
+            "docName": "鍏朵粬鍏ュ簱",
+            "pakin": 1,
+            "pakout": 0,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 7,
+            "docName": "閿�鍞嚭搴�",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 8,
+            "docName": "棰嗘枡鍑哄簱",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 9,
+            "docName": "閲囪喘閫�鍥炲嚭搴�",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 10,
+            "docName": "璋冩嫧鍑哄簱",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 11,
+            "docName": "鍏朵粬鍑哄簱",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        },
+        {
+            "docId": 12,
+            "docName": "鎵嬪姩鍑哄簱鍗�",
+            "pakin": 0,
+            "pakout": 1,
+            "status": null,
+            "createBy": null,
+            "createTime": null,
+            "updateBy": null,
+            "updateTime": null,
+            "memo": "",
+            "hostId": null,
+            "createTime$": "",
+            "hostId$": null,
+            "status$": null,
+            "updateTime$": "",
+            "updateBy$": null,
+            "createBy$": null
+        }
+    ]
+}
+```
+
+## 闄勫綍A 鍝嶅簲鐮佽鏄�
+
+鍝嶅簲鐮�	|璇存槑  
+:----	|:---
+200		|澶勭悊鎴愬姛
+500		|绯荤粺鍐呴儴閿欒
\ No newline at end of file

--
Gitblit v1.9.1