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
6b8c2628
Commit
6b8c2628
authored
Aug 13, 2019
by
jinfeng.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
c3376926
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
11 deletions
+55
-11
TagController.java
...in/java/com/mobvista/apptag/controller/TagController.java
+4
-6
TagService.java
src/main/java/com/mobvista/apptag/service/TagService.java
+7
-1
TagServiceImpl.java
...java/com/mobvista/apptag/service/impl/TagServiceImpl.java
+44
-4
No files found.
src/main/java/com/mobvista/apptag/controller/TagController.java
View file @
6b8c2628
...
...
@@ -2,7 +2,6 @@ package com.mobvista.apptag.controller;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.github.pagehelper.PageHelper
;
import
com.mobvista.apptag.config.WebSecurityConfig
;
import
com.mobvista.apptag.entity.Feat
;
import
com.mobvista.apptag.entity.Tag
;
...
...
@@ -88,7 +87,6 @@ public class TagController {
@RequestParam
(
name
=
"ruleCode"
,
required
=
false
)
String
ruleCode
,
@RequestParam
(
name
=
"styleCode"
,
required
=
false
)
String
styleCode
,
@RequestParam
(
name
=
"themeCode"
,
required
=
false
)
String
themeCode
)
{
System
.
out
.
println
(
"packageName="
+
packageName
+
",categoryCode="
+
categoryCode
);
Map
<
String
,
String
>
codeMap
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
featMap
=
featService
.
getMap
();
...
...
@@ -142,10 +140,10 @@ public class TagController {
@ResponseBody
public
PageUtil
list
(
@SessionAttribute
(
WebSecurityConfig
.
SESSION_KEY
)
String
userName
,
@RequestBody
Query
query
,
@RequestParam
(
name
=
"tag"
,
required
=
false
,
defaultValue
=
"0"
)
int
tag
)
{
PageHelper
.
startPage
(
query
.
getOffset
()
/
query
.
getLimit
()
+
1
,
query
.
getLimit
());
String
search
=
query
.
getSearch
();
List
<
Tag
>
tags
=
tag
Dao
.
list
(
search
,
tag
);
int
total
=
tag
Dao
.
count
(
search
,
tag
);
//
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
//
String search = query.getSearch();
List
<
Tag
>
tags
=
tag
Service
.
list
(
userName
,
query
);
int
total
=
tag
Service
.
count
(
userName
,
query
);
PageUtil
pageUtil
=
new
PageUtil
(
tags
,
total
);
return
pageUtil
;
}
...
...
src/main/java/com/mobvista/apptag/service/TagService.java
View file @
6b8c2628
package
com
.
mobvista
.
apptag
.
service
;
import
com.mobvista.apptag.entity.Tag
;
import
com.mobvista.apptag.utils.Query
;
import
java.util.List
;
/**
* @author wangjf
...
...
@@ -11,5 +14,7 @@ public interface TagService {
Tag
find
(
String
packageName
);
// List<Tag> list(int pageNum, int pageSize);
List
<
Tag
>
list
(
String
userId
,
Query
query
);
int
count
(
String
userId
,
Query
query
);
}
\ No newline at end of file
src/main/java/com/mobvista/apptag/service/impl/TagServiceImpl.java
View file @
6b8c2628
package
com
.
mobvista
.
apptag
.
service
.
impl
;
import
com.github.pagehelper.PageHelper
;
import
com.mobvista.apptag.entity.Tag
;
import
com.mobvista.apptag.entity.User
;
import
com.mobvista.apptag.mapper.TagDao
;
import
com.mobvista.apptag.mapper.UserDao
;
import
com.mobvista.apptag.service.TagService
;
import
com.mobvista.apptag.utils.Query
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.*
;
@Service
(
"tagService"
)
public
class
TagServiceImpl
implements
TagService
{
...
...
@@ -61,6 +60,47 @@ public class TagServiceImpl implements TagService {
return
tagDao
.
find
(
packageName
);
}
@Override
public
List
<
Tag
>
list
(
String
userId
,
Query
query
)
{
User
user
=
userDao
.
find
(
userId
);
List
<
Tag
>
results
;
PageHelper
.
startPage
(
query
.
getOffset
()
/
query
.
getLimit
()
+
1
,
query
.
getLimit
());
results
=
tagDao
.
list
(
query
.
getSearch
().
toLowerCase
(),
3
);
List
<
Tag
>
results2
=
new
ArrayList
<>();
for
(
Tag
tag
:
results
)
{
if
(
StringUtils
.
isBlank
(
tag
.
getUserId
()))
{
results2
.
add
(
tag
);
}
else
{
String
[]
userIds
=
tag
.
getUserId
().
split
(
","
);
Set
<
String
>
userSet
=
new
HashSet
<>(
Arrays
.
asList
(
userIds
));
if
(!
userSet
.
contains
(
user
.
getUserId
()))
{
results2
.
add
(
tag
);
}
}
}
return
results2
;
}
@Override
public
int
count
(
String
userId
,
Query
query
)
{
User
user
=
userDao
.
find
(
userId
);
List
<
Tag
>
results
;
results
=
tagDao
.
list
(
query
.
getSearch
().
toLowerCase
(),
3
);
int
count
=
0
;
for
(
Tag
tag
:
results
)
{
if
(
StringUtils
.
isBlank
(
tag
.
getUserId
()))
{
count
+=
1
;
}
else
{
String
[]
userIds
=
tag
.
getUserId
().
split
(
","
);
Set
<
String
>
userSet
=
new
HashSet
<>(
Arrays
.
asList
(
userIds
));
if
(!
userSet
.
contains
(
user
.
getUserId
()))
{
count
+=
1
;
}
}
}
return
count
;
}
/*
@Override
public List<Tag> list(int pageNum, int pageSize) {
...
...
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