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
4e93c015
authored
2017-12-04 15:21:37 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
部分功能修改
1 parent
6a8587e7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
49 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/models/ScoreLogInfo.java
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
kmr_dp_HDP/src/main/resources/application.properties
kmr_dp_HDP/src/main/java/com/example/controller/ScoreLogInfoController.java
View file @
4e93c01
...
...
@@ -35,6 +35,8 @@ import java.util.Map;
@RestController
public
class
ScoreLogInfoController
{
final
String
keySecret
=
"33974941d83111e78cda7cd30abdaa16"
;
private
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
@Autowired
...
...
@@ -49,15 +51,30 @@ 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
)
throws
ParseException
,
UnsupportedEncodingException
{
String
secret
,
String
sign
,
String
signTime
)
throws
ParseException
,
UnsupportedEncodingException
{
MessageEntity
.
Builder
builder
=
new
MessageEntity
.
Builder
(
request
);
if
(
scoreLogInfo
.
getScore
()
<
4000
)
{
return
null
;
}
if
(
scoreLogInfo
.
getScore
()
>
30000
)
{
return
null
;
}
System
.
out
.
println
(
"sign ---------------->"
+
sign
);
System
.
out
.
println
(
"score ---------------->"
+
scoreLogInfo
.
getScore
());
System
.
out
.
println
(
"signTime ---------------->"
+
signTime
);
String
forSign
=
MD5Utils
.
hash
(
keySecret
+
scoreLogInfo
.
getScore
()
+
keySecret
+
signTime
);
System
.
out
.
println
(
"system sign ---------------->"
+
forSign
);
if
(!
forSign
.
equals
(
sign
))
{
return
null
;
}
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
(
lastDay
.
after
(
new
Date
()))
{
if
(
StringUtils
.
isNotBlank
(
jsondata
))
{
jsondata
=
URLDecoder
.
decode
(
jsondata
,
"utf-8"
);
jsondata
=
URLDecoder
.
decode
(
jsondata
,
"utf-8"
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
Map
map
=
null
;
try
{
...
...
@@ -124,7 +141,6 @@ 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
);
...
...
kmr_dp_HDP/src/main/java/com/example/controller/WxController.java
View file @
4e93c01
package
com
.
example
.
controller
;
import
com.example.models.ImgInfo
;
import
com.example.service.ImgInfoService
;
import
com.example.service.http.ClientConfigService
;
import
com.example.service.http.ClientConfigServiceImpl
;
import
com.example.service.http.HttpPostService
;
import
com.example.support.model.MessageEntity
;
import
com.example.utils.file.DefaultFileUpload
;
import
com.example.utils.file.FileUploadInfo
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.wink.client.ClientResponse
;
import
org.apache.wink.client.Resource
;
import
org.apache.wink.client.RestClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.Map
;
import
com.example.service.http.ClientConfigService
;
import
com.example.service.http.ClientConfigServiceImpl
;
import
com.example.support.model.MessageEntity
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
/**
* Created by JA on 17/7/3.
...
...
@@ -30,27 +27,32 @@ import java.util.Map;
@RestController
public
class
WxController
{
// String jssdkurl = "http://gfwp.gac-toyota.com.cn/GTMCfamily/index.php/campaign/api2/getjssdk";
//
// String getopenidurl = "http://gfwp.gac-toyota.com.cn/GTMCfamily/index.php/campaign/api2/getjssdk";
//
// @Autowired
// private HttpPostService httpPostService;
//
//
// @RequestMapping("/getjssdk")
// public MessageEntity getjssdk(HttpServletRequest request, @RequestParam String url) {
// MessageEntity.Builder builder = new MessageEntity.Builder(request);
// String newUrl = jssdkurl + "?url="+ url;
// Map<String, Object> map = null;
// try {
// map = httpPostService.httpPost(newUrl, null);
// } catch (IOException e) {
// e.printStackTrace();
// }
// return builder.success(true).code("2000").content(map).create();
// }
@Value
(
"${wx.sign.base.url}"
)
String
wxSignBaseUrl
;
// String jssdkurl =
// "http://gfwp.gac-toyota.com.cn/GTMCfamily/index.php/campaign/api2/getjssdk";
//
// String getopenidurl =
// "http://gfwp.gac-toyota.com.cn/GTMCfamily/index.php/campaign/api2/getjssdk";
//
// @Autowired
// private HttpPostService httpPostService;
//
//
// @RequestMapping("/getjssdk")
// public MessageEntity getjssdk(HttpServletRequest request, @RequestParam
// String url) {
// MessageEntity.Builder builder = new MessageEntity.Builder(request);
// String newUrl = jssdkurl + "?url="+ url;
// Map<String, Object> map = null;
// try {
// map = httpPostService.httpPost(newUrl, null);
// } catch (IOException e) {
// e.printStackTrace();
// }
// return builder.success(true).code("2000").content(map).create();
// }
@RequestMapping
(
"/getUser"
)
public
MessageEntity
oauth
(
HttpServletRequest
request
,
@RequestParam
String
access_token
,
String
openid
)
{
...
...
@@ -64,7 +66,7 @@ public class WxController {
ClientResponse
response
=
resource
.
get
();
String
responseEntity
=
response
.
getEntity
(
String
.
class
);
Map
readValue
=
null
;
//
System.out.println("responseEntity:::"+responseEntity);
//
System.out.println("responseEntity:::"+responseEntity);
ObjectMapper
mapper
=
new
ObjectMapper
();
try
{
readValue
=
mapper
.
readValue
(
responseEntity
,
Map
.
class
);
...
...
@@ -72,10 +74,34 @@ public class WxController {
return
builder
.
success
(
false
).
code
(
"999"
).
content
(
readValue
).
create
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();;
e
.
printStackTrace
();
;
}
return
builder
.
success
(
true
).
code
(
"2000"
).
content
(
readValue
).
create
();
}
@RequestMapping
(
"/wxSign"
)
public
MessageEntity
jsSign
(
HttpServletRequest
request
,
@RequestParam
String
url
)
throws
UnsupportedEncodingException
{
MessageEntity
.
Builder
builder
=
new
MessageEntity
.
Builder
(
request
);
ClientConfigService
configService
=
new
ClientConfigServiceImpl
();
RestClient
restClient
=
new
RestClient
(
configService
.
getClientConfig
());
Resource
resource
=
restClient
.
resource
(
wxSignBaseUrl
+
"?url="
+
URLEncoder
.
encode
(
url
,
"utf-8"
));
ClientResponse
response
=
resource
.
get
();
String
responseEntity
=
response
.
getEntity
(
String
.
class
);
Map
readValue
=
null
;
// System.out.println("responseEntity:::"+responseEntity);
ObjectMapper
mapper
=
new
ObjectMapper
();
try
{
readValue
=
mapper
.
readValue
(
responseEntity
,
Map
.
class
);
if
(
null
!=
readValue
.
get
(
"errcode"
))
{
return
builder
.
success
(
false
).
code
(
"999"
).
content
(
readValue
).
create
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
;
}
return
builder
.
success
(
true
).
code
(
"2000"
).
content
(
readValue
).
create
();
}
}
...
...
kmr_dp_HDP/src/main/java/com/example/models/ScoreLogInfo.java
View file @
4e93c01
...
...
@@ -14,7 +14,7 @@ public class ScoreLogInfo {
String
gtmcUid
;
String
gtmcName
;
String
gtmcDepartment
;
private
Double
score
;
private
Integer
score
;
private
Date
createAt
;
private
Integer
status
;
...
...
@@ -50,11 +50,11 @@ public class ScoreLogInfo {
this
.
headimgurl
=
headimgurl
;
}
public
Double
getScore
()
{
public
Integer
getScore
()
{
return
score
;
}
public
void
setScore
(
Double
score
)
{
public
void
setScore
(
Integer
score
)
{
this
.
score
=
score
;
}
...
...
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
View file @
4e93c01
...
...
@@ -50,7 +50,7 @@ public class ScoreLogInfoServiceImpl implements ScoreLogInfoService {
if
(
count
>=
maxTime
){
code
=
"9902"
;
}
else
{
Double
score
=
scoreLogInfo
.
getScore
();
Integer
score
=
scoreLogInfo
.
getScore
();
if
(
minScore
>
score
){
code
=
"9903"
;
}
else
{
...
...
kmr_dp_HDP/src/main/resources/application.properties
View file @
4e93c01
...
...
@@ -21,3 +21,6 @@ mybatis.configLocation=classpath:/mybatis-config.xml
#port
server.port
=
9092
wx.sign.base.url
=
http://gfwp.gac-toyota.com.cn/GTMCfamily/index.php/campaign/api2/getjssdk
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment