管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2024-09-03 596f3ad8d0a3b8d4641df16ba5b17f6a2a5090a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>FME测试</title>
  <meta http-equiv="Expires" content="0" />
  <meta http-equiv="Cache" content="no-cache" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Cache-control" content="no-cache" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script src="js/jquery.1.12.4.js"></script>
  <script src="js/rsa.min.js"></script>
  <script src="js/rollups.js"></script>
  <script>
    var app = {
      path: "",
      token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI1YmJjMGI2MC02NmU1LTRlYmMtOTU1OS02NDNmYjQ2MDMyMDAiLCJleHAiOjE2Njk4OTc5MjQsImFjY291bnQiOiJhZG1pbiJ9.N5JMesL0kU5Nkq0ReOmC3aqzHylzNKUZ8qCRxX2JHqw"
    };
 
    window.onload = function () {
      app.path = newGuid();
      $("#guid").html(app.path);
      //getPublicKey();
    }
 
    function getPublicKey() {
      $.get(url + "sign/getPublicKey", function (rs) {
        if (rs && rs.code == 200) {
          window.encrypt = new JSEncrypt();
          encrypt.setPublicKey(rs.result);
        }
      });
    }
 
    function ajax(url, type, data, dataType, contentType, fn) {
      $.ajax({
        url: url,
        type: type,
        data: data,
        dataType: dataType || "json", // html、json、jsonp、script、text
        contentType: contentType || "application/json", // "application/x-www-form-urlencoded"
        success: function (data) {
          fn(data);
        },
        error: function (e) {
          console.error(e);
          fn();
        }
      });
    }
 
    function newGuid() {
      var guid = "";
      for (var i = 1; i <= 32; i++) {
        var n = Math.floor(Math.random() * 16.0).toString(16);
        guid += n;
        if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
          guid += "-";
      }
      return guid;
    }
  </script>
  <script>
    // 1-数据上传服务
    function uploadFile() {
      var url = "http://172.16.200.141:88/datax/resources/uploadFile";
 
      var formData = new FormData();
      var fs = document.getElementById("file1");
      if (fs.files.length == 0) {
        alert("请选择1个压缩包文件!");
        return;
      }
 
      for (var i = 0, c = fs.files.length; i < c; i++) {
        var name = fs.files[i].name.toLocaleLowerCase();
        formData.append("files", fs.files[i]); // fs.files[i].name,file
        formData.append("name", name);
        formData.append("path", app.path);
        formData.append("token", app.token);
        break;
      }
 
      $.ajax(url, {
        type: "POST",
        data: formData,
        async: true,
        cache: false,
        processData: false,
        contentType: false,
        success: function (rs) {
          console.log(rs);
          $("#content").append(JSON.stringify(rs) + "<br/>");
        },
        error: function (e) {
          console.error(e);
          $("#content").append(e.statusText + "<br/>");
        }
      });
    }
 
    // 2-质检任务提交
    function submitTask() {
      var data = [
        // 提交任务时创建的任务名称,建议为随机唯一ID
        //{ "name": "_name", "value": "9ec41ced-3930-42d3-81f3-5119d2fd648d" },
        { "name": "_name", "value": app.path },
 
        // 任务提交优先级,值域为[1,100],值越小,提交优先级越大
        { "name": "_priority", "value": 100 },
 
        // 错误时是否停止参数,默认为true,质检方案含有多个质检服务,一个任务提交时需要所有质检服务全部执行成果才算通过质检
        { "name": "_terminate_on_error", "value": true },
 
        // 数据专业,参数值域为[测量专业|勘察专业|地灾专业|洞库专业]
        { "name": "SJZY", "value": "测量专业" },
 
        // 待检压缩包的路径,其中$((SJSC_ZJLJ)为固定值;后边“\\9ec41ced-3930-42d3-81f3-5119d2fd648d\\test.7z”
        // 为第一步中的数据上传服务时“path”值和文件名构成的相对路径
        //{ "name": "GCXMYSB", "value": "$(SJSC_ZJLJ)\\9ec41ced-3930-42d3-81f3-5119d2fd648d\\test.7z" },
        { "name": "GCXMYSB", "value": "$(SJSC_ZJLJ)\\" + app.path + "\\test.7z" },
 
        // WBS表格的路径,其中$(S_WBSBG)为固定值;后边“\\9ec41ced-3930-42d3-81f3-5119d2fd648d\\test.xlsx”
        // 为第一步中的数据上传服务时“path”值和文件名构成的相对路径
        { "name": "S_WBSBG", "value": "$(S_WBSBG)\\" + app.path + "\\test.xlsx" },
 
        // 传入待检查压缩包的项目名称
        { "name": "XMMC", "value": "西气东输四线天然气管道工程(吐鲁番-中卫)(00116BT02)" },
 
        // 是否为地灾数据,值域为[NO|YES]
        { "name": "S_DZDK", "value": "NO" },
 
        // 地灾治理类型,值域为[崩塌治理|不稳定斜坡治理|地面塌陷治理|高陡边坡治理|泥石流治理|水毁治理|滑坡治理]
        { "name": "DZ_ZLLX", "value": "NO" }
      ];
 
      var url = "http://172.16.200.141:88/datax/task/run/B0入库质检__总" + "?token=" + app.token;
      ajax(url, "POST", JSON.stringify(data), "json", null, function (rs) {
        console.log(rs);
        $("#content").append(JSON.stringify(rs) + "<br/>");
      });
    }
 
    // 3-质检任务状态详细信息查询
    function queryTaskDetail() {
      var id = "c46e50d1-43c3-4859-a8e5-4ed61983ba35";
 
      var url = "http://172.16.200.141:88/datax/task/get" + "?token=" + app.token + "&id=" + id;
      ajax(url, "GET", null, "json", null, function (rs) {
        console.log(rs);
        $("#content").append(JSON.stringify(rs) + "<br/>");
      });
    }
 
    // 4-质检错误结果下载
    function downloadError() {
      var id = "dbaf1677-1041-4987-bd42-312c1ada127b";
 
      var url = "http://172.16.200.141:88/datax/task/downloadResult" + "?token=" + app.token + "&id=" + id;
      ajax(url, "GET", null, "json", null, function (rs) {
        console.log(rs);
        $("#content").append(JSON.stringify(rs) + "<br/>");
      });
    }
 
    // 5-质检任务服务列表状态查询
    function queryTaskStatus() {
      var id = "dbaf1677-1041-4987-bd42-312c1ada127b";
 
      var url = "http://172.16.200.141:88/datax/task/getJobs" + "?token=" + app.token + "&id=" + id;
      ajax(url, "GET", null, "json", null, function (rs) {
        console.log(rs);
        $("#content").append(JSON.stringify(rs) + "<br/>");
      });
    }
  </script>
</head>
<body style="height: 100%; width: 100%; margin: 0; padding: 10px; overflow: hidden; box-sizing: border-box;">
  文件上传:<input id="file1" name="file1" type="file" accept=".7z,.zip,.xls,.xlsx" />
  <input type="button" value="1-数据上传服务" onclick="uploadFile();" />
  <input type="button" value="2-质检任务提交" onclick="submitTask();" />
  <input type="button" value="3-质检任务状态详细信息查询" onclick="queryTaskDetail();" />
  <input type="button" value="4-质检错误结果下载" onclick="downloadError();" />
  <input type="button" value="5-质检任务服务列表状态查询" onclick="queryTaskStatus();" />
  <input type="button" value="6-清空内容" onclick="$('#content').html('');" />
  <br />
  <br />
  Guid:<span id="guid"></span>
  <br />
  <br />
  <div id="content"></div>
</body>
</html>