Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloud
Commits
bc5dd330
Commit
bc5dd330
authored
Nov 12, 2018
by
Huang
Browse files
no commit message
parent
d9ad22de
Changes
25
Hide whitespace changes
Inline
Side-by-side
JeeSpringCloud/jeespring-company/bin/cop webapp to web.bat
0 → 100644
View file @
bc5dd330
@echo
off
rem /**
rem */
echo
.
echo
[
Ϣ
]
package
ļ
echo
.
cd
/d
%~dp0
cd
..
xcopy
src
\main\webapp\
*
.
*
..\jeespring
-web
\src\main\webapp
/s /e /y
cd
bin
pause
\ No newline at end of file
JeeSpringCloud/jeespring-company/pom.xml
0 → 100644
View file @
bc5dd330
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.jeespring
</groupId>
<artifactId>
jeespring-company
</artifactId>
<name>
jeespring-company
</name>
<description>
jeespring-company
</description>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<parent>
<groupId>
com.jeespring
</groupId>
<artifactId>
jeespring
</artifactId>
<version>
1.0.0
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>
com.jeespring
</groupId>
<artifactId>
jeespring-framework
</artifactId>
<version>
1.0.0
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
JeeSpringCloud/jeespring-company/src/main/db/db.txt
0 → 100644
View file @
bc5dd330
ģsql
\ No newline at end of file
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/AssembleTool.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Map
;
public
class
AssembleTool
{
public
static
String
assembleUrl
(
String
url
,
Map
<
String
,
String
>
params
){
if
(!
url
.
endsWith
(
"?"
)){
url
+=
"?"
;
}
for
(
String
key:
params
.
keySet
()){
try
{
if
(
params
.
get
(
key
)==
null
||
params
.
get
(
key
).
length
()==
0
){
url
+=
key
+
"="
+
params
.
get
(
key
)+
"&"
;
}
else
{
url
+=
key
+
"="
+
URLEncoder
.
encode
(
params
.
get
(
key
),
"utf-8"
)+
"&"
;
}
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
return
url
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/BulidUrl.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
cn.com.duiba.credits.sdk.entity.CreditAuditParams
;
import
cn.com.duiba.credits.sdk.entity.CreditConfirmParams
;
import
cn.com.duiba.credits.sdk.entity.ExpressInfo
;
/**
* @author Administrator
* 工具类是开发者构造一些请求的url工具类,仅供参考
*/
public
class
BulidUrl
{
public
static
String
AppKey
=
"7HWwRiKJXPiyh7pF4QnYAieVPQL"
;
//此处填写开发者自己的appKey
public
static
String
AppSecret
=
"4WazdJGJ9PVFVu7vXZozn2Kywaki"
;
//此处填写开发者自己的appSecret
/**
* 构建在兑吧商城自动登录的url地址
* @param uid 用户id
* @param redirect 免登陆接口回传回来 dbredirect参数
* @param credits 用户积分余额
* @return 自动登录的url地址
*/
public
static
String
buildAutoLoginRequest
(
String
uid
,
Long
credits
,
String
redirect
){
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
String
url
=
"https://www.duiba.com.cn/autoLogin/autologin?"
;
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"uid"
,
uid
);
params
.
put
(
"credits"
,
credits
+
""
);
if
(
redirect
!=
null
){
params
.
put
(
"redirect"
,
redirect
);
}
String
autologinUrl
=
tool
.
buildUrlWithSign
(
url
,
params
);
return
autologinUrl
;
}
/**
* 构建向兑吧查询兑换订单状态的url地址
* @param orderNum 兑吧的订单号
* @return
*/
public
static
String
buildCreditOrderStatusRequest
(
String
orderNum
,
String
bizId
){
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
if
(
orderNum
==
null
){
orderNum
=
""
;
}
if
(
bizId
==
null
){
bizId
=
""
;
}
String
url
=
"http://www.duiba.com.cn/status/orderStatus?"
;
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"orderNum"
,
orderNum
);
params
.
put
(
"bizId"
,
bizId
);
String
buildUrl
=
tool
.
buildUrlWithSign
(
url
,
params
);
return
buildUrl
;
}
/**
* 构建开发者审核结果的的方法
* @param params
* @return 发起请求的url
*/
public
static
String
buildCreditAuditRequest
(
CreditAuditParams
params
){
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
String
url
=
"http://www.duiba.com.cn/audit/apiAudit?"
;
Map
<
String
,
String
>
signParams
=
new
HashMap
<
String
,
String
>();
if
(
params
.
getPassOrderNums
()!=
null
&&
params
.
getPassOrderNums
().
size
()>
0
){
String
s
=
null
;
for
(
String
o:
params
.
getPassOrderNums
()){
if
(
s
==
null
){
s
=
o
;
}
else
{
s
+=
","
+
o
;
}
}
signParams
.
put
(
"passOrderNums"
,
s
);
}
else
{
signParams
.
put
(
"passOrderNums"
,
""
);
}
if
(
params
.
getRejectOrderNums
()!=
null
&&
params
.
getRejectOrderNums
().
size
()>
0
){
String
s
=
null
;
for
(
String
o:
params
.
getRejectOrderNums
()){
if
(
s
==
null
){
s
=
o
;
}
else
{
s
+=
","
+
o
;
}
}
signParams
.
put
(
"rejectOrderNums"
,
s
);
}
else
{
signParams
.
put
(
"rejectOrderNums"
,
""
);
}
String
buildUrl
=
tool
.
buildUrlWithSign
(
url
,
signParams
);
return
buildUrl
;
}
/**
* 构建开发者向兑吧发起兑换成功失败的确认通知请求
* @param params
* @return
*/
public
static
String
buildCreditConfirmRequest
(
CreditConfirmParams
p
){
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
String
url
=
"http://www.duiba.com.cn/confirm/confirm?"
;
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"success"
,
p
.
isSuccess
()+
""
);
params
.
put
(
"errorMessage"
,
p
.
getErrorMessage
());
params
.
put
(
"orderNum"
,
p
.
getOrderNum
());
String
bulidurl
=
tool
.
buildUrlWithSign
(
url
,
params
);
return
bulidurl
;
}
/**
* 前置商品查询URL
* @param count 查询返回的商品数量,最大支持50个
* @return
*/
public
static
String
queryForFrontItem
(
String
count
)
{
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"count"
,
count
);
String
url
=
tool
.
buildUrlWithSign
(
"http://www.duiba.com.cn/queryForFrontItem/query?"
,
params
);
return
url
;
}
/**
* 构建向兑吧请求增加活动次数的url地址
* @param uid :用户id activityId:活动id, times:增加活动次数, bizId:本次请求开发者订单号,保证唯一性
* @return
*/
public
static
String
getActivityTimes
(
String
uid
,
String
activityId
,
String
times
,
String
bizId
)
{
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"uid"
,
uid
);
params
.
put
(
"bizId"
,
bizId
);
params
.
put
(
"activityId"
,
activityId
);
params
.
put
(
"times"
,
times
);
String
url
=
tool
.
buildUrlWithSign
(
"https://activity.m.duiba.com.cn/activityVist/addTimes?"
,
params
);
return
url
;
}
/**
* 自有商品批量取消发货
* @param
* orderNums 最大支持100个
* 方法中,对于超过100的会自动截取前100个
* @return
*/
public
static
String
batchCancel
(
List
<
String
>
orderNums
)
{
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
if
(
orderNums
.
size
()>
100
){
orderNums
=
orderNums
.
subList
(
0
,
100
);
}
params
.
put
(
"orderNums"
,
orderNums
.
toString
().
substring
(
1
,
orderNums
.
toString
().
length
()-
1
));
String
url
=
tool
.
buildUrlWithSign
(
"http://www.duiba.com.cn/sendObject/batchCancel?"
,
params
);
return
url
;
}
/**
* 自有商品批量发货
* @params info 格式如下
* 发货的数量,每次请求不超过100个
* 方法中,对于超过100的会自动截取前100个
* @return
*/
public
static
String
batchSend
(
List
<
ExpressInfo
>
infos
)
{
CreditTool
tool
=
new
CreditTool
(
AppKey
,
AppSecret
);
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
StringBuffer
expressInfo
=
new
StringBuffer
();
if
(
infos
.
size
()>
100
){
infos
=
infos
.
subList
(
0
,
100
);
}
for
(
ExpressInfo
info:
infos
)
{
expressInfo
.
append
(
info
);
}
expressInfo
.
deleteCharAt
(
expressInfo
.
length
()-
1
);
params
.
put
(
"expressInfo"
,
expressInfo
.
toString
());
String
url
=
tool
.
buildUrlWithSign
(
"http://www.duiba.com.cn/sendObject/batchSend?"
,
params
);
return
url
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/CreditTool.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
cn.com.duiba.credits.sdk.entity.AddCreditsParams
;
import
cn.com.duiba.credits.sdk.entity.CreditConsumeParams
;
import
cn.com.duiba.credits.sdk.entity.CreditNeedAuditParams
;
import
cn.com.duiba.credits.sdk.entity.CreditNotifyParams
;
import
cn.com.duiba.credits.sdk.entity.VirtualParams
;
public
class
CreditTool
{
private
String
appKey
;
private
String
appSecret
;
public
CreditTool
(
String
appKey
,
String
appSecret
){
this
.
appKey
=
appKey
;
this
.
appSecret
=
appSecret
;
}
/**
* 通用的url生成方法
* @param url
* @param params
* @return
*/
public
String
buildUrlWithSign
(
String
url
,
Map
<
String
,
String
>
params
){
Map
<
String
,
String
>
newparams
=
new
HashMap
<
String
,
String
>(
params
);
newparams
.
put
(
"appKey"
,
appKey
);
newparams
.
put
(
"appSecret"
,
appSecret
);
if
(
newparams
.
get
(
"timestamp"
)==
null
){
newparams
.
put
(
"timestamp"
,
System
.
currentTimeMillis
()+
""
);
}
String
sign
=
SignTool
.
sign
(
newparams
);
newparams
.
put
(
"sign"
,
sign
);
newparams
.
remove
(
"appSecret"
);
return
AssembleTool
.
assembleUrl
(
url
,
newparams
);
}
/**
* 积分消耗请求的解析方法
* @param request
* @return
* @throws Exception
*/
public
CreditConsumeParams
parseCreditConsume
(
HttpServletRequest
request
)
throws
Exception
{
if
(!
appKey
.
equals
(
request
.
getParameter
(
"appKey"
))){
throw
new
Exception
(
"appKey不匹配"
);
}
if
(
request
.
getParameter
(
"timestamp"
)==
null
){
throw
new
Exception
(
"请求中没有带时间戳"
);
}
boolean
verify
=
SignTool
.
signVerify
(
appSecret
,
request
);
if
(!
verify
){
throw
new
Exception
(
"签名验证失败"
);
}
CreditConsumeParams
params
=
new
CreditConsumeParams
();
params
.
setAppKey
(
appKey
);
params
.
setUid
(
request
.
getParameter
(
"uid"
));
params
.
setCredits
(
Long
.
valueOf
(
request
.
getParameter
(
"credits"
)));
params
.
setTimestamp
(
new
Date
(
Long
.
valueOf
(
request
.
getParameter
(
"timestamp"
))));
params
.
setDescription
(
request
.
getParameter
(
"description"
));
params
.
setOrderNum
(
request
.
getParameter
(
"orderNum"
));
params
.
setType
(
request
.
getParameter
(
"type"
));
if
(
request
.
getParameter
(
"facePrice"
)!=
null
){
params
.
setFacePrice
(
Integer
.
valueOf
(
request
.
getParameter
(
"facePrice"
)));
}
if
(
request
.
getParameter
(
"actualPrice"
)!=
null
){
params
.
setActualPrice
(
Integer
.
valueOf
(
request
.
getParameter
(
"actualPrice"
)));
}
if
(
request
.
getParameter
(
"itemCode"
)!=
null
){
params
.
setItemCode
(
request
.
getParameter
(
"itemCode"
));
}
params
.
setAlipay
(
request
.
getParameter
(
"alipay"
));
params
.
setPhone
(
request
.
getParameter
(
"phone"
));
params
.
setQq
(
request
.
getParameter
(
"qq"
));
if
(
request
.
getParameter
(
"waitAudit"
)!=
null
){
params
.
setWaitAudit
(
Boolean
.
valueOf
(
request
.
getParameter
(
"waitAudit"
)));
}
params
.
setIp
(
request
.
getParameter
(
"ip"
));
params
.
setParams
(
request
.
getParameter
(
"params"
));
return
params
;
}
/**
* 积分消耗结果通知请求 的解析方法
* @param request
* @return
* @throws Exception
*/
public
CreditNotifyParams
parseCreditNotify
(
HttpServletRequest
request
)
throws
Exception
{
if
(!
appKey
.
equals
(
request
.
getParameter
(
"appKey"
))){
throw
new
Exception
(
"appKey不匹配"
);
}
if
(
request
.
getParameter
(
"timestamp"
)==
null
){
throw
new
Exception
(
"请求中没有带时间戳"
);
}
boolean
verify
=
SignTool
.
signVerify
(
appSecret
,
request
);
if
(!
verify
){
throw
new
Exception
(
"签名验证失败"
);
}
CreditNotifyParams
params
=
new
CreditNotifyParams
();
params
.
setSuccess
(
Boolean
.
valueOf
(
request
.
getParameter
(
"success"
)));
params
.
setErrorMessage
(
request
.
getParameter
(
"errorMessage"
));
params
.
setBizId
(
request
.
getParameter
(
"bizId"
));
params
.
setUid
(
request
.
getParameter
(
"uid"
));
params
.
setAppKey
(
request
.
getParameter
(
"appKey"
));
params
.
setTimestamp
(
new
Date
(
Long
.
valueOf
(
request
.
getParameter
(
"timestamp"
))));
params
.
setOrderNum
(
request
.
getParameter
(
"orderNum"
));
return
params
;
}
/**
* 需要审核的兑换 的解析方法
* @param request
* @return
* @throws Exception
*/
public
CreditNeedAuditParams
parseCreditAudit
(
HttpServletRequest
request
)
throws
Exception
{
if
(!
appKey
.
equals
(
request
.
getParameter
(
"appKey"
))){
throw
new
Exception
(
"appKey不匹配"
);
}
if
(
request
.
getParameter
(
"timestamp"
)==
null
){
throw
new
Exception
(
"请求中没有带时间戳"
);
}
boolean
verify
=
SignTool
.
signVerify
(
appSecret
,
request
);
if
(!
verify
){
throw
new
Exception
(
"签名验证失败"
);
}
CreditNeedAuditParams
params
=
new
CreditNeedAuditParams
();
params
.
setAppKey
(
appKey
);
params
.
setTimestamp
(
new
Date
(
Long
.
valueOf
(
request
.
getParameter
(
"timestamp"
))));
params
.
setBizId
(
request
.
getParameter
(
"bizId"
));
return
params
;
}
/**
* 虚拟商品充值解析
* @param request
* @return
* @throws Exception
*/
public
VirtualParams
virtualConsume
(
HttpServletRequest
request
)
throws
Exception
{
if
(!
appKey
.
equals
(
request
.
getParameter
(
"appKey"
))){
throw
new
Exception
(
"appKey不匹配"
);
}
if
(
request
.
getParameter
(
"timestamp"
)==
null
){
throw
new
Exception
(
"请求中没有带时间戳"
);
}
boolean
verify
=
SignTool
.
signVerify
(
appSecret
,
request
);
if
(!
verify
){
throw
new
Exception
(
"签名验证失败"
);
}
VirtualParams
params
=
new
VirtualParams
();
params
.
setAppKey
(
appKey
);
params
.
setUid
(
request
.
getParameter
(
"uid"
));
params
.
setSupplierBizId
(
request
.
getParameter
(
"supplierBizId"
));
params
.
setTimestamp
(
new
Date
(
Long
.
valueOf
(
request
.
getParameter
(
"timestamp"
))));
params
.
setDescription
(
request
.
getParameter
(
"description"
));
params
.
setOrderNum
(
request
.
getParameter
(
"orderNum"
));
if
(
request
.
getParameter
(
"account"
)!=
null
){
params
.
setAccount
(
request
.
getParameter
(
"account"
));
}
params
.
setParams
(
request
.
getParameter
(
"params"
));
return
params
;
}
/**
* 加积分接口解析
* @param request
* @return
* @throws Exception
*/
public
AddCreditsParams
parseaddCredits
(
HttpServletRequest
request
)
throws
Exception
{
if
(!
appKey
.
equals
(
request
.
getParameter
(
"appKey"
))){
throw
new
Exception
(
"appKey不匹配"
);
}
if
(
request
.
getParameter
(
"timestamp"
)==
null
){
throw
new
Exception
(
"请求中没有带时间戳"
);
}
boolean
verify
=
SignTool
.
signVerify
(
appSecret
,
request
);
if
(!
verify
){
throw
new
Exception
(
"签名验证失败"
);
}
AddCreditsParams
params
=
new
AddCreditsParams
();
params
.
setAppKey
(
appKey
);
params
.
setUid
(
request
.
getParameter
(
"uid"
));
params
.
setCredits
(
Long
.
valueOf
(
request
.
getParameter
(
"credits"
)));
params
.
setTimestamp
(
new
Date
(
Long
.
valueOf
(
request
.
getParameter
(
"timestamp"
))));
params
.
setDescription
(
request
.
getParameter
(
"description"
));
params
.
setOrderNum
(
request
.
getParameter
(
"orderNum"
));
params
.
setType
(
request
.
getParameter
(
"type"
));
if
(
request
.
getParameter
(
"transfer"
)!=
null
){
params
.
setTransfer
(
request
.
getParameter
(
"transfer"
));
}
return
params
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/SignTool.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk
;
import
java.nio.charset.Charset
;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
public
class
SignTool
{
public
static
boolean
signVerify
(
String
appSecret
,
HttpServletRequest
request
){
Map
<
String
,
String
[]>
map
=
request
.
getParameterMap
();
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>();
for
(
String
key:
map
.
keySet
()){
data
.
put
(
key
,
map
.
get
(
key
)[
0
]);
}
return
signVerify
(
appSecret
,
data
);
}
public
static
boolean
signVerify
(
String
appSecret
,
Map
<
String
,
String
>
params
){
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"appSecret"
,
appSecret
);
for
(
String
key:
params
.
keySet
()){
if
(!
key
.
equals
(
"sign"
)){
map
.
put
(
key
,
params
.
get
(
key
));
}
}
String
sign
=
sign
(
map
);
if
(
sign
.
equals
(
params
.
get
(
"sign"
))){
return
true
;
}
return
false
;
}
private
static
String
toHexValue
(
byte
[]
messageDigest
)
{
if
(
messageDigest
==
null
)
return
""
;
StringBuilder
hexValue
=
new
StringBuilder
();
for
(
byte
aMessageDigest
:
messageDigest
)
{
int
val
=
0xFF
&
aMessageDigest
;
if
(
val
<
16
)
{
hexValue
.
append
(
"0"
);
}
hexValue
.
append
(
Integer
.
toHexString
(
val
));
}
return
hexValue
.
toString
();
}
/**
*
* @param params
* @return
*/
public
static
String
sign
(
Map
<
String
,
String
>
params
){
List
<
String
>
keys
=
new
ArrayList
<
String
>(
params
.
keySet
());
Collections
.
sort
(
keys
);
String
string
=
""
;
for
(
String
s:
keys
){
string
+=
params
.
get
(
s
);
}
String
sign
=
""
;
try
{
sign
=
toHexValue
(
encryptMD5
(
string
.
getBytes
(
Charset
.
forName
(
"utf-8"
))));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"md5 error"
);
}
return
sign
;
}
private
static
byte
[]
encryptMD5
(
byte
[]
data
)
throws
Exception
{
MessageDigest
md5
=
MessageDigest
.
getInstance
(
"MD5"
);
md5
.
update
(
data
);
return
md5
.
digest
();
}
public
static
void
main
(
String
[]
args
)
{
String
appKey
=
"key"
;
String
appSecret
=
"secret"
;
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"appKey"
,
appKey
);
params
.
put
(
"appSecret"
,
appSecret
);
params
.
put
(
"date"
,
new
Date
().
getTime
()+
""
);
String
sign
=
sign
(
params
);
params
.
put
(
"sign"
,
sign
);
System
.
out
.
println
(
signVerify
(
appSecret
,
params
));
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/AddCreditsParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
public
class
AddCreditsParams
{
private
String
appKey
;
private
Date
timestamp
;
//时间戳
private
Long
credits
;
//增加积分值
private
String
orderNum
=
""
;
//兑吧订单号
private
String
description
=
""
;
private
String
type
=
""
;
//积分活类型,活动和签到
private
String
uid
=
""
;
private
String
ip
=
""
;
//用户兑换时使用的ip地址,有可能为空
private
String
transfer
=
""
;
//非必须参数
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
String
getUid
()
{
return
uid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
String
getTransfer
()
{
return
transfer
;
}
public
void
setTransfer
(
String
transfer
)
{
this
.
transfer
=
transfer
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/CreditAuditParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 开发者向兑吧发起请求,通知兑吧,订单的审核结果的参数
*
* 兑吧产生的部分订单,出于安全的考虑,会要求开发者进行审核,审核通过后才会继续执行兑换操作
*
* 如果开发者要告知兑吧审核结果,可以向兑吧发起请求,构建这个 CreditAuditParams对象,将此对象发送给兑吧即可
*
* @author xuhengfei
*
*/
public
class
CreditAuditParams
{
//审核通过的订单列表
private
List
<
String
>
passOrderNums
=
new
ArrayList
<
String
>();
//审核不通过的订单列表
private
List
<
String
>
rejectOrderNums
=
new
ArrayList
<
String
>();
public
List
<
String
>
getPassOrderNums
()
{
return
passOrderNums
;
}
public
void
setPassOrderNums
(
List
<
String
>
passOrderNums
)
{
this
.
passOrderNums
=
passOrderNums
;
}
public
List
<
String
>
getRejectOrderNums
()
{
return
rejectOrderNums
;
}
public
void
setRejectOrderNums
(
List
<
String
>
rejectOrderNums
)
{
this
.
rejectOrderNums
=
rejectOrderNums
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/CreditConfirmParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
/**
* 开发者向兑吧发起请求,确认兑换成功失败的参数
*
* 目前仅限于虚拟商品,需要使用
* @author xuhengfei
*
*/
public
class
CreditConfirmParams
{
private
boolean
success
=
true
;
private
String
errorMessage
=
""
;
private
String
orderNum
=
""
;
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/CreditConsumeParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
cn.com.duiba.credits.sdk.SignTool
;
public
class
CreditConsumeParams
{
private
String
appKey
;
private
Date
timestamp
;
//时间戳
private
Long
credits
;
//消耗积分数
private
String
orderNum
=
""
;
//兑吧订单号
private
String
description
=
""
;
private
String
itemCode
=
""
;
//商品编码,非必须参数
private
String
type
=
""
;
//类型:QB,Phonebill,Alipay,Coupon 所有类型不区分大小写
private
Integer
facePrice
=
0
;
//面值,分为单位
private
Integer
actualPrice
=
0
;
//实际扣款,分为单位
private
String
alipay
=
""
;
//已废弃,请使用params
private
String
phone
=
""
;
//已废弃,请使用params
private
String
qq
=
""
;
//已废弃,请使用params
private
String
uid
=
""
;
private
boolean
waitAudit
=
false
;
//是否等待审核, 如果返回true,表示此订单需要审核,审核通过后才会继续下去。 如果返回false表示此订单无须审核,会直接继续兑换流程
private
String
ip
=
""
;
//用户兑换时使用的ip地址,有可能为空
private
String
params
=
""
;
//参数,根据不同的type,有不同的含义,参见在线文档
private
String
transfer
=
""
;
public
Map
<
String
,
String
>
toRequestMap
(
String
appSecret
){
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"credits"
,
credits
+
""
);
map
.
put
(
"description"
,
description
);
map
.
put
(
"uid"
,
uid
);
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"waitAudit"
,
waitAudit
+
""
);
map
.
put
(
"appSecret"
,
appSecret
);
map
.
put
(
"timestamp"
,
timestamp
.
getTime
()+
""
);
map
.
put
(
"orderNum"
,
orderNum
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"facePrice"
,
facePrice
+
""
);
map
.
put
(
"actualPrice"
,
actualPrice
+
""
);
map
.
put
(
"ip"
,
ip
);
map
.
put
(
"params"
,
params
);
putIfNotEmpty
(
map
,
"itemCode"
,
itemCode
);
putIfNotEmpty
(
map
,
"transfer"
,
transfer
);
putIfNotEmpty
(
map
,
"qq"
,
qq
);
putIfNotEmpty
(
map
,
"alipay"
,
alipay
);
putIfNotEmpty
(
map
,
"phone"
,
phone
);
String
sign
=
SignTool
.
sign
(
map
);
map
.
remove
(
"appSecret"
);
map
.
put
(
"sign"
,
sign
);
return
map
;
}
private
void
putIfNotEmpty
(
Map
<
String
,
String
>
map
,
String
key
,
String
value
){
if
(
value
==
null
||
value
.
length
()==
0
){
return
;
}
map
.
put
(
key
,
value
);
}
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
public
String
getItemCode
()
{
return
itemCode
;
}
public
void
setItemCode
(
String
itemCode
)
{
this
.
itemCode
=
itemCode
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
String
getUid
()
{
return
uid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
boolean
isWaitAudit
()
{
return
waitAudit
;
}
public
void
setWaitAudit
(
boolean
waitAudit
)
{
this
.
waitAudit
=
waitAudit
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Integer
getFacePrice
()
{
return
facePrice
;
}
public
void
setFacePrice
(
Integer
facePrice
)
{
this
.
facePrice
=
facePrice
;
}
public
Integer
getActualPrice
()
{
return
actualPrice
;
}
public
void
setActualPrice
(
Integer
actualPrice
)
{
this
.
actualPrice
=
actualPrice
;
}
public
String
getAlipay
()
{
return
alipay
;
}
public
void
setAlipay
(
String
alipay
)
{
this
.
alipay
=
alipay
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getQq
()
{
return
qq
;
}
public
void
setQq
(
String
qq
)
{
this
.
qq
=
qq
;
}
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
String
getParams
()
{
return
params
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
public
String
getTransfer
()
{
return
transfer
;
}
public
void
setTransfer
(
String
transfer
)
{
this
.
transfer
=
transfer
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/CreditNeedAuditParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
cn.com.duiba.credits.sdk.SignTool
;
public
class
CreditNeedAuditParams
{
private
String
appKey
;
private
String
bizId
=
""
;
private
Date
timestamp
;
public
CreditNeedAuditParams
(){
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
public
Map
<
String
,
String
>
toRequestMap
(
String
appSecret
){
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"bizId"
,
bizId
+
""
);
map
.
put
(
"appKey"
,
appKey
+
""
);
map
.
put
(
"appSecret"
,
appSecret
+
""
);
map
.
put
(
"timestamp"
,
timestamp
.
getTime
()+
""
);
String
sign
=
SignTool
.
sign
(
map
);
map
.
remove
(
"appSecret"
);
map
.
put
(
"sign"
,
sign
);
return
map
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/CreditNotifyParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
cn.com.duiba.credits.sdk.SignTool
;
public
class
CreditNotifyParams
{
private
boolean
success
;
private
String
bizId
=
""
;
private
String
errorMessage
=
""
;
private
String
orderNum
=
""
;
private
Date
timestamp
=
new
Date
();
private
String
appKey
;
private
String
uid
=
""
;
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
public
Map
<
String
,
String
>
toRequestMap
(
String
appSecret
){
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"success"
,
success
+
""
);
map
.
put
(
"errorMessage"
,
getString
(
errorMessage
));
map
.
put
(
"bizId"
,
getString
(
bizId
));
map
.
put
(
"appKey"
,
getString
(
appKey
));
map
.
put
(
"appSecret"
,
getString
(
appSecret
));
map
.
put
(
"timestamp"
,
getString
(
timestamp
.
getTime
()));
map
.
put
(
"uid"
,
getString
(
uid
));
map
.
put
(
"orderNum"
,
getString
(
orderNum
));
String
sign
=
SignTool
.
sign
(
map
);
map
.
remove
(
"appSecret"
);
map
.
put
(
"sign"
,
sign
);
return
map
;
}
private
String
getString
(
Object
o
){
if
(
o
==
null
){
return
""
;
}
return
o
.
toString
();
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/ExpressInfo.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
/**
* 构建开发者批量发货的发货信息
* @author Yang-yudong
*
*/
public
class
ExpressInfo
{
private
String
orderNum
;
//兑吧订单号
private
String
expressNum
;
//快递单号
private
String
expressType
;
//快递类型
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
String
getExpressNum
()
{
return
expressNum
;
}
public
void
setExpressNum
(
String
expressNum
)
{
this
.
expressNum
=
expressNum
;
}
public
String
getExpressType
()
{
return
expressType
;
}
public
void
setExpressType
(
String
expressType
)
{
this
.
expressType
=
expressType
;
}
/**
* 构建发货信息的toString方法
*/
@Override
public
String
toString
()
{
return
orderNum
+
"|"
+
expressType
+
"|"
+
expressNum
+
","
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/entity/VirtualParams.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.entity
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
cn.com.duiba.credits.sdk.SignTool
;
/**
*
* @author yangyudong
*
*/
public
class
VirtualParams
{
private
String
appKey
;
//应用标示appKey
private
Date
timestamp
;
//时间戳,当前时间毫秒值
private
Long
credits
;
//积分
private
String
supplierBizId
=
""
;
//充值流水号
private
String
uid
=
""
;
//用户id
private
String
description
=
""
;
//虚拟商品标示符
private
String
orderNum
=
""
;
//兑吧订单号
private
String
account
=
""
;
//虚拟商品充值账号,非必须参数
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
private
String
params
=
""
;
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
Map
<
String
,
String
>
toRequestMap
(
String
appSecret
){
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"description"
,
description
);
map
.
put
(
"uid"
,
uid
);
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"supplierBizId"
,
supplierBizId
);
map
.
put
(
"appSecret"
,
appSecret
);
map
.
put
(
"timestamp"
,
timestamp
.
getTime
()+
""
);
map
.
put
(
"orderNum"
,
orderNum
);
map
.
put
(
"params"
,
params
);
String
sign
=
SignTool
.
sign
(
map
);
map
.
remove
(
"appSecret"
);
map
.
put
(
"sign"
,
sign
);
return
map
;
}
public
String
getUid
()
{
return
uid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
String
getSupplierBizId
()
{
return
supplierBizId
;
}
public
void
setSupplierBizId
(
String
supplierBizId
)
{
this
.
supplierBizId
=
supplierBizId
;
}
public
String
getParams
()
{
return
params
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/result/AddCreditResult.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.result
;
public
class
AddCreditResult
{
private
boolean
success
;
private
String
errorMessage
=
""
;
private
String
bizId
=
""
;
private
Long
credits
=-
1L
;
//用户积分余额
public
AddCreditResult
(
boolean
success
){
this
.
success
=
success
;
}
public
String
toString
(){
if
(
success
){
return
"{'status':'ok','errorMessage':'','bizId':'"
+
bizId
+
"','credits':'"
+
credits
+
"'}"
;
}
else
{
return
"{'status':'fail','errorMessage':'"
+
errorMessage
+
"','credits':'"
+
credits
+
"'}"
;
}
}
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/result/CreditConsumeResult.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.result
;
public
class
CreditConsumeResult
{
private
boolean
success
;
private
String
errorMessage
=
""
;
private
String
bizId
=
""
;
private
Long
credits
=-
1L
;
//用户积分余额
public
CreditConsumeResult
(
boolean
success
){
this
.
success
=
success
;
}
public
String
toString
(){
if
(
success
){
return
"{'status':'ok','errorMessage':'','bizId':'"
+
bizId
+
"','credits':'"
+
credits
+
"'}"
;
}
else
{
return
"{'status':'fail','errorMessage':'"
+
errorMessage
+
"','credits':'"
+
credits
+
"'}"
;
}
}
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/cn/com/duiba/credits/sdk/result/VirtualResult.java
0 → 100644
View file @
bc5dd330
package
cn.com.duiba.credits.sdk.result
;
public
class
VirtualResult
{
private
String
status
;
//充值是否成功的状态
private
String
errorMessage
=
""
;
//失败信息
private
String
supplierBizId
=
""
;
//虚拟商品充值流水号
private
Long
credits
=-
1L
;
public
VirtualResult
(
String
status
){
this
.
status
=
status
;
}
public
String
toString
(){
if
(
status
==
"success"
){
return
"{'status':'success','credits':'"
+
credits
+
"','supplierBizId':'"
+
supplierBizId
+
"'}"
;
}
else
if
(
status
==
"process"
){
return
"{'status':'success','credits':'"
+
credits
+
"','supplierBizId':'"
+
supplierBizId
+
"'}"
;
}
else
return
"{'status':'fail','errorMessage':'"
+
errorMessage
+
"','supplierBizId':'"
+
supplierBizId
+
"'}"
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
String
getSupplierBizId
()
{
return
supplierBizId
;
}
public
void
setSupplierBizId
(
String
supplierBizId
)
{
this
.
supplierBizId
=
supplierBizId
;
}
public
Long
getCredits
()
{
return
credits
;
}
public
void
setCredits
(
Long
credits
)
{
this
.
credits
=
credits
;
}
}
JeeSpringCloud/jeespring-company/src/main/java/com/company/compnay.txt
0 → 100644
View file @
bc5dd330
JeeSpringCloud/jeespring-company/src/main/java/com/company/project/modules/duiba/duibaRestController.java
0 → 100644
View file @
bc5dd330
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.company.project.modules.duiba
;
import
cn.com.duiba.credits.sdk.BulidUrl
;
import
cn.com.duiba.credits.sdk.CreditTool
;
import
cn.com.duiba.credits.sdk.entity.CreditConsumeParams
;
import
cn.com.duiba.credits.sdk.result.CreditConsumeResult
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 订单Controller
* @author 黄炳桂
* @version 2017-11-13
*/
@RestController
@RequestMapping
(
value
=
"/duiba"
)
@Api
(
value
=
"duiba"
,
description
=
"积分兑换"
)
public
class
duibaRestController
extends
AbstractBaseController
{
@RequestMapping
(
value
=
{
"index"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"积分兑换首页(Content-Type为text/html)"
,
notes
=
"积分兑换首页(Content-Type为text/html)"
)
public
Result
index
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Long
credits
=
Long
.
valueOf
(
0
);
String
redirect
=
null
;
if
(
request
.
getParameter
(
"credits"
)!=
null
){
credits
=
Long
.
valueOf
(
request
.
getParameter
(
"credits"
));
}
if
(
request
.
getParameter
(
"redirect"
)!=
null
){
redirect
=
request
.
getParameter
(
"redirect"
);
}
if
(
request
.
getParameter
(
"dbredirect"
)!=
null
){
redirect
=
request
.
getParameter
(
"dbredirect"
);
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
BulidUrl
.
buildAutoLoginRequest
(
request
.
getParameter
(
"uid"
),
credits
,
redirect
));
return
result
;
}
@RequestMapping
(
value
=
{
"signIn"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"签到(Content-Type为text/html)"
,
notes
=
"签到(Content-Type为text/html)"
)
public
Result
signIn
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Long
credits
=
Long
.
valueOf
(
0
);
String
redirect
=
null
;
if
(
request
.
getParameter
(
"credits"
)!=
null
){
credits
=
Long
.
valueOf
(
request
.
getParameter
(
"credits"
));
}
if
(
request
.
getParameter
(
"redirect"
)!=
null
){
redirect
=
request
.
getParameter
(
"redirect"
);
}
else
{
//redirect="http://activity.m.duiba.com.cn/activity/acShareIndex?url=https%3A%2F%2Factivity-1.m.duiba.com.cn%2Fnewtools%2Findex%3Fid%3D2685169&apk=3dqRcUoEnKDLAj5ziF63DgkZBT3z";
redirect
=
"https://activity.m.duiba.com.cn/signactivity/index?id=90&dpm=43346.41.1.0&dcm=216.90.51.0&appKey=7HWwRiKJXPiyh7pF4QnYAieVPQL&open4share=tongdun"
;
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
BulidUrl
.
buildAutoLoginRequest
(
request
.
getParameter
(
"uid"
),
credits
,
redirect
));
return
result
;
}
@RequestMapping
(
value
=
{
"cancle"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"扣积分(Content-Type为text/html)"
,
notes
=
"扣积分(Content-Type为text/html)"
)
public
void
cancle
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
CreditTool
tool
=
new
CreditTool
(
BulidUrl
.
AppKey
,
BulidUrl
.
AppSecret
);
try
{
CreditConsumeParams
params
=
tool
.
parseCreditConsume
(
request
);
//利用tool来解析这个请求
String
uid
=
params
.
getUid
();
//用户id
Long
credits
=
params
.
getCredits
();
String
type
=
params
.
getType
();
//获取兑换类型
String
alipay
=
params
.
getAlipay
();
//获取支付宝账号
//其他参数参见 params的属性字段
//TODO 开发者系统对uid用户扣除credits个积分
String
bizId
=
"001"
;
//返回开发者系统中的业务订单id
CreditConsumeResult
result
=
new
CreditConsumeResult
(
true
);
result
.
setBizId
(
bizId
);
response
.
getWriter
().
write
(
result
.
toString
());
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
@RequestMapping
(
value
=
{
"add"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"加积分(Content-Type为text/html)"
,
notes
=
"加积分(Content-Type为text/html)"
)
public
String
add
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
return
"{'status': 'ok','errorMessage': '失败原因''credits': '100'}"
;
}
}
\ No newline at end of file
Prev
1
2
Next
Write
Preview
Supports
Markdown
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