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
ad3a45fc
Commit
ad3a45fc
authored
Nov 26, 2018
by
wangjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
7b1213c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
2 deletions
+57
-2
ResultController.java
...java/com/mobvista/apptag/controller/ResultController.java
+57
-2
No files found.
src/main/java/com/mobvista/apptag/controller/ResultController.java
View file @
ad3a45fc
package
com
.
mobvista
.
apptag
.
controller
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
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
;
...
...
@@ -11,11 +15,13 @@ import com.mobvista.apptag.entity.TagResult;
import
com.mobvista.apptag.mapper.FeatDao
;
import
com.mobvista.apptag.mapper.ResultDao
;
import
com.mobvista.apptag.mapper.TagDao
;
import
com.mobvista.apptag.service.FeatService
;
import
com.mobvista.apptag.service.ResultService
;
import
com.mobvista.apptag.utils.PageUtil
;
import
com.mobvista.apptag.utils.Query
;
import
com.mobvista.apptag.utils.R
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -49,6 +55,8 @@ public class ResultController {
private
TagDao
tagDao
;
@Autowired
private
FeatDao
featDao
;
@Autowired
private
FeatService
featService
;
public
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ResultController
.
class
);
...
...
@@ -75,8 +83,55 @@ public class ResultController {
@PostMapping
(
"/save"
)
R
save
(
@SessionAttribute
(
WebSecurityConfig
.
SESSION_KEY
)
String
userName
,
@RequestParam
(
name
=
"packageName"
)
String
packageName
)
{
if
(
resultService
.
save
(
packageName
,
userName
,
""
))
{
@RequestParam
(
name
=
"packageName"
)
String
packageName
,
@RequestParam
(
name
=
"categoryCode"
,
required
=
false
)
String
categoryCode
,
@RequestParam
(
name
=
"ruleCode"
,
required
=
false
)
String
ruleCode
,
@RequestParam
(
name
=
"styleCode"
,
required
=
false
)
String
styleCode
,
@RequestParam
(
name
=
"themeCode"
,
required
=
false
)
String
themeCode
)
{
Map
<
String
,
String
>
codeMap
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
featMap
=
featService
.
getMap
();
// 类型标签
if
(
StringUtils
.
isNotBlank
(
categoryCode
))
{
String
[]
codes
=
categoryCode
.
split
(
","
);
for
(
String
code
:
codes
)
{
codeMap
.
put
(
code
,
featMap
.
get
(
code
));
}
}
// 规则标签
if
(
StringUtils
.
isNotBlank
(
ruleCode
))
{
String
[]
codes
=
ruleCode
.
split
(
","
);
for
(
String
code
:
codes
)
{
codeMap
.
put
(
code
,
featMap
.
get
(
code
));
}
}
// 风格标签
if
(
StringUtils
.
isNotBlank
(
styleCode
))
{
String
[]
codes
=
styleCode
.
split
(
","
);
for
(
String
code
:
codes
)
{
codeMap
.
put
(
code
,
featMap
.
get
(
code
));
}
}
// 主题标签
if
(
StringUtils
.
isNotBlank
(
themeCode
))
{
String
[]
codes
=
themeCode
.
split
(
","
);
for
(
String
code
:
codes
)
{
codeMap
.
put
(
code
,
featMap
.
get
(
code
));
}
}
ObjectMapper
mapper
=
new
ObjectMapper
();
String
json
=
""
;
try
{
json
=
mapper
.
writeValueAsString
(
codeMap
);
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
if
(
resultService
.
save
(
packageName
,
userName
,
json
))
{
return
R
.
ok
();
}
else
{
return
R
.
error
(
1
,
"保存失败!"
);
...
...
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