Commit bfb7e9c84e3e19dad8a15c6055c2d415f44a5350
1 parent
8cafb4ba
修复解析apk包错误
Showing
2 changed files
with
495 additions
and
492 deletions
ant-design-vue-jeecg/src/views/system/monitor/ApkInfoList.vue
1 | -<template> | |
2 | - <a-card :bordered="false"> | |
3 | - <!-- 查询区域 --> | |
4 | - <div class="table-page-search-wrapper"> | |
5 | - <a-form layout="inline" @keyup.enter.native="searchQuery"> | |
6 | - <a-row :gutter="24"> | |
7 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
8 | - <a-form-item label="应用名称"> | |
9 | - <a-input placeholder="请输入应用名称" v-model="queryParam.pkgname"></a-input> | |
10 | - </a-form-item> | |
11 | - </a-col> | |
12 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | - <a-form-item label="版本号"> | |
14 | - <a-input placeholder="请输入版本号" v-model="queryParam.versioncode"></a-input> | |
15 | - </a-form-item> | |
16 | - </a-col> | |
17 | - <template v-if="toggleSearchStatus"> | |
18 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
19 | - <a-form-item label="版本名称"> | |
20 | - <a-input placeholder="请输入版本名称" v-model="queryParam.versionname"></a-input> | |
21 | - </a-form-item> | |
22 | - </a-col> | |
23 | - </template> | |
24 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
25 | - <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
26 | - <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
27 | - <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
28 | - <a @click="handleToggleSearch" style="margin-left: 8px"> | |
29 | - {{ toggleSearchStatus ? '收起' : '展开' }} | |
30 | - <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
31 | - </a> | |
32 | - </span> | |
33 | - </a-col> | |
34 | - </a-row> | |
35 | - </a-form> | |
36 | - </div> | |
37 | - <!-- 查询区域-END --> | |
38 | - | |
39 | - <!-- 操作按钮区域 --> | |
40 | - <div class="table-operator"> | |
41 | - <a-upload | |
42 | - name="file" | |
43 | - :multiple="false" | |
44 | - :action="uploadAction" | |
45 | - :headers="tokenHeader" | |
46 | - :showUploadList="false" | |
47 | - :beforeUpload="beforeUpload" | |
48 | - @change="handleChange"> | |
49 | - <a-button> | |
50 | - <a-icon type="upload"/> | |
51 | - 上传APK | |
52 | - </a-button> | |
53 | - </a-upload> | |
54 | - <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>--> | |
55 | - <a-button type="primary" icon="download" @click="handleExportXls('apk_info')">导出</a-button> | |
56 | - <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
57 | - <a-button type="primary" icon="import">导入</a-button> | |
58 | - </a-upload> | |
59 | - <!-- 高级查询区域 --> | |
60 | - <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
61 | - <a-dropdown v-if="selectedRowKeys.length > 0"> | |
62 | - <a-menu slot="overlay"> | |
63 | - <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
64 | - </a-menu> | |
65 | - <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
66 | - </a-dropdown> | |
67 | - </div> | |
68 | - | |
69 | - <!-- table区域-begin --> | |
70 | - <div> | |
71 | - <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
72 | - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
73 | - <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
74 | - </div> | |
75 | - | |
76 | - <a-table | |
77 | - ref="table" | |
78 | - size="middle" | |
79 | - :scroll="{x:true}" | |
80 | - bordered | |
81 | - rowKey="id" | |
82 | - :columns="columns" | |
83 | - :dataSource="dataSource" | |
84 | - :pagination="ipagination" | |
85 | - :loading="loading" | |
86 | - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
87 | - class="j-table-force-nowrap" | |
88 | - @change="handleTableChange"> | |
89 | - | |
90 | - <template slot="htmlSlot" slot-scope="text"> | |
91 | - <div v-html="text"></div> | |
92 | - </template> | |
93 | - <template slot="imgSlot" slot-scope="text"> | |
94 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
95 | - <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
96 | - </template> | |
97 | - <template slot="fileSlot" slot-scope="text"> | |
98 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
99 | - <a-button | |
100 | - v-else | |
101 | - :ghost="true" | |
102 | - type="primary" | |
103 | - icon="download" | |
104 | - size="small" | |
105 | - @click="downloadFile(text)"> | |
106 | - 下载 | |
107 | - </a-button> | |
108 | - </template> | |
109 | - | |
110 | - <span slot="action" slot-scope="text, record"> | |
111 | - <!--<a @click="handleEdit(record)">编辑</a>--> | |
112 | -<a @click="handleDetail(record)">详情</a> | |
113 | - <a-divider type="vertical" /> | |
114 | - <a-dropdown> | |
115 | - <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
116 | - <a-menu slot="overlay"> | |
117 | - <a-menu-item> | |
118 | - <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
119 | - <a>删除</a> | |
120 | - </a-popconfirm> | |
121 | - </a-menu-item> | |
122 | - </a-menu> | |
123 | - </a-dropdown> | |
124 | - </span> | |
125 | - | |
126 | - </a-table> | |
127 | - </div> | |
128 | - | |
129 | - <apk-info-modal ref="modalForm" @ok="modalFormOk"></apk-info-modal> | |
130 | - </a-card> | |
131 | -</template> | |
132 | - | |
133 | -<script> | |
134 | - import {httpAction, getAction} from '@/api/manage' | |
135 | - import '@/assets/less/TableExpand.less' | |
136 | - import { mixinDevice } from '@/utils/mixin' | |
137 | - import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
138 | - import ApkInfoModal from './modules/ApkInfoModal' | |
139 | - | |
140 | - export default { | |
141 | - name: 'ApkInfoList', | |
142 | - mixins:[JeecgListMixin, mixinDevice], | |
143 | - components: { | |
144 | - ApkInfoModal | |
145 | - }, | |
146 | - data () { | |
147 | - return { | |
148 | - description: 'apk_info管理页面', | |
149 | - // 表头 | |
150 | - columns: [ | |
151 | - { | |
152 | - title: '#', | |
153 | - dataIndex: '', | |
154 | - key:'rowIndex', | |
155 | - width:60, | |
156 | - align:"center", | |
157 | - customRender:function (t,r,index) { | |
158 | - return parseInt(index)+1; | |
159 | - } | |
160 | - }, | |
161 | - { | |
162 | - title:'应用名称', | |
163 | - align:"center", | |
164 | - dataIndex: 'pkgname' | |
165 | - }, | |
166 | - { | |
167 | - title:'版本号', | |
168 | - align:"center", | |
169 | - dataIndex: 'versioncode' | |
170 | - }, | |
171 | - { | |
172 | - title:'版本名称', | |
173 | - align:"center", | |
174 | - dataIndex: 'versionname' | |
175 | - }, | |
176 | - { | |
177 | - title:'下载地址', | |
178 | - align:"center", | |
179 | - dataIndex: 'url', | |
180 | - customRender: function (t, r, index) { | |
181 | - return window._CONFIG['domianURL'] + t | |
182 | - } | |
183 | - }, | |
184 | - { | |
185 | - title:'md5校验码', | |
186 | - align:"center", | |
187 | - dataIndex: 'md5' | |
188 | - }, | |
189 | - { | |
190 | - title: '操作', | |
191 | - dataIndex: 'action', | |
192 | - align:"center", | |
193 | - fixed:"right", | |
194 | - width:147, | |
195 | - scopedSlots: { customRender: 'action' } | |
196 | - } | |
197 | - ], | |
198 | - url: { | |
199 | - list: "/monitor/apkinfo/list", | |
200 | - delete: "/monitor/apkinfo/delete", | |
201 | - deleteBatch: "/monitor/apkinfo/deleteBatch", | |
202 | - exportXlsUrl: "/monitor/apkinfo/exportXls", | |
203 | - importExcelUrl: "monitor/apkinfo/importExcel", | |
204 | - upload: "/sys/common/upload", | |
205 | - parse: "/monitor/apkinfo/parseApk" | |
206 | - }, | |
207 | - dictOptions:{}, | |
208 | - superFieldList:[], | |
209 | - } | |
210 | - }, | |
211 | - created() { | |
212 | - this.getSuperFieldList(); | |
213 | - }, | |
214 | - computed: { | |
215 | - uploadAction() { | |
216 | - return window._CONFIG['domianURL'] + this.url.upload; | |
217 | - }, | |
218 | - importExcelUrl: function(){ | |
219 | - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
220 | - }, | |
221 | - }, | |
222 | - methods: { | |
223 | - beforeUpload(file) { | |
224 | - var fileType = file.type; | |
225 | - if (fileType === 'image') { | |
226 | - if (fileType.indexOf('image') < 0) { | |
227 | - this.$message.warning('请上传图片'); | |
228 | - return false; | |
229 | - } | |
230 | - } else if (fileType === 'file') { | |
231 | - if (fileType.indexOf('image') >= 0) { | |
232 | - this.$message.warning('请上传文件'); | |
233 | - return false; | |
234 | - } | |
235 | - } | |
236 | - return true | |
237 | - }, | |
238 | - handleChange(info) { | |
239 | - if (info.file.status === 'done') { | |
240 | - if (info.file.response.success) { | |
241 | - this.loadData() | |
242 | - this.$message.success(`${info.file.name} 上传成功!`); | |
243 | - this.$options.methods.parseApk(this, info.file.name) | |
244 | - } else { | |
245 | - this.$message.error(`${info.file.response.message}`); | |
246 | - } | |
247 | - } else if (info.file.status === 'error') { | |
248 | - this.$message.error(`${info.file.response.message}`); | |
249 | - } | |
250 | - }, | |
251 | - | |
252 | - parseApk(parent, filename){ | |
253 | - getAction(parent.url.parse, {filename: filename}).then((res) => { | |
254 | - if (res.success) { | |
255 | - parent.loadData() | |
256 | - }else{ | |
257 | - alert("解析apk失败!") | |
258 | - } | |
259 | - }) | |
260 | - }, | |
261 | - initDictConfig(){ | |
262 | - }, | |
263 | - getSuperFieldList(){ | |
264 | - let fieldList=[]; | |
265 | - fieldList.push({type:'string',value:'pkgname',text:'应用名称',dictCode:''}) | |
266 | - fieldList.push({type:'int',value:'versioncode',text:'版本号',dictCode:''}) | |
267 | - fieldList.push({type:'string',value:'versionname',text:'版本名称',dictCode:''}) | |
268 | - fieldList.push({type:'string',value:'url',text:'下载地址',dictCode:''}) | |
269 | - fieldList.push({type:'string',value:'md5',text:'md5校验码',dictCode:''}) | |
270 | - this.superFieldList = fieldList | |
271 | - } | |
272 | - } | |
273 | - } | |
274 | -</script> | |
275 | -<style scoped> | |
276 | - @import '~@assets/less/common.less'; | |
1 | +<template> | |
2 | + <a-card :bordered="false"> | |
3 | + <!-- 查询区域 --> | |
4 | + <div class="table-page-search-wrapper"> | |
5 | + <a-form layout="inline" @keyup.enter.native="searchQuery"> | |
6 | + <a-row :gutter="24"> | |
7 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
8 | + <a-form-item label="应用名称"> | |
9 | + <a-input placeholder="请输入应用名称" v-model="queryParam.pkgname"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <a-form-item label="版本号"> | |
14 | + <a-input placeholder="请输入版本号" v-model="queryParam.versioncode"></a-input> | |
15 | + </a-form-item> | |
16 | + </a-col> | |
17 | + <template v-if="toggleSearchStatus"> | |
18 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
19 | + <a-form-item label="版本名称"> | |
20 | + <a-input placeholder="请输入版本名称" v-model="queryParam.versionname"></a-input> | |
21 | + </a-form-item> | |
22 | + </a-col> | |
23 | + </template> | |
24 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
25 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
26 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
27 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
28 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
29 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
30 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
31 | + </a> | |
32 | + </span> | |
33 | + </a-col> | |
34 | + </a-row> | |
35 | + </a-form> | |
36 | + </div> | |
37 | + <!-- 查询区域-END --> | |
38 | + | |
39 | + <!-- 操作按钮区域 --> | |
40 | + <div class="table-operator"> | |
41 | + <a-upload | |
42 | + name="file" | |
43 | + :multiple="false" | |
44 | + :action="uploadAction" | |
45 | + :headers="tokenHeader" | |
46 | + :showUploadList="false" | |
47 | + :beforeUpload="beforeUpload" | |
48 | + @change="handleChange"> | |
49 | + <a-button> | |
50 | + <a-icon type="upload"/> | |
51 | + 上传APK | |
52 | + </a-button> | |
53 | + </a-upload> | |
54 | + <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>--> | |
55 | + <a-button type="primary" icon="download" @click="handleExportXls('apk_info')">导出</a-button> | |
56 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
57 | + <a-button type="primary" icon="import">导入</a-button> | |
58 | + </a-upload> | |
59 | + <!-- 高级查询区域 --> | |
60 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
61 | + <a-dropdown v-if="selectedRowKeys.length > 0"> | |
62 | + <a-menu slot="overlay"> | |
63 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
64 | + </a-menu> | |
65 | + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
66 | + </a-dropdown> | |
67 | + </div> | |
68 | + | |
69 | + <!-- table区域-begin --> | |
70 | + <div> | |
71 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
72 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
73 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
74 | + </div> | |
75 | + | |
76 | + <a-table | |
77 | + ref="table" | |
78 | + size="middle" | |
79 | + :scroll="{x:true}" | |
80 | + bordered | |
81 | + rowKey="id" | |
82 | + :columns="columns" | |
83 | + :dataSource="dataSource" | |
84 | + :pagination="ipagination" | |
85 | + :loading="loading" | |
86 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
87 | + class="j-table-force-nowrap" | |
88 | + @change="handleTableChange"> | |
89 | + | |
90 | + <template slot="htmlSlot" slot-scope="text"> | |
91 | + <div v-html="text"></div> | |
92 | + </template> | |
93 | + <template slot="imgSlot" slot-scope="text"> | |
94 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
95 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
96 | + </template> | |
97 | + <template slot="fileSlot" slot-scope="text"> | |
98 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
99 | + <a-button | |
100 | + v-else | |
101 | + :ghost="true" | |
102 | + type="primary" | |
103 | + icon="download" | |
104 | + size="small" | |
105 | + @click="downloadFile(text)"> | |
106 | + 下载 | |
107 | + </a-button> | |
108 | + </template> | |
109 | + | |
110 | + <span slot="action" slot-scope="text, record"> | |
111 | + <a @click="handleEdit(record)">编辑</a> | |
112 | +<a @click="handleDetail(record)">详情</a> | |
113 | + <a-divider type="vertical" /> | |
114 | + <a-dropdown> | |
115 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
116 | + <a-menu slot="overlay"> | |
117 | + <a-menu-item> | |
118 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
119 | + <a>删除</a> | |
120 | + </a-popconfirm> | |
121 | + </a-menu-item> | |
122 | + </a-menu> | |
123 | + </a-dropdown> | |
124 | + </span> | |
125 | + | |
126 | + </a-table> | |
127 | + </div> | |
128 | + | |
129 | + <apk-info-modal ref="modalForm" @ok="modalFormOk"></apk-info-modal> | |
130 | + </a-card> | |
131 | +</template> | |
132 | + | |
133 | +<script> | |
134 | + import {httpAction, getAction} from '@/api/manage' | |
135 | + import '@/assets/less/TableExpand.less' | |
136 | + import { mixinDevice } from '@/utils/mixin' | |
137 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
138 | + import ApkInfoModal from './modules/ApkInfoModal' | |
139 | + | |
140 | + export default { | |
141 | + name: 'ApkInfoList', | |
142 | + mixins:[JeecgListMixin, mixinDevice], | |
143 | + components: { | |
144 | + ApkInfoModal | |
145 | + }, | |
146 | + data () { | |
147 | + return { | |
148 | + description: 'apk_info管理页面', | |
149 | + // 表头 | |
150 | + columns: [ | |
151 | + { | |
152 | + title: '#', | |
153 | + dataIndex: '', | |
154 | + key:'rowIndex', | |
155 | + width:60, | |
156 | + align:"center", | |
157 | + customRender:function (t,r,index) { | |
158 | + return parseInt(index)+1; | |
159 | + } | |
160 | + }, | |
161 | + { | |
162 | + title:'应用名称', | |
163 | + align:"center", | |
164 | + dataIndex: 'pkgname' | |
165 | + }, | |
166 | + { | |
167 | + title:'版本号', | |
168 | + align:"center", | |
169 | + dataIndex: 'versioncode' | |
170 | + }, | |
171 | + { | |
172 | + title:'版本名称', | |
173 | + align:"center", | |
174 | + dataIndex: 'versionname' | |
175 | + }, | |
176 | + { | |
177 | + title:'下载地址', | |
178 | + align:"center", | |
179 | + dataIndex: 'url', | |
180 | + customRender: function (t, r, index) { | |
181 | + return window._CONFIG['domianURL'] + t | |
182 | + } | |
183 | + }, | |
184 | + { | |
185 | + title:'md5校验码', | |
186 | + align:"center", | |
187 | + dataIndex: 'md5' | |
188 | + }, | |
189 | + { | |
190 | + title: '操作', | |
191 | + dataIndex: 'action', | |
192 | + align:"center", | |
193 | + fixed:"right", | |
194 | + width:147, | |
195 | + scopedSlots: { customRender: 'action' } | |
196 | + } | |
197 | + ], | |
198 | + url: { | |
199 | + list: "/monitor/apkinfo/list", | |
200 | + delete: "/monitor/apkinfo/delete", | |
201 | + deleteBatch: "/monitor/apkinfo/deleteBatch", | |
202 | + exportXlsUrl: "/monitor/apkinfo/exportXls", | |
203 | + importExcelUrl: "monitor/apkinfo/importExcel", | |
204 | + upload: "/sys/common/upload", | |
205 | + parse: "/monitor/apkinfo/parseApk" | |
206 | + }, | |
207 | + dictOptions:{}, | |
208 | + superFieldList:[], | |
209 | + } | |
210 | + }, | |
211 | + created() { | |
212 | + this.getSuperFieldList(); | |
213 | + }, | |
214 | + computed: { | |
215 | + uploadAction() { | |
216 | + return window._CONFIG['domianURL'] + this.url.upload; | |
217 | + }, | |
218 | + importExcelUrl: function(){ | |
219 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
220 | + }, | |
221 | + }, | |
222 | + methods: { | |
223 | + beforeUpload(file) { | |
224 | + var fileType = file.type; | |
225 | + if (fileType === 'image') { | |
226 | + if (fileType.indexOf('image') < 0) { | |
227 | + this.$message.warning('请上传图片'); | |
228 | + return false; | |
229 | + } | |
230 | + } else if (fileType === 'file') { | |
231 | + if (fileType.indexOf('image') >= 0) { | |
232 | + this.$message.warning('请上传文件'); | |
233 | + return false; | |
234 | + } | |
235 | + } | |
236 | + return true | |
237 | + }, | |
238 | + handleChange(info) { | |
239 | + if (info.file.status === 'done') { | |
240 | + if (info.file.response.success) { | |
241 | + this.loadData() | |
242 | + this.$message.success(`${info.file.name} 上传成功!`); | |
243 | + this.$options.methods.parseApk(this, info.file.name) | |
244 | + } else { | |
245 | + this.$message.error(`${info.file.response.message}`); | |
246 | + } | |
247 | + } else if (info.file.status === 'error') { | |
248 | + this.$message.error(`${info.file.response.message}`); | |
249 | + } | |
250 | + }, | |
251 | + | |
252 | + parseApk(parent, filename){ | |
253 | + getAction(parent.url.parse, {filename: filename}).then((res) => { | |
254 | + if (res.success) { | |
255 | + parent.loadData() | |
256 | + }else{ | |
257 | + alert("解析apk失败!") | |
258 | + } | |
259 | + }) | |
260 | + }, | |
261 | + initDictConfig(){ | |
262 | + }, | |
263 | + getSuperFieldList(){ | |
264 | + let fieldList=[]; | |
265 | + fieldList.push({type:'string',value:'pkgname',text:'应用名称',dictCode:''}) | |
266 | + fieldList.push({type:'int',value:'versioncode',text:'版本号',dictCode:''}) | |
267 | + fieldList.push({type:'string',value:'versionname',text:'版本名称',dictCode:''}) | |
268 | + fieldList.push({type:'string',value:'url',text:'下载地址',dictCode:''}) | |
269 | + fieldList.push({type:'string',value:'md5',text:'md5校验码',dictCode:''}) | |
270 | + this.superFieldList = fieldList | |
271 | + } | |
272 | + } | |
273 | + } | |
274 | +</script> | |
275 | +<style scoped> | |
276 | + @import '~@assets/less/common.less'; | |
277 | 277 | </style> |
278 | 278 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/apkinfo/controller/ApkInfoController.java
1 | -package org.jeecg.modules.wms.monitor.apkinfo.controller; | |
2 | - | |
3 | -import java.io.File; | |
4 | -import java.util.Arrays; | |
5 | -import java.util.List; | |
6 | -import java.util.Map; | |
7 | -import java.util.stream.Collectors; | |
8 | -import java.io.IOException; | |
9 | -import java.io.UnsupportedEncodingException; | |
10 | -import java.net.URLDecoder; | |
11 | -import javax.servlet.http.HttpServletRequest; | |
12 | -import javax.servlet.http.HttpServletResponse; | |
13 | - | |
14 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
15 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
16 | -import net.dongliu.apk.parser.ApkFile; | |
17 | -import net.dongliu.apk.parser.bean.ApkMeta; | |
18 | -import org.jeecg.common.api.vo.Result; | |
19 | -import org.jeecg.common.system.query.QueryGenerator; | |
20 | -import org.jeecg.common.util.IPUtils; | |
21 | -import org.jeecg.common.util.MD5Util; | |
22 | -import org.jeecg.common.util.oConvertUtils; | |
23 | -import org.jeecg.modules.wms.monitor.apkinfo.entity.ApkInfo; | |
24 | -import org.jeecg.modules.wms.monitor.apkinfo.service.IApkInfoService; | |
25 | - | |
26 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
27 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
28 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
29 | -import lombok.extern.slf4j.Slf4j; | |
30 | - | |
31 | -import org.jeecgframework.poi.excel.ExcelImportUtil; | |
32 | -import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
33 | -import org.jeecgframework.poi.excel.entity.ExportParams; | |
34 | -import org.jeecgframework.poi.excel.entity.ImportParams; | |
35 | -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
36 | -import org.jeecg.common.system.base.controller.JeecgController; | |
37 | -import org.springframework.beans.factory.annotation.Autowired; | |
38 | -import org.springframework.beans.factory.annotation.Value; | |
39 | -import org.springframework.web.bind.annotation.*; | |
40 | -import org.springframework.web.multipart.MultipartFile; | |
41 | -import org.springframework.web.multipart.MultipartHttpServletRequest; | |
42 | -import org.springframework.web.servlet.ModelAndView; | |
43 | -import com.alibaba.fastjson.JSON; | |
44 | -import io.swagger.annotations.Api; | |
45 | -import io.swagger.annotations.ApiOperation; | |
46 | -import org.jeecg.common.aspect.annotation.AutoLog; | |
47 | - | |
48 | - /** | |
49 | - * @Description: apk_info | |
50 | - * @Author: jeecg-boot | |
51 | - * @Date: 2023-04-10 | |
52 | - * @Version: V1.0 | |
53 | - */ | |
54 | -@Api(tags="apk_info") | |
55 | -@RestController | |
56 | -@RequestMapping("/monitor/apkinfo") | |
57 | -@Slf4j | |
58 | -public class ApkInfoController extends JeecgController<ApkInfo, IApkInfoService> { | |
59 | - | |
60 | - @Value(value = "${jeecg.path.upload}") | |
61 | - private String uploadpath; | |
62 | - | |
63 | - @Value(value = "${server.servlet.context-path}") | |
64 | - private String ctx; | |
65 | - | |
66 | - @Autowired | |
67 | - private IApkInfoService apkInfoService; | |
68 | - | |
69 | - /** | |
70 | - * 分页列表查询 | |
71 | - * | |
72 | - * @param apkInfo | |
73 | - * @param pageNo | |
74 | - * @param pageSize | |
75 | - * @param req | |
76 | - * @return | |
77 | - */ | |
78 | - //@AutoLog(value = "apk_info-分页列表查询") | |
79 | - @ApiOperation(value="apk_info-分页列表查询", notes="apk_info-分页列表查询") | |
80 | - @GetMapping(value = "/list") | |
81 | - public Result<IPage<ApkInfo>> queryPageList(ApkInfo apkInfo, | |
82 | - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
83 | - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
84 | - HttpServletRequest req) { | |
85 | - QueryWrapper<ApkInfo> queryWrapper = QueryGenerator.initQueryWrapper(apkInfo, req.getParameterMap()); | |
86 | - queryWrapper.orderByDesc("id"); | |
87 | - Page<ApkInfo> page = new Page<ApkInfo>(pageNo, pageSize); | |
88 | - IPage<ApkInfo> pageList = apkInfoService.page(page, queryWrapper); | |
89 | - return Result.OK(pageList); | |
90 | - } | |
91 | - | |
92 | - /** | |
93 | - * 添加 | |
94 | - * | |
95 | - * @param apkInfo | |
96 | - * @return | |
97 | - */ | |
98 | - @AutoLog(value = "apk_info-添加") | |
99 | - @ApiOperation(value="apk_info-添加", notes="apk_info-添加") | |
100 | - @PostMapping(value = "/add") | |
101 | - public Result<String> add(@RequestBody ApkInfo apkInfo) { | |
102 | - apkInfoService.save(apkInfo); | |
103 | - return Result.OK("添加成功!"); | |
104 | - } | |
105 | - | |
106 | - /** | |
107 | - * 编辑 | |
108 | - * | |
109 | - * @param apkInfo | |
110 | - * @return | |
111 | - */ | |
112 | - @AutoLog(value = "apk_info-编辑") | |
113 | - @ApiOperation(value="apk_info-编辑", notes="apk_info-编辑") | |
114 | - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |
115 | - public Result<String> edit(@RequestBody ApkInfo apkInfo) { | |
116 | - apkInfoService.updateById(apkInfo); | |
117 | - return Result.OK("编辑成功!"); | |
118 | - } | |
119 | - | |
120 | - /** | |
121 | - * 通过id删除 | |
122 | - * | |
123 | - * @param id | |
124 | - * @return | |
125 | - */ | |
126 | - @AutoLog(value = "apk_info-通过id删除") | |
127 | - @ApiOperation(value="apk_info-通过id删除", notes="apk_info-通过id删除") | |
128 | - @DeleteMapping(value = "/delete") | |
129 | - public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |
130 | - apkInfoService.removeById(id); | |
131 | - return Result.OK("删除成功!"); | |
132 | - } | |
133 | - | |
134 | - /** | |
135 | - * 批量删除 | |
136 | - * | |
137 | - * @param ids | |
138 | - * @return | |
139 | - */ | |
140 | - @AutoLog(value = "apk_info-批量删除") | |
141 | - @ApiOperation(value="apk_info-批量删除", notes="apk_info-批量删除") | |
142 | - @DeleteMapping(value = "/deleteBatch") | |
143 | - public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
144 | - this.apkInfoService.removeByIds(Arrays.asList(ids.split(","))); | |
145 | - return Result.OK("批量删除成功!"); | |
146 | - } | |
147 | - | |
148 | - /** | |
149 | - * 通过id查询 | |
150 | - * | |
151 | - * @param id | |
152 | - * @return | |
153 | - */ | |
154 | - //@AutoLog(value = "apk_info-通过id查询") | |
155 | - @ApiOperation(value="apk_info-通过id查询", notes="apk_info-通过id查询") | |
156 | - @GetMapping(value = "/queryById") | |
157 | - public Result<ApkInfo> queryById(@RequestParam(name="id",required=true) String id) { | |
158 | - ApkInfo apkInfo = apkInfoService.getById(id); | |
159 | - if(apkInfo==null) { | |
160 | - return Result.error("未找到对应数据"); | |
161 | - } | |
162 | - return Result.OK(apkInfo); | |
163 | - } | |
164 | - | |
165 | - @ApiOperation(value="解析apk", notes="解析apk") | |
166 | - @GetMapping(value = "/parseApk") | |
167 | - public Result<ApkInfo> parseApk(@RequestParam(name="filename",required=true) String filename) { | |
168 | - try { | |
169 | - File file = new File(uploadpath + File.separator + filename); | |
170 | - String md5 = MD5Util.MD5Encode(filename, "utf-8"); | |
171 | - ApkFile apkFile = new ApkFile(file.getAbsoluteFile()); | |
172 | - ApkMeta apkMeta = apkFile.getApkMeta(); | |
173 | - | |
174 | - LambdaQueryWrapper<ApkInfo> query = Wrappers.lambdaQuery(); | |
175 | - query.eq(ApkInfo::getPkgname, apkMeta.getPackageName()) | |
176 | - .eq(ApkInfo::getVersioncode, apkMeta.getVersionCode()); | |
177 | - | |
178 | - ApkInfo apkinfo = apkInfoService.getOne(query); | |
179 | - | |
180 | - apkinfo.setUrl("/sys/common/static/" + filename); | |
181 | - apkinfo.setPkgname(apkMeta.getPackageName()); | |
182 | - apkinfo.setVersioncode(apkMeta.getVersionCode().intValue()); | |
183 | - apkinfo.setVersionname(apkMeta.getVersionName()); | |
184 | - apkinfo.setMd5(md5); | |
185 | - apkInfoService.saveOrUpdate(apkinfo); | |
186 | - | |
187 | - return Result.OK(apkinfo); | |
188 | - }catch (Exception e){ | |
189 | - return Result.error(e.getMessage()); | |
190 | - } | |
191 | - } | |
192 | - | |
193 | - /** | |
194 | - * 导出excel | |
195 | - * | |
196 | - * @param request | |
197 | - * @param apkInfo | |
198 | - */ | |
199 | - @RequestMapping(value = "/exportXls") | |
200 | - public ModelAndView exportXls(HttpServletRequest request, ApkInfo apkInfo) { | |
201 | - return super.exportXls(request, apkInfo, ApkInfo.class, "apk_info"); | |
202 | - } | |
203 | - | |
204 | - /** | |
205 | - * 通过excel导入数据 | |
206 | - * | |
207 | - * @param request | |
208 | - * @param response | |
209 | - * @return | |
210 | - */ | |
211 | - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
212 | - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
213 | - return super.importExcel(request, response, ApkInfo.class); | |
214 | - } | |
215 | - | |
216 | -} | |
1 | +package org.jeecg.modules.wms.monitor.apkinfo.controller; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.util.Arrays; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | +import java.util.stream.Collectors; | |
8 | +import java.io.IOException; | |
9 | +import java.io.UnsupportedEncodingException; | |
10 | +import java.net.URLDecoder; | |
11 | +import javax.servlet.http.HttpServletRequest; | |
12 | +import javax.servlet.http.HttpServletResponse; | |
13 | + | |
14 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
15 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
16 | +import net.dongliu.apk.parser.ApkFile; | |
17 | +import net.dongliu.apk.parser.bean.ApkMeta; | |
18 | +import org.jeecg.common.api.vo.Result; | |
19 | +import org.jeecg.common.system.query.QueryGenerator; | |
20 | +import org.jeecg.common.util.IPUtils; | |
21 | +import org.jeecg.common.util.MD5Util; | |
22 | +import org.jeecg.common.util.oConvertUtils; | |
23 | +import org.jeecg.modules.wms.monitor.apkinfo.entity.ApkInfo; | |
24 | +import org.jeecg.modules.wms.monitor.apkinfo.service.IApkInfoService; | |
25 | + | |
26 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
27 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
28 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
29 | +import lombok.extern.slf4j.Slf4j; | |
30 | + | |
31 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | |
32 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
33 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
34 | +import org.jeecgframework.poi.excel.entity.ImportParams; | |
35 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
36 | +import org.jeecg.common.system.base.controller.JeecgController; | |
37 | +import org.springframework.beans.factory.annotation.Autowired; | |
38 | +import org.springframework.beans.factory.annotation.Value; | |
39 | +import org.springframework.web.bind.annotation.*; | |
40 | +import org.springframework.web.multipart.MultipartFile; | |
41 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
42 | +import org.springframework.web.servlet.ModelAndView; | |
43 | +import com.alibaba.fastjson.JSON; | |
44 | +import io.swagger.annotations.Api; | |
45 | +import io.swagger.annotations.ApiOperation; | |
46 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
47 | + | |
48 | + /** | |
49 | + * @Description: apk_info | |
50 | + * @Author: jeecg-boot | |
51 | + * @Date: 2023-04-10 | |
52 | + * @Version: V1.0 | |
53 | + */ | |
54 | +@Api(tags="apk_info") | |
55 | +@RestController | |
56 | +@RequestMapping("/monitor/apkinfo") | |
57 | +@Slf4j | |
58 | +public class ApkInfoController extends JeecgController<ApkInfo, IApkInfoService> { | |
59 | + | |
60 | + @Value(value = "${jeecg.path.upload}") | |
61 | + private String uploadpath; | |
62 | + | |
63 | + @Value(value = "${server.servlet.context-path}") | |
64 | + private String ctx; | |
65 | + | |
66 | + @Autowired | |
67 | + private IApkInfoService apkInfoService; | |
68 | + | |
69 | + /** | |
70 | + * 分页列表查询 | |
71 | + * | |
72 | + * @param apkInfo | |
73 | + * @param pageNo | |
74 | + * @param pageSize | |
75 | + * @param req | |
76 | + * @return | |
77 | + */ | |
78 | + //@AutoLog(value = "apk_info-分页列表查询") | |
79 | + @ApiOperation(value="apk_info-分页列表查询", notes="apk_info-分页列表查询") | |
80 | + @GetMapping(value = "/list") | |
81 | + public Result<IPage<ApkInfo>> queryPageList(ApkInfo apkInfo, | |
82 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
83 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
84 | + HttpServletRequest req) { | |
85 | + QueryWrapper<ApkInfo> queryWrapper = QueryGenerator.initQueryWrapper(apkInfo, req.getParameterMap()); | |
86 | + queryWrapper.orderByDesc("id"); | |
87 | + Page<ApkInfo> page = new Page<ApkInfo>(pageNo, pageSize); | |
88 | + IPage<ApkInfo> pageList = apkInfoService.page(page, queryWrapper); | |
89 | + return Result.OK(pageList); | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * 添加 | |
94 | + * | |
95 | + * @param apkInfo | |
96 | + * @return | |
97 | + */ | |
98 | + @AutoLog(value = "apk_info-添加") | |
99 | + @ApiOperation(value="apk_info-添加", notes="apk_info-添加") | |
100 | + @PostMapping(value = "/add") | |
101 | + public Result<String> add(@RequestBody ApkInfo apkInfo) { | |
102 | + apkInfoService.save(apkInfo); | |
103 | + return Result.OK("添加成功!"); | |
104 | + } | |
105 | + | |
106 | + /** | |
107 | + * 编辑 | |
108 | + * | |
109 | + * @param apkInfo | |
110 | + * @return | |
111 | + */ | |
112 | + @AutoLog(value = "apk_info-编辑") | |
113 | + @ApiOperation(value="apk_info-编辑", notes="apk_info-编辑") | |
114 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |
115 | + public Result<String> edit(@RequestBody ApkInfo apkInfo) { | |
116 | + apkInfoService.updateById(apkInfo); | |
117 | + return Result.OK("编辑成功!"); | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * 通过id删除 | |
122 | + * | |
123 | + * @param id | |
124 | + * @return | |
125 | + */ | |
126 | + @AutoLog(value = "apk_info-通过id删除") | |
127 | + @ApiOperation(value="apk_info-通过id删除", notes="apk_info-通过id删除") | |
128 | + @DeleteMapping(value = "/delete") | |
129 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |
130 | + apkInfoService.removeById(id); | |
131 | + return Result.OK("删除成功!"); | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * 批量删除 | |
136 | + * | |
137 | + * @param ids | |
138 | + * @return | |
139 | + */ | |
140 | + @AutoLog(value = "apk_info-批量删除") | |
141 | + @ApiOperation(value="apk_info-批量删除", notes="apk_info-批量删除") | |
142 | + @DeleteMapping(value = "/deleteBatch") | |
143 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
144 | + this.apkInfoService.removeByIds(Arrays.asList(ids.split(","))); | |
145 | + return Result.OK("批量删除成功!"); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 通过id查询 | |
150 | + * | |
151 | + * @param id | |
152 | + * @return | |
153 | + */ | |
154 | + //@AutoLog(value = "apk_info-通过id查询") | |
155 | + @ApiOperation(value="apk_info-通过id查询", notes="apk_info-通过id查询") | |
156 | + @GetMapping(value = "/queryById") | |
157 | + public Result<ApkInfo> queryById(@RequestParam(name="id",required=true) String id) { | |
158 | + ApkInfo apkInfo = apkInfoService.getById(id); | |
159 | + if(apkInfo==null) { | |
160 | + return Result.error("未找到对应数据"); | |
161 | + } | |
162 | + return Result.OK(apkInfo); | |
163 | + } | |
164 | + | |
165 | + @ApiOperation(value="解析apk", notes="解析apk") | |
166 | + @GetMapping(value = "/parseApk") | |
167 | + public Result<ApkInfo> parseApk(@RequestParam(name="filename",required=true) String filename) { | |
168 | + try { | |
169 | + File file = new File(uploadpath + File.separator + filename); | |
170 | + String md5 = MD5Util.MD5Encode(filename, "utf-8"); | |
171 | + ApkFile apkFile = new ApkFile(file.getAbsoluteFile()); | |
172 | + ApkMeta apkMeta = apkFile.getApkMeta(); | |
173 | + | |
174 | + LambdaQueryWrapper<ApkInfo> query = Wrappers.lambdaQuery(); | |
175 | + query.eq(ApkInfo::getPkgname, apkMeta.getPackageName()) | |
176 | + .eq(ApkInfo::getVersioncode, apkMeta.getVersionCode()); | |
177 | + | |
178 | + ApkInfo apkinfo = apkInfoService.getOne(query); | |
179 | + | |
180 | + if(apkinfo==null){ | |
181 | + apkinfo = new ApkInfo(); | |
182 | + } | |
183 | + apkinfo.setUrl("/sys/common/static/" + filename); | |
184 | + apkinfo.setPkgname(apkMeta.getPackageName()); | |
185 | + apkinfo.setVersioncode(apkMeta.getVersionCode().intValue()); | |
186 | + apkinfo.setVersionname(apkMeta.getVersionName()); | |
187 | + apkinfo.setMd5(md5); | |
188 | + apkInfoService.saveOrUpdate(apkinfo); | |
189 | + | |
190 | + return Result.OK(apkinfo); | |
191 | + }catch (Exception e){ | |
192 | + return Result.error(e.getMessage()); | |
193 | + } | |
194 | + } | |
195 | + | |
196 | + /** | |
197 | + * 导出excel | |
198 | + * | |
199 | + * @param request | |
200 | + * @param apkInfo | |
201 | + */ | |
202 | + @RequestMapping(value = "/exportXls") | |
203 | + public ModelAndView exportXls(HttpServletRequest request, ApkInfo apkInfo) { | |
204 | + return super.exportXls(request, apkInfo, ApkInfo.class, "apk_info"); | |
205 | + } | |
206 | + | |
207 | + /** | |
208 | + * 通过excel导入数据 | |
209 | + * | |
210 | + * @param request | |
211 | + * @param response | |
212 | + * @return | |
213 | + */ | |
214 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
215 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
216 | + return super.importExcel(request, response, ApkInfo.class); | |
217 | + } | |
218 | + | |
219 | +} | |
... | ... |