Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppTag
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
AppTag
Commits
1e655f0e
Commit
1e655f0e
authored
Dec 04, 2020
by
jinfeng.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init tree_tag
parent
51707a81
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
871 additions
and
4 deletions
+871
-4
pom.xml
pom.xml
+5
-0
ApptagApplication.java
src/main/java/com/mobvista/apptag/ApptagApplication.java
+3
-0
TreeTagController.java
...ava/com/mobvista/apptag/controller/TreeTagController.java
+139
-0
TreeTag.java
src/main/java/com/mobvista/apptag/entity/TreeTag.java
+84
-0
TreeTagDao.java
src/main/java/com/mobvista/apptag/mapper/TreeTagDao.java
+78
-0
TreeTagService.java
...main/java/com/mobvista/apptag/service/TreeTagService.java
+23
-0
TreeTagServiceImpl.java
.../com/mobvista/apptag/service/impl/TreeTagServiceImpl.java
+113
-0
PropertyUtil.java
src/main/java/com/mobvista/apptag/utils/PropertyUtil.java
+54
-0
application.properties
src/main/resources/application.properties
+7
-2
application.yml
src/main/resources/application.yml
+1
-1
config.properties
src/main/resources/config.properties
+4
-0
favicons.ico
src/main/resources/static/favicons.ico
+0
-0
photo.jpg
src/main/resources/static/img/photo.jpg
+0
-0
edit.js
src/main/resources/static/js/appjs/tree_tag/edit.js
+99
-0
jquery-3.3.1.min.js
...urces/static/js/appjs/tree_tag/jquery/jquery-3.3.1.min.js
+0
-0
list.js
src/main/resources/static/js/appjs/tree_tag/list.js
+87
-0
include.html
src/main/resources/templates/include.html
+2
-0
index.html
src/main/resources/templates/index.html
+11
-1
edit.html
src/main/resources/templates/tree_tag/edit.html
+113
-0
list.html
src/main/resources/templates/tree_tag/list.html
+48
-0
No files found.
pom.xml
View file @
1e655f0e
...
...
@@ -98,6 +98,11 @@
<artifactId>
gson
</artifactId>
<version>
2.8.5
</version>
</dependency>
<dependency>
<groupId>
com.amazonaws
</groupId>
<artifactId>
aws-java-sdk-s3
</artifactId>
<version>
1.11.437
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/mobvista/apptag/ApptagApplication.java
View file @
1e655f0e
package
com
.
mobvista
.
apptag
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
javax.servlet.ServletContext
;
@EnableTransactionManagement
@ServletComponentScan
@SpringBootApplication
...
...
src/main/java/com/mobvista/apptag/controller/TreeTagController.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
controller
;
import
com.google.gson.JsonObject
;
import
com.mobvista.apptag.entity.TreeTag
;
import
com.mobvista.apptag.mapper.TreeTagDao
;
import
com.mobvista.apptag.service.TreeTagService
;
import
com.mobvista.apptag.utils.GsonUtil
;
import
com.mobvista.apptag.utils.PageUtil
;
import
com.mobvista.apptag.utils.PropertyUtil
;
import
com.mobvista.apptag.utils.Query
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.utils.URIBuilder
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.ServletContext
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author wangjf
*/
@Controller
@RequestMapping
(
"/tree_tag"
)
public
class
TreeTagController
{
@Autowired
private
TreeTagService
treeTagService
;
@Autowired
private
TreeTagDao
treeTagDao
;
@Autowired
ServletContext
context
;
public
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TreeTagController
.
class
);
@PostMapping
(
"/list"
)
@ResponseBody
public
PageUtil
list
(
@RequestBody
Query
query
)
{
List
<
TreeTag
>
tags
=
treeTagService
.
list
(
query
);
int
total
=
treeTagService
.
count
(
query
);
PageUtil
pageUtil
=
new
PageUtil
(
tags
,
total
);
return
pageUtil
;
}
@GetMapping
(
""
)
String
list
()
{
return
"tree_tag/list"
;
}
@PostMapping
(
"/upload"
)
@ResponseBody
public
String
upload
(
@RequestParam
(
"file"
)
MultipartFile
multipartFile
)
{
String
rootPath
=
PropertyUtil
.
getProperty
(
"app_tag.path"
);
if
(
multipartFile
.
isEmpty
())
{
return
"上传失败,请选择文件!"
;
}
String
fileName
=
multipartFile
.
getOriginalFilename
();
File
dest
=
new
File
(
rootPath
+
"/"
+
fileName
);
if
(
dest
.
exists
())
{
dest
.
delete
();
}
try
{
multipartFile
.
transferTo
(
dest
);
logger
.
info
(
"上传成功"
);
treeTagDao
.
delete
();
if
(
treeTagService
.
writeToMysql
(
dest
))
{
return
"上传成功"
;
}
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
toString
(),
e
);
}
return
"上传失败!"
;
}
public
static
String
execAZ
()
throws
URISyntaxException
{
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
List
<
BasicNameValuePair
>
formparams
=
new
ArrayList
<>();
String
AZ_URL
=
PropertyUtil
.
getProperty
(
"azkaban.server.http"
);
final
String
serverUrl
=
AZ_URL
+
"azkaban/execute"
;
URIBuilder
uri
=
new
URIBuilder
();
try
{
uri
=
new
URIBuilder
(
serverUrl
).
addParameter
(
"projectName"
,
""
)
.
addParameter
(
"flowName"
,
""
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
}
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setConnectTimeout
(
1000
).
setConnectionRequestTimeout
(
1000
)
.
setSocketTimeout
(
1000
).
build
();
final
HttpGet
httpGet
=
new
HttpGet
(
uri
.
build
());
String
execId
=
""
;
CloseableHttpResponse
response
;
try
{
response
=
client
.
execute
(
httpGet
);
BufferedReader
rd
=
new
BufferedReader
(
new
InputStreamReader
(
response
.
getEntity
().
getContent
()));
StringBuilder
result
=
new
StringBuilder
();
String
line
;
while
((
line
=
rd
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
}
JsonObject
jsonObject
=
GsonUtil
.
String2JsonObject
(
result
.
toString
());
if
(
jsonObject
.
get
(
"code"
).
getAsInt
()
==
200
)
{
execId
=
jsonObject
.
get
(
"execId"
).
getAsString
();
}
}
catch
(
IOException
e
)
{
logger
.
info
(
"Execute Failed!!!"
);
}
finally
{
httpGet
.
abort
();
}
return
execId
;
}
}
\ No newline at end of file
src/main/java/com/mobvista/apptag/entity/TreeTag.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
entity
;
import
com.gitee.sunchenbin.mybatis.actable.annotation.Column
;
import
com.gitee.sunchenbin.mybatis.actable.annotation.Table
;
import
com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author wangjf
*/
@Table
(
name
=
"tree_tag_list"
)
public
class
TreeTag
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1507448849738387249L
;
// APP 包名
@Column
(
name
=
"package_name"
,
type
=
MySqlTypeConstant
.
VARCHAR
,
isNull
=
false
)
private
String
packageName
;
// 平台类型
@Column
(
name
=
"platform"
,
type
=
MySqlTypeConstant
.
VARCHAR
,
length
=
10
)
private
String
platform
;
// 一级标签
@Column
(
name
=
"first_tag"
,
type
=
MySqlTypeConstant
.
VARCHAR
)
private
String
firstTag
;
// 二级标签
@Column
(
name
=
"second_tag"
,
type
=
MySqlTypeConstant
.
VARCHAR
)
private
String
secondTag
;
// 三级标签
@Column
(
name
=
"third_tag"
,
type
=
MySqlTypeConstant
.
VARCHAR
)
private
String
thirdTag
;
// 入库时间
@Column
(
name
=
"update_time"
,
type
=
MySqlTypeConstant
.
DATETIME
)
private
Date
updateTime
;
public
String
getPackageName
()
{
return
packageName
;
}
public
void
setPackageName
(
String
packageName
)
{
this
.
packageName
=
packageName
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
public
String
getFirstTag
()
{
return
firstTag
;
}
public
void
setFirstTag
(
String
firstTag
)
{
this
.
firstTag
=
firstTag
;
}
public
String
getSecondTag
()
{
return
secondTag
;
}
public
void
setSecondTag
(
String
secondTag
)
{
this
.
secondTag
=
secondTag
;
}
public
String
getThirdTag
()
{
return
thirdTag
;
}
public
void
setThirdTag
(
String
thirdTag
)
{
this
.
thirdTag
=
thirdTag
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
src/main/java/com/mobvista/apptag/mapper/TreeTagDao.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
mapper
;
import
com.mobvista.apptag.entity.TreeTag
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.*
;
import
java.text.MessageFormat
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author wangjf
*/
public
interface
TreeTagDao
{
@InsertProvider
(
type
=
Provider
.
class
,
method
=
"batchInsert"
)
boolean
batchInsert
(
List
<
TreeTag
>
results
);
class
Provider
{
/**
* 批量插入
*/
public
String
batchInsert
(
Map
map
)
{
List
<
TreeTag
>
results
=
(
List
<
TreeTag
>)
map
.
get
(
"list"
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"REPLACE INTO tree_tag_list (package_name, platform, first_tag, second_tag, third_tag, update_time) VALUES "
);
MessageFormat
mf
=
new
MessageFormat
(
"(#'{'list[{0}].packageName}, #'{'list[{0}].platform}, #'{'list[{0}].firstTag}, #'{'list[{0}].secondTag}, #'{'list[{0}].thirdTag}, #'{'list[{0}].updateTime})"
);
for
(
int
i
=
0
;
i
<
results
.
size
();
i
++)
{
sb
.
append
(
mf
.
format
(
new
Object
[]{
i
}));
if
(
i
<
results
.
size
()
-
1
)
{
sb
.
append
(
","
);
}
}
return
sb
.
toString
();
}
}
@Delete
(
"DELETE FROM tree_tag_list"
)
void
delete
();
@SelectProvider
(
type
=
ListMapperProvider
.
class
,
method
=
"list"
)
@Results
({
@Result
(
property
=
"packageName"
,
column
=
"package_name"
),
@Result
(
property
=
"platform"
,
column
=
"platform"
),
@Result
(
property
=
"firstTag"
,
column
=
"first_tag"
),
@Result
(
property
=
"secondTag"
,
column
=
"second_tag"
),
@Result
(
property
=
"thirdTag"
,
column
=
"third_tag"
),
@Result
(
property
=
"updateTime"
,
column
=
"update_time"
)})
List
<
TreeTag
>
list
(
String
search
);
class
ListMapperProvider
{
public
String
list
(
String
search
)
{
String
sql
=
"SELECT * FROM tree_tag_list"
;
if
(
StringUtils
.
isNotBlank
(
search
))
{
sql
+=
" WHERE LOWER(package_name) LIKE '%"
+
search
.
toLowerCase
()
+
"%'"
;
}
return
sql
;
}
}
@SelectProvider
(
type
=
CountMapperProvider
.
class
,
method
=
"count"
)
int
count
(
String
search
);
class
CountMapperProvider
{
public
String
count
(
String
search
)
{
String
sql
=
"SELECT COUNT(1) FROM tree_tag_list"
;
if
(
StringUtils
.
isNotBlank
(
search
))
{
sql
+=
" WHERE LOWER(package_name) LIKE '%"
+
search
.
toLowerCase
()
+
"%'"
;
}
return
sql
;
}
}
}
\ No newline at end of file
src/main/java/com/mobvista/apptag/service/TreeTagService.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
service
;
import
com.mobvista.apptag.entity.TreeTag
;
import
com.mobvista.apptag.utils.Query
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.List
;
/**
* @author wangjf
*/
public
interface
TreeTagService
{
List
<
TreeTag
>
list
(
Query
query
);
int
count
(
Query
query
);
boolean
writeToMysql
(
File
file
)
throws
IOException
;
}
\ No newline at end of file
src/main/java/com/mobvista/apptag/service/impl/TreeTagServiceImpl.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
service
.
impl
;
import
com.github.pagehelper.PageHelper
;
import
com.mobvista.apptag.entity.TreeTag
;
import
com.mobvista.apptag.mapper.TreeTagDao
;
import
com.mobvista.apptag.service.TreeTagService
;
import
com.mobvista.apptag.utils.Query
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.regex.Pattern
;
/**
* @package: com.mobvista.apptag.service.impl
* @author: wangjf
* @date: 2020/12/3
* @time: 2:15 下午
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
@Service
(
"treeTagService"
)
public
class
TreeTagServiceImpl
implements
TreeTagService
{
Pattern
idIosPkgPtn
=
Pattern
.
compile
(
"^id\\d+$"
);
Pattern
iosPkgPtn
=
Pattern
.
compile
(
"^\\d+$"
);
Pattern
adrPkgPtn
=
Pattern
.
compile
(
"^(?=^.{3,255}$)[-a-zA-Z0-9_][-a-zA-Z0-9_]{0,62}(\\.[a-zA-Z0-9_][-a-zA-Z0-9_]{0,62})+$"
);
Pattern
strPtn
=
Pattern
.
compile
(
"^[-& a-zA-Z0-9]+$"
);
@Autowired
private
TreeTagDao
treeTagDao
;
@Override
public
List
<
TreeTag
>
list
(
Query
query
)
{
PageHelper
.
startPage
(
query
.
getOffset
()
/
query
.
getLimit
()
+
1
,
query
.
getLimit
());
return
treeTagDao
.
list
(
query
.
getSearch
());
}
@Override
public
int
count
(
Query
query
)
{
return
treeTagDao
.
count
(
query
.
getSearch
());
}
@Override
public
boolean
writeToMysql
(
File
file
)
throws
IOException
{
String
encoding
=
"UTF8"
;
// 考虑到编码格式
InputStreamReader
read
=
new
InputStreamReader
(
new
FileInputStream
(
file
),
encoding
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
read
);
String
lineTxt
;
List
<
TreeTag
>
list
=
new
ArrayList
<>();
while
((
lineTxt
=
bufferedReader
.
readLine
())
!=
null
)
{
TreeTag
treeTag
=
new
TreeTag
();
String
[]
strings
=
lineTxt
.
replaceAll
(
"\uFEFF"
,
""
).
split
(
","
,
-
1
);
String
packageName
=
strings
[
0
].
trim
();
String
firstTag
=
strings
[
1
];
String
secondTag
=
strings
[
2
];
String
thirdTag
=
strings
[
3
];
String
platform
=
""
;
if
(
idIosPkgPtn
.
matcher
(
packageName
).
matches
())
{
packageName
=
packageName
.
replace
(
"id"
,
""
);
}
if
(
iosPkgPtn
.
matcher
(
packageName
).
matches
())
{
platform
=
"ios"
;
}
else
if
(
adrPkgPtn
.
matcher
(
packageName
).
matches
())
{
platform
=
"android"
;
}
treeTag
.
setPackageName
(
packageName
);
treeTag
.
setPlatform
(
platform
);
if
(
strPtn
.
matcher
(
firstTag
).
matches
())
{
treeTag
.
setFirstTag
(
firstTag
);
}
if
(
strPtn
.
matcher
(
secondTag
).
matches
())
{
treeTag
.
setSecondTag
(
secondTag
);
}
else
{
treeTag
.
setSecondTag
(
""
);
}
if
(
strPtn
.
matcher
(
thirdTag
).
matches
())
{
treeTag
.
setThirdTag
(
thirdTag
);
}
else
{
treeTag
.
setThirdTag
(
""
);
}
treeTag
.
setUpdateTime
(
new
Date
());
list
.
add
(
treeTag
);
}
bufferedReader
.
close
();
read
.
close
();
if
(
batchInsert
(
list
))
{
return
true
;
}
return
false
;
}
public
boolean
batchInsert
(
List
<
TreeTag
>
list
)
{
for
(
int
i
=
0
;
i
<=
list
.
size
()
/
1000
;
i
++)
{
int
startIndex
=
i
*
1000
;
int
endIndex
;
if
((
i
+
1
)
*
1000
>
list
.
size
())
{
endIndex
=
list
.
size
();
}
else
{
endIndex
=
(
i
+
1
)
*
1000
;
}
if
(!
treeTagDao
.
batchInsert
(
list
.
subList
(
startIndex
,
endIndex
)))
{
return
false
;
}
}
return
true
;
}
}
src/main/java/com/mobvista/apptag/utils/PropertyUtil.java
0 → 100644
View file @
1e655f0e
package
com
.
mobvista
.
apptag
.
utils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Properties
;
/**
* @package: com.mobvista.apptag.utils
* @author: wangjf
* @date: 2019-07-22
* @time: 15:02
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public
class
PropertyUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PropertyUtil
.
class
);
private
static
Properties
props
;
static
{
loadProps
();
}
synchronized
static
private
void
loadProps
()
{
logger
.
info
(
"start to load properties......."
);
props
=
new
Properties
();
InputStream
in
=
null
;
try
{
in
=
PropertyUtil
.
class
.
getClassLoader
().
getResourceAsStream
(
"config.properties"
);
props
.
load
(
in
);
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
IOException
e
)
{
}
finally
{
try
{
if
(
null
!=
in
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
}
}
}
public
static
String
getProperty
(
String
key
)
{
if
(
null
==
props
)
{
loadProps
();
}
return
props
.
getProperty
(
key
);
}
}
src/main/resources/application.properties
View file @
1e655f0e
...
...
@@ -7,4 +7,9 @@ mybatis.table.auto=none
mybatis.model.pack
=
com.mobvista.apptag.entity
mybatis.database.type
=
mysql
\ No newline at end of file
mybatis.database.type
=
mysql
# 上传文件总的最大值
spring.servlet.multipart.max-request-size
=
10MB
# 单个文件的最大值
spring.servlet.multipart.max-file-size
=
10MB
\ No newline at end of file
src/main/resources/application.yml
View file @
1e655f0e
...
...
@@ -5,7 +5,7 @@ server:
spring
:
datasource
:
driver-class-name
:
com.mysql.jdbc.Driver
url
:
jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8
url
:
jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?
&useSSL=false&
useUnicode=true&characterEncoding=utf8
username
:
apptag_rw
password
:
7gyLEVtkER3u8c9
...
...
src/main/resources/config.properties
0 → 100644
View file @
1e655f0e
app_tag.path
=
/home/mobdev/workspace/AppTag/output/app_tag
azkaban.server.http
=
http://ip-172-31-29-117:8688/
\ No newline at end of file
src/main/resources/static/favicon.ico
→
src/main/resources/static/favicon
s
.ico
View file @
1e655f0e
File moved
src/main/resources/static/img/photo
_s
.jpg
→
src/main/resources/static/img/photo.jpg
View file @
1e655f0e
File moved
src/main/resources/static/js/appjs/tree_tag/edit.js
0 → 100644
View file @
1e655f0e
// 以下为官方示例
// 以下为官方示例
$
().
ready
(
function
()
{
validateRule
();
var
data
=
document
.
getElementById
(
"firstCategory"
).
value
;
var
secondData
=
document
.
getElementById
(
"secondCategory"
).
value
;
// console.log(JSON.parse(data));
// $("#signupForm").validate()
refreshMultiSelect
(
JSON
.
parse
(
data
),
JSON
.
parse
(
secondData
));
});
$
.
validator
.
setDefaults
({
submitHandler
:
function
()
{
update
();
}
});
function
update
()
{
$
.
ajax
({
cache
:
true
,
type
:
"POST"
,
url
:
"/tag/save"
,
data
:
$
(
'#signupForm'
).
serialize
(),
// 你的formid
async
:
false
,
error
:
function
(
request
)
{
alert
(
"Connection error"
);
},
success
:
function
(
data
)
{
if
(
data
.
code
==
0
)
{
parent
.
layer
.
msg
(
data
.
msg
);
parent
.
reLoad
();
var
index
=
parent
.
layer
.
getFrameIndex
(
window
.
name
);
// 获取窗口索引
parent
.
layer
.
close
(
index
);
}
else
{
parent
.
layer
.
msg
(
data
.
msg
);
}
}
});
}
function
validateRule
()
{
var
icon
=
"<i class='fa fa-times-circle'></i> "
;
$
(
"#signupForm"
).
validate
({
rules
:
{
packageName
:
{
required
:
true
}
},
messages
:
{
packageName
:
{
required
:
"必须输入"
}
}
})
}
function
refreshMultiSelect
(
json
,
secondJson
)
{
// $('#categoryCode').html("");
var
data
=
""
for
(
var
i
=
0
;
i
<
json
.
length
;
i
++
)
{
data
+=
"<optgroup label='"
+
json
[
i
].
firstTag
+
"'>"
;
for
(
var
j
=
0
;
j
<
secondJson
.
length
;
j
++
)
{
if
(
json
[
i
].
firstId
==
secondJson
[
j
].
firstId
)
{
data
+=
"<option value=
\"
"
+
secondJson
[
j
].
secondId
+
"
\"
>"
+
secondJson
[
j
].
secondTag
+
"</option>"
;
}
}
data
+=
"</optgroup>"
;
}
console
.
log
(
data
);
$
(
'#categoryCode'
).
append
(
data
);
$
(
'#categoryCode'
).
multiselect
(
"destroy"
).
multiselect
({
nonSelectedText
:
'请选择标签!'
,
maxHeight
:
350
,
enableCollapsibleOptGroups
:
true
,
enableFiltering
:
true
,
numberDisplayed
:
3
});
}
/*
var openDept = function () {
layer.open({
type: 2,
title: "选择部门",
area: ['300px', '450px'],
content: "/system/sysDept/treeView"
})
}
function loadDept(deptId, deptName) {
$("#deptId").val(deptId);
$("#deptName").val(deptName);
}
*/
\ No newline at end of file
src/main/resources/static/js/appjs/tree_tag/jquery/jquery-3.3.1.min.js
0 → 100644
View file @
1e655f0e
This diff is collapsed.
Click to expand it.
src/main/resources/static/js/appjs/tree_tag/list.js
0 → 100644
View file @
1e655f0e
var
prefix
=
"tree_tag"
;
$
(
function
()
{
load
();
});
function
load
()
{
$
(
"#exampleTable"
).
bootstrapTable
({
method
:
"post"
,
// 服务器数据的请求方式 get or post
url
:
prefix
+
"/list"
,
// 服务器数据的加载地址
striped
:
true
,
// 设置为true会有隔行变色效果
dataType
:
"json"
,
// 服务器返回的数据类型
pagination
:
true
,
// 设置为true会在底部显示分页条
// queryParamsType : "limit",
// 设置为limit则会发送符合RESTFull格式的参数
singleSelect
:
false
,
// 设置为true将禁止多选
iconSize
:
"outline"
,
toolbar
:
"#exampleToolbar"
,
// contentType : "application/x-www-form-urlencoded",
// 发送到服务器的数据编码类型
pageSize
:
10
,
// 如果设置了分页,每页数据条数
pageNumber
:
1
,
// 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns
:
true
,
// 是否显示内容下拉框(选择显示的列)
sidePagination
:
"server"
,
// 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams
:
function
(
params
)
{
return
{
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit
:
params
.
limit
,
offset
:
params
.
offset
,
search
:
$
(
'#packageName'
).
val
()
};
},
// 请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns
:
[{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
// checkbox: true
// 列表中显示复选框
},
{
field
:
"packageName"
,
// 列字段名
title
:
"包名"
,
// 列标题
align
:
"center"
},
{
field
:
"platform"
,
title
:
"平台"
,
align
:
"center"
},
{
field
:
"firstTag"
,
title
:
"一级标签"
,
align
:
"center"
},
{
field
:
"secondTag"
,
title
:
"二级标签"
,
align
:
"center"
},
{
field
:
"thirdTag"
,
title
:
"三级标签"
,
align
:
"center"
}
]
});
}
function
reLoad
(
type
)
{
if
(
type
==
1
)
{
var
opt
=
{
query
:
{
offset
:
0
}
};
$
(
"#exampleTable"
).
bootstrapTable
(
"refresh"
,
opt
);
}
else
{
$
(
"#exampleTable"
).
bootstrapTable
(
"refresh"
);
}
}
\ No newline at end of file
src/main/resources/templates/include.html
View file @
1e655f0e
...
...
@@ -4,7 +4,9 @@
<title></title>
<meta
name=
"keywords"
content=
""
>
<meta
name=
"description"
content=
""
>
<!--
<link rel="shortcut icon" href="favicon.ico">
-->
<link
href=
"css/bootstrap.min.css?v=3.3.6"
th:href=
"@{/css/bootstrap.min.css?v=3.3.6}"
rel=
"stylesheet"
>
<link
href=
"/css/font-awesome.css?v=4.4.0"
...
...
src/main/resources/templates/index.html
View file @
1e655f0e
...
...
@@ -10,7 +10,9 @@
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html"/>
<![endif]-->
<!--
<link rel="shortcut icon" href="favicon.ico">
-->
<link
href=
"/css/bootstrap.min.css?v=3.3.6"
rel=
"stylesheet"
>
<link
href=
"/css/font-awesome.min.css?v=4.4.0"
rel=
"stylesheet"
>
<link
href=
"/css/plugins/toastr/toastr.min.css"
rel=
"stylesheet"
>
...
...
@@ -88,12 +90,20 @@
data-index=
"6"
th:href=
"@{/ec_tag}"
>
未标注 URL 列表
</a></li>
</ul>
</li>
<li
id=
"tree_tag"
><a
href=
"#"
>
<i
class=
"fa fa-home"
></i>
<span
class=
"nav-label"
>
树状标签管理
</span>
<span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level"
>
<li><a
class=
"J_menuItem"
href=
"index.html"
data-index=
"7"
th:href=
"@{/tree_tag}"
>
树状标签管理
</a></li>
</ul>
</li>
<li
id=
"admin"
><a
href=
"#"
>
<i
class=
"fa fa-home"
></i>
<span
class=
"nav-label"
>
用户管理
</span>
<span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level"
>
<li><a
class=
"J_menuItem"
href=
"index.html"
data-index=
"
7
"
th:href=
"@{/user}"
>
用户列表
</a></li>
data-index=
"
8
"
th:href=
"@{/user}"
>
用户列表
</a></li>
</ul>
</li>
<!--
...
...
src/main/resources/templates/tree_tag/edit.html
0 → 100644
View file @
1e655f0e
<!DOCTYPE html>
<html
xmlns:th=
"http://www.w3.org/1999/xhtml"
>
<meta
charset=
"utf-8"
>
<head
th:include=
"include :: header"
>
</head>
<body
class=
"gray-bg"
>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox-content"
>
<form
class=
"form-horizontal m-t"
id=
"signupForm"
>
<input
id=
"firstCategory"
name=
"firstCategory"
type=
"hidden"
th:value=
"${firstCategory}"
/>
<input
id=
"secondCategory"
name=
"secondCategory"
type=
"hidden"
th:value=
"${secondCategory}"
/>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
包名:
</label>
<div
class=
"col-sm-8"
>
<input
id=
"packageName"
name=
"packageName"
class=
"form-control"
type=
"text"
th:value=
"${tag.packageName}"
readonly
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
应用名称:
</label>
<div
class=
"col-sm-8"
>
<input
id=
"appName"
name=
"appName"
class=
"form-control"
type=
"text"
th:value=
"${tag.appName}"
readonly
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
App 商店链接:
</label>
<div
class=
"col-sm-8"
>
<a
id=
"url"
name=
"url"
th:href=
"${tag.url}"
target=
"_blank"
>
<span
th:text=
"${tag.url}"
></span>
</a>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
商店类别:
</label>
<div
class=
"col-sm-8"
>
<input
id=
"category"
name=
"category"
class=
"form-control"
type=
"text"
th:value=
"${tag.category}"
readonly
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
类别标签:
</label>
<div
class=
"col-sm-8"
>
<select
id=
"categoryCode"
name=
"categoryCode"
multiple=
"multiple"
>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
规则标签:
</label>
<div
class=
"col-sm-8"
>
<select
id=
"ruleCode"
name=
"ruleCode"
multiple=
"multiple"
>
<option
th:each=
"iter:${rule}"
th:value=
"${iter.firstId}"
th:text=
"${iter.firstTag}"
></option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
风格标签:
</label>
<div
class=
"col-sm-8"
>
<select
id=
"styleCode"
name=
"styleCode"
multiple=
"multiple"
>
<option
th:each=
"iter:${style}"
th:value=
"${iter.firstId}"
th:text=
"${iter.firstTag}"
></option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
主题标签:
</label>
<div
class=
"col-sm-8"
>
<select
id=
"themeCode"
name=
"themeCode"
multiple=
"multiple"
>
<option
th:each=
"iter:${theme}"
th:value=
"${iter.firstId}"
th:text=
"${iter.firstTag}"
></option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-8 col-sm-offset-3"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div
th:include=
"include::footer"
></div>
<script
type=
"text/javascript"
>
$
(
'#categoryCode'
).
multiselect
({
nonSelectedText
:
'请选择标签!'
});
$
(
'#ruleCode'
).
multiselect
({
nonSelectedText
:
'请选择标签!'
,
maxHeight
:
350
,
enableFiltering
:
true
,
numberDisplayed
:
3
});
$
(
'#styleCode'
).
multiselect
({
nonSelectedText
:
'请选择标签!'
,
maxHeight
:
350
,
enableFiltering
:
true
,
numberDisplayed
:
3
});
$
(
'#themeCode'
).
multiselect
({
nonSelectedText
:
'请选择标签!'
,
maxHeight
:
350
,
enableFiltering
:
true
,
numberDisplayed
:
3
});
</script>
<script
type=
"text/javascript"
src=
"/js/appjs/tag/edit.js"
>
</script>
</body>
</html>
src/main/resources/templates/tree_tag/list.html
0 → 100644
View file @
1e655f0e
<!DOCTYPE html>
<html
lang=
"zh_CN"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:shiro=
"http://www.pollix.at/thymeleaf/shiro"
>
<meta
charset=
"utf-8"
>
<head
th:include=
"include :: header"
></head>
<body
class=
"gray-bg"
>
<div
class=
"wrapper wrapper-content "
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox"
>
<div
class=
"ibox-body"
>
<div
class=
"fixed-table-toolbar"
>
<form
method=
"post"
action=
"/tree_tag/upload"
enctype=
"multipart/form-data"
>
<div
class=
"columns pull-left col-md-3 nopadding"
>
<input
id=
"file"
name=
"file"
type=
"file"
class=
"form-control"
>
</div>
<div
class=
"columns pull-left"
>
<button
class=
"btn btn-success"
type=
"submit"
>
提交
</button>
</div>
</form>
<div
class=
"columns pull-right"
>
<button
class=
"btn btn-success"
onclick=
"reLoad(1)"
>
查询
</button>
</div>
<div
class=
"columns pull-right col-md-2 nopadding"
>
<input
id=
"packageName"
type=
"text"
class=
"form-control"
placeholder=
"包名"
>
</div>
</div>
<table
id=
"exampleTable"
data-mobile-responsive=
"true"
>
</table>
</div>
</div>
</div>
<div>
<script
type=
"text/javascript"
>
var
s_edit_h
=
'hidden'
;
</script>
</div>
<div
shiro:hasPermission=
"sys:user:edit"
>
<script
type=
"text/javascript"
>
s_edit_h
=
''
;
</script>
</div>
</div>
<div
th:include=
"include :: footer"
></div>
<script
type=
"text/javascript"
src=
"/js/appjs/tree_tag/list.js"
></script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment