Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jd-activity
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
曾水平
jd-activity
Commits
a9b0fab1
Commit
a9b0fab1
authored
Jun 24, 2021
by
曾水平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增应用;优惠券支持锁券
parent
2c4835f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
Open2DuibaController.java
...com/duiba/jdactivity/controller/Open2DuibaController.java
+20
-9
DuibaAppEnum.java
...cn/com/duiba/jdactivity/developer/duiba/DuibaAppEnum.java
+5
-0
JdApiUtil.java
...cn/com/duiba/jdactivity/developer/jd/utils/JdApiUtil.java
+1
-1
No files found.
src/main/java/cn/com/duiba/jdactivity/controller/Open2DuibaController.java
View file @
a9b0fab1
...
@@ -464,6 +464,17 @@ public class Open2DuibaController {
...
@@ -464,6 +464,17 @@ public class Open2DuibaController {
Result
<
Boolean
>
sendCouponResult
=
jdApiUtil
.
pushCoupon
(
appEnum
,
accessToken
.
getAccessToken
(),
couponId
,
pin
,
uuid
);
Result
<
Boolean
>
sendCouponResult
=
jdApiUtil
.
pushCoupon
(
appEnum
,
accessToken
.
getAccessToken
(),
couponId
,
pin
,
uuid
);
LOGGER
.
info
(
"发放优惠券,sendCouponResult={},uid={},pin={},uuid={}"
,
JSON
.
toJSONString
(
sendCouponResult
),
uid
,
pin
,
uuid
);
LOGGER
.
info
(
"发放优惠券,sendCouponResult={},uid={},pin={},uuid={}"
,
JSON
.
toJSONString
(
sendCouponResult
),
uid
,
pin
,
uuid
);
if
(!
sendCouponResult
.
getSuccess
())
{
// 如果失败是因为未锁券
if
(
Objects
.
equals
(
"67"
,
sendCouponResult
.
getCode
()))
{
// 锁券
sendCouponResult
=
jdApiUtil
.
lockCoupon
(
appEnum
,
accessToken
.
getAccessToken
(),
couponId
);
if
(
sendCouponResult
.
getSuccess
())
{
// 再发券
sendCouponResult
=
jdApiUtil
.
pushCoupon
(
appEnum
,
accessToken
.
getAccessToken
(),
couponId
,
pin
,
uuid
);
}
}
}
return
sendCouponResult
;
return
sendCouponResult
;
}
catch
(
BizException
e
)
{
}
catch
(
BizException
e
)
{
return
ResultBuilder
.
fail
(
e
.
getMessage
());
return
ResultBuilder
.
fail
(
e
.
getMessage
());
...
@@ -511,10 +522,10 @@ public class Open2DuibaController {
...
@@ -511,10 +522,10 @@ public class Open2DuibaController {
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
Result
<
Boolean
>
sendCouponR
esult
=
jdApiUtil
.
sendPoints
(
Result
<
Boolean
>
r
esult
=
jdApiUtil
.
sendPoints
(
appEnum
,
pin
,
param
.
getBusinessId
(),
param
.
getPoints
(),
param
.
getDesc
(),
accessToken
.
getAccessToken
());
appEnum
,
pin
,
param
.
getBusinessId
(),
param
.
getPoints
(),
param
.
getDesc
(),
accessToken
.
getAccessToken
());
LOGGER
.
info
(
"互动积分发放积分,
sendCouponResult={},uid={},pin={}"
,
JSON
.
toJSONString
(
sendCouponR
esult
),
uid
,
pin
);
LOGGER
.
info
(
"互动积分发放积分,
result={},uid={},pin={}"
,
JSON
.
toJSONString
(
r
esult
),
uid
,
pin
);
return
sendCouponR
esult
;
return
r
esult
;
}
catch
(
BizException
e
)
{
}
catch
(
BizException
e
)
{
return
ResultBuilder
.
fail
(
e
.
getMessage
());
return
ResultBuilder
.
fail
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -540,9 +551,9 @@ public class Open2DuibaController {
...
@@ -540,9 +551,9 @@ public class Open2DuibaController {
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
Result
<
Boolean
>
sendCouponR
esult
=
jdApiUtil
.
addCartItemByPin
(
appEnum
,
pin
,
itemId
,
num
,
accessToken
.
getAccessToken
());
Result
<
Boolean
>
r
esult
=
jdApiUtil
.
addCartItemByPin
(
appEnum
,
pin
,
itemId
,
num
,
accessToken
.
getAccessToken
());
LOGGER
.
info
(
"通过用户pin加入购物车,
sendCouponResult={}"
,
JSON
.
toJSONString
(
sendCouponR
esult
));
LOGGER
.
info
(
"通过用户pin加入购物车,
result={}"
,
JSON
.
toJSONString
(
r
esult
));
return
sendCouponR
esult
;
return
r
esult
;
}
catch
(
BizException
e
)
{
}
catch
(
BizException
e
)
{
return
ResultBuilder
.
fail
(
e
.
getMessage
());
return
ResultBuilder
.
fail
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -567,11 +578,11 @@ public class Open2DuibaController {
...
@@ -567,11 +578,11 @@ public class Open2DuibaController {
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
JdAppEnum
appEnum
=
JdAppEnum
.
getAppByAppKey
(
accessToken
.
getAppKey
());
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
String
pin
=
convert2Pin
(
appEnum
,
accessToken
.
getAccessToken
(),
uid
);
Result
<
Boolean
>
sendCouponR
esult
=
jdApiUtil
.
sendBean
(
appEnum
,
accessToken
.
getAccessToken
(),
Result
<
Boolean
>
r
esult
=
jdApiUtil
.
sendBean
(
appEnum
,
accessToken
.
getAccessToken
(),
param
.
getRequestId
(),
param
.
getBeanNum
(),
accessToken
.
getVenderId
(),
param
.
getRequestId
(),
param
.
getBeanNum
(),
accessToken
.
getVenderId
(),
param
.
getPlanId
(),
pin
,
param
.
getDesc
());
param
.
getPlanId
(),
pin
,
param
.
getDesc
());
LOGGER
.
info
(
"
通过用户pin加入购物车,sendCouponResult={}"
,
JSON
.
toJSONString
(
sendCouponR
esult
));
LOGGER
.
info
(
"
发送京豆,result={}"
,
JSON
.
toJSONString
(
r
esult
));
return
sendCouponR
esult
;
return
r
esult
;
}
catch
(
BizException
e
)
{
}
catch
(
BizException
e
)
{
return
ResultBuilder
.
fail
(
e
.
getMessage
());
return
ResultBuilder
.
fail
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/cn/com/duiba/jdactivity/developer/duiba/DuibaAppEnum.java
View file @
a9b0fab1
...
@@ -5,13 +5,18 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -5,13 +5,18 @@ import org.apache.commons.lang3.StringUtils;
import
java.util.Objects
;
import
java.util.Objects
;
/**
/**
* 兑吧app,后续想个灵活的方式
*
* @author zsp (zengshuiping@duiba.com.cn)
* @author zsp (zengshuiping@duiba.com.cn)
* @date 2021/5/18 15:58
* @date 2021/5/18 15:58
*/
*/
public
enum
DuibaAppEnum
{
public
enum
DuibaAppEnum
{
WX
(
"微信公众号测试"
,
"3bRVpGghtsQXXeZpVH4VGi92Nr7V"
,
"28Ujh91mWeKSCZ4ndDyLWf527TN1"
),
WX
(
"微信公众号测试"
,
"3bRVpGghtsQXXeZpVH4VGi92Nr7V"
,
"28Ujh91mWeKSCZ4ndDyLWf527TN1"
),
JD_ACTIVITY_TEST
(
"19543-京东活动测试-测试"
,
"oZ1hxUrKW95Qn9P4BZpSGSTdUDZ"
,
"3kQU8Rp31zifPiypTqVmujQ1h5X4"
),
TEST_4_27
(
"4-27测试"
,
"22KCCnB22yZihPnuB8gpqZhtdAka"
,
"ct8j6grNJ5cCqQcN1c8sTdSEdcK"
),
TEST_4_27
(
"4-27测试"
,
"22KCCnB22yZihPnuB8gpqZhtdAka"
,
"ct8j6grNJ5cCqQcN1c8sTdSEdcK"
),
BOSIDENG_PROD
(
"波司登线上"
,
"4EBS3taRKgKpKKSVg4xv4UnfEESh"
,
"2hMzuvExEE7XzfThv2fbnUKxRsXA"
),
BOSIDENG_PROD
(
"波司登线上"
,
"4EBS3taRKgKpKKSVg4xv4UnfEESh"
,
"2hMzuvExEE7XzfThv2fbnUKxRsXA"
),
GANGBEN_PROD
(
"冈本-线上"
,
"2NWc2qqfEzMoCDzFpF2q7cTPYJWc"
,
"3dFe4VbW7PqAiTGrJiehRaVUPLUw"
),
YITOUNIU_PROD
(
"认养一头牛-线上"
,
"2NWc2qqfEzMoCDzFpF2q7cTPYJWc"
,
"3dFe4VbW7PqAiTGrJiehRaVUPLUw"
),
;
;
...
...
src/main/java/cn/com/duiba/jdactivity/developer/jd/utils/JdApiUtil.java
View file @
a9b0fab1
...
@@ -510,7 +510,7 @@ public class JdApiUtil {
...
@@ -510,7 +510,7 @@ public class JdApiUtil {
SellerCouponWritePushCouponResponse
response
=
client
.
execute
(
request
);
SellerCouponWritePushCouponResponse
response
=
client
.
execute
(
request
);
if
(!
CODE_SUCCESS
.
equals
(
response
.
getCode
()))
{
if
(!
CODE_SUCCESS
.
equals
(
response
.
getCode
()))
{
LOGGER
.
warn
(
"发券失败:couponId:{},return_code:{},return_msg:{}"
,
couponId
,
response
.
getCode
(),
response
.
getMsg
());
LOGGER
.
warn
(
"发券失败:couponId:{},return_code:{},return_msg:{}"
,
couponId
,
response
.
getCode
(),
response
.
getMsg
());
return
ResultBuilder
.
fail
(
"发券失败:"
+
response
.
getZhDesc
());
return
ResultBuilder
.
fail
(
response
.
getCode
(),
response
.
getZhDesc
());
}
}
LOGGER
.
info
(
"发券成功:couponId:{},pin:{}"
,
couponId
,
pin
);
LOGGER
.
info
(
"发券成功:couponId:{},pin:{}"
,
couponId
,
pin
);
return
ResultBuilder
.
success
(
Boolean
.
TRUE
);
return
ResultBuilder
.
success
(
Boolean
.
TRUE
);
...
...
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