Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
kmr-h5-java
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
6a8587e7
authored
2017-12-03 16:37:25 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加统计方法
1 parent
b7b44628
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
5 deletions
kmr_dp_HDP/src/main/java/com/example/controller/ScoreLogInfoController.java
kmr_dp_HDP/src/main/java/com/example/controller/WxController.java
kmr_dp_HDP/src/main/java/com/example/mapper/ShareLogMapper.java
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoService.java
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
kmr_dp_HDP/src/main/resources/mappers/ShareLogMapper.xml
kmr_dp_HDP/src/main/java/com/example/controller/ScoreLogInfoController.java
View file @
6a8587e
...
...
@@ -18,9 +18,12 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -46,13 +49,15 @@ public class ScoreLogInfoController {
@RequestMapping
(
"/save"
)
public
MessageEntity
save
(
HttpServletRequest
request
,
@ModelAttribute
ScoreLogInfo
scoreLogInfo
,
String
access_token
,
String
state
,
String
timestamp
,
String
rands
,
String
jsondata
,
String
checksum
,
String
secret
)
{
String
secret
)
throws
ParseException
,
UnsupportedEncodingException
{
MessageEntity
.
Builder
builder
=
new
MessageEntity
.
Builder
(
request
);
boolean
flag
=
false
;
String
code
=
"9000"
;
String
openid
=
scoreLogInfo
.
getOpenid
();
// String openid = scoreLogInfo.getOpenid();
Date
lastDay
=
sdf
.
parse
(
"2017-12-14 23:59:59"
);
if
(
lastDay
.
after
(
new
Date
()))
{
if
(
StringUtils
.
isNotBlank
(
jsondata
))
{
jsondata
=
URLDecoder
.
decode
(
jsondata
);
jsondata
=
URLDecoder
.
decode
(
jsondata
,
"utf-8"
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
Map
map
=
null
;
try
{
...
...
@@ -75,6 +80,7 @@ public class ScoreLogInfoController {
// }
// }
}
}
return
builder
.
success
(
flag
).
code
(
code
).
create
();
}
...
...
@@ -118,6 +124,14 @@ public class ScoreLogInfoController {
return
builder
.
success
(
true
).
code
(
"2000"
).
content
(
l
).
create
();
}
@RequestMapping
(
"/saveStat"
)
public
MessageEntity
saveStat
(
HttpServletRequest
request
,
@RequestParam
String
openid
)
{
MessageEntity
.
Builder
builder
=
new
MessageEntity
.
Builder
(
request
);
long
l
=
this
.
scoreLogInfoService
.
saveStat
(
openid
);
return
builder
.
success
(
true
).
code
(
"2000"
).
content
(
l
).
create
();
}
// public static void main(String[] args) {
// String
// access_token="4_ei8KYHlVKGE8zLguYGl7iHLEBf28u4nAzxocOMXGvzKoPxpU3Dxr_kq8cQlfDD34qFiJWgQpYxj3k3gobg0hyA";
...
...
kmr_dp_HDP/src/main/java/com/example/controller/WxController.java
View file @
6a8587e
...
...
@@ -69,7 +69,7 @@ public class WxController {
try
{
readValue
=
mapper
.
readValue
(
responseEntity
,
Map
.
class
);
if
(
null
!=
readValue
.
get
(
"errcode"
))
{
return
null
;
return
builder
.
success
(
false
).
code
(
"999"
).
content
(
readValue
).
create
()
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();;
...
...
kmr_dp_HDP/src/main/java/com/example/mapper/ShareLogMapper.java
View file @
6a8587e
...
...
@@ -14,4 +14,6 @@ public interface ShareLogMapper {
long
countByDay
(
@Param
(
"openid"
)
String
openid
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
);
boolean
saveStat
(
@Param
(
"openid"
)
String
openid
);
}
...
...
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoService.java
View file @
6a8587e
...
...
@@ -23,4 +23,6 @@ public interface ScoreLogInfoService {
long
saveShare
(
String
openid
);
long
saveStat
(
String
openid
);
}
...
...
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
View file @
6a8587e
...
...
@@ -109,4 +109,11 @@ public class ScoreLogInfoServiceImpl implements ScoreLogInfoService {
}
@Override
public
long
saveStat
(
String
openid
)
{
shareLogMapper
.
saveStat
(
openid
);
return
0
;
}
}
...
...
kmr_dp_HDP/src/main/resources/mappers/ShareLogMapper.xml
View file @
6a8587e
...
...
@@ -9,7 +9,7 @@
)
values(
#{openid},
#{share
_t
ime}
#{share
T
ime}
);
</insert>
...
...
@@ -21,6 +21,13 @@
and openid= #{openid};
</select>
<insert
id=
"saveStat"
>
insert into `t_kmr_stat_log`(
`openid`
) values (
#{openid}
)
</insert>
</mapper>
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment