记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
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
董敬伟
liquidnet-bus-v1
Commits
49232118
Commit
49232118
authored
Aug 30, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交券
parent
d4f97cbd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
31 deletions
+101
-31
ICandyCouponService.java
.../liquidnet/service/candy/service/ICandyCouponService.java
+2
-2
HttpUtil.java
...c/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
+48
-0
CandyCouponController.java
...idnet/service/candy/controller/CandyCouponController.java
+8
-12
CandyCouponServiceImpl.java
...et/service/candy/service/impl/CandyCouponServiceImpl.java
+4
-4
CouponBaseUtil.java
...java/com/liquidnet/service/candy/util/CouponBaseUtil.java
+5
-4
KylinOrderTicketsServiceImpl.java
...vice/order/service/impl/KylinOrderTicketsServiceImpl.java
+7
-3
OrderUtils.java
...in/java/com/liquidnet/service/order/utils/OrderUtils.java
+27
-6
No files found.
liquidnet-bus-api/liquidnet-service-candy-api/src/main/java/com/liquidnet/service/candy/service/ICandyCouponService.java
View file @
49232118
...
@@ -27,9 +27,9 @@ public interface ICandyCouponService {
...
@@ -27,9 +27,9 @@ public interface ICandyCouponService {
Integer
preCanUsePerformanceCoupon
(
BigDecimal
priceTotal
,
String
performanceId
,
String
timeId
,
String
ticketId
);
Integer
preCanUsePerformanceCoupon
(
BigDecimal
priceTotal
,
String
performanceId
,
String
timeId
,
String
ticketId
);
CandyMyCouponListVo
preUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
,
String
produceId
,
Integer
type
);
CandyMyCouponListVo
preUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
,
Integer
type
);
Integer
preCanUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodI
d
,
String
produceId
);
Integer
preCanUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodI
);
List
<
CandyCouponVo
>
myAdvanceCoupon
();
List
<
CandyCouponVo
>
myAdvanceCoupon
();
...
...
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
View file @
49232118
...
@@ -64,6 +64,18 @@ public class HttpUtil {
...
@@ -64,6 +64,18 @@ public class HttpUtil {
return
request
(
url
,
params
,
headers
,
HttpMethod
.
POST
);
return
request
(
url
,
params
,
headers
,
HttpMethod
.
POST
);
}
}
/**
* post请求
*
* @param url
* @param jsonString 请求参数
* @param headers 请求头
* @return
*/
public
static
String
postRaw
(
String
url
,
String
jsonString
,
MultiValueMap
<
String
,
String
>
headers
)
{
return
requestRaw
(
url
,
jsonString
,
headers
,
HttpMethod
.
POST
);
}
/**
/**
* put请求
* put请求
*
*
...
@@ -126,6 +138,22 @@ public class HttpUtil {
...
@@ -126,6 +138,22 @@ public class HttpUtil {
return
request
(
url
,
params
,
headers
,
method
,
MediaType
.
APPLICATION_FORM_URLENCODED
);
return
request
(
url
,
params
,
headers
,
method
,
MediaType
.
APPLICATION_FORM_URLENCODED
);
}
}
/**
* 表单请求Raw
*
* @param url 请求地址
* @param params 请求参数
* @param headers 请求头
* @param method 请求方式
* @return
*/
public
static
String
requestRaw
(
String
url
,
String
params
,
MultiValueMap
<
String
,
String
>
headers
,
HttpMethod
method
)
{
if
(
params
==
null
)
{
params
=
""
;
}
return
requestRaw
(
url
,
params
,
headers
,
method
,
MediaType
.
APPLICATION_JSON
);
}
/**
/**
* http请求
* http请求
*
*
...
@@ -154,6 +182,26 @@ public class HttpUtil {
...
@@ -154,6 +182,26 @@ public class HttpUtil {
return
response
.
getBody
();
return
response
.
getBody
();
}
}
public
static
String
requestRaw
(
String
url
,
Object
params
,
MultiValueMap
<
String
,
String
>
headers
,
HttpMethod
method
,
MediaType
mediaType
)
{
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
return
null
;
}
// header
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
if
(
headers
!=
null
)
{
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
httpHeaders
.
addAll
(
headers
);
httpHeaders
.
set
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
}
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
params
,
httpHeaders
);
// RestTemplate restTemplate = new RestTemplate();
// 提交方式:表单、json
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
return
response
.
getBody
();
}
private
static
final
String
PHP_API_KEY
=
"R7tXY9smPQPG9Ku5yI0u6sfnlckmk04V"
;
private
static
final
String
PHP_API_KEY
=
"R7tXY9smPQPG9Ku5yI0u6sfnlckmk04V"
;
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/controller/CandyCouponController.java
View file @
49232118
...
@@ -88,34 +88,30 @@ public class CandyCouponController {
...
@@ -88,34 +88,30 @@ public class CandyCouponController {
//要使用券列表 - 商品
//要使用券列表 - 商品
@
Ge
tMapping
(
"preUse/goods"
)
@
Pos
tMapping
(
"preUse/goods"
)
@ApiOperation
(
"要使用券列表 - 商品"
)
@ApiOperation
(
"要使用券列表 - 商品"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"BigDecimal"
,
name
=
"priceTotal"
,
value
=
"待支付总金额"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"BigDecimal"
,
name
=
"priceTotal"
,
value
=
"待支付总金额"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"goodId"
,
value
=
"演出id"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"goodId"
,
value
=
"商品id(逗号隔开的字符串)"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"produceId"
,
value
=
"场次id"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"Integer"
,
name
=
"type"
,
value
=
"类型 1可用 2过期/已使用 "
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"Integer"
,
name
=
"type"
,
value
=
"类型 1可用 2过期/已使用 "
,
required
=
true
),
})
})
public
ResponseDto
<
CandyMyCouponListVo
>
preUseGoodCoupon
(
@RequestParam
(
"priceTotal"
)
@NotNull
BigDecimal
priceTotal
,
public
ResponseDto
<
CandyMyCouponListVo
>
preUseGoodCoupon
(
@RequestParam
(
"priceTotal"
)
@NotNull
BigDecimal
priceTotal
,
@RequestParam
(
"goodId"
)
@NotNull
@NotBlank
String
goodId
,
@RequestParam
(
"goodId"
)
@NotNull
@NotBlank
String
goodId
,
@RequestParam
(
"produceId"
)
@NotNull
@NotBlank
String
produceId
,
@RequestParam
(
"type"
)
@NotNull
Integer
type
)
{
@RequestParam
(
"type"
)
@NotNull
Integer
type
)
{
return
ResponseDto
.
success
(
candyCouponService
.
preUseGoodCoupon
(
priceTotal
,
goodId
,
produceId
,
type
));
return
ResponseDto
.
success
(
candyCouponService
.
preUseGoodCoupon
(
priceTotal
,
goodId
,
type
));
}
}
//是否可用券 - 商品
//是否可用券 - 商品
@
Ge
tMapping
(
"preCanUse/goods"
)
@
Pos
tMapping
(
"preCanUse/goods"
)
@ApiOperation
(
"是否可用券 - 商品"
)
@ApiOperation
(
"是否可用券 - 商品"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"BigDecimal"
,
name
=
"priceTotal"
,
value
=
"待支付总金额"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"BigDecimal"
,
name
=
"priceTotal"
,
value
=
"待支付总金额"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"goodId"
,
value
=
"演出id"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"goodId"
,
value
=
"商品id(逗号隔开的字符串)"
,
required
=
true
)
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"produceId"
,
value
=
"场次id"
,
required
=
true
),
})
})
public
ResponseDto
<
HashMap
<
String
,
Integer
>>
preCanUseGoodCoupon
(
@RequestParam
(
"priceTotal"
)
@NotNull
BigDecimal
priceTotal
,
public
ResponseDto
<
HashMap
<
String
,
Integer
>>
preCanUseGoodCoupon
(
@RequestParam
(
"priceTotal"
)
@NotNull
BigDecimal
priceTotal
,
@RequestParam
(
"goodId"
)
@NotNull
@NotBlank
String
goodId
,
@RequestParam
(
"goodId"
)
@NotNull
@NotBlank
String
goodId
)
{
@RequestParam
(
"produceId"
)
@NotNull
@NotBlank
String
produceId
)
{
HashMap
<
String
,
Integer
>
hashMap
=
CollectionUtil
.
mapStringInteger
();
HashMap
<
String
,
Integer
>
hashMap
=
CollectionUtil
.
mapStringInteger
();
hashMap
.
put
(
"canUse"
,
candyCouponService
.
preCanUseGoodCoupon
(
priceTotal
,
goodId
,
produceId
));
hashMap
.
put
(
"canUse"
,
candyCouponService
.
preCanUseGoodCoupon
(
priceTotal
,
goodId
));
return
ResponseDto
.
success
(
hashMap
);
return
ResponseDto
.
success
(
hashMap
);
}
}
...
@@ -165,7 +161,7 @@ public class CandyCouponController {
...
@@ -165,7 +161,7 @@ public class CandyCouponController {
@PostMapping
(
"useBack"
)
@PostMapping
(
"useBack"
)
@ApiOperation
(
"回退券"
)
@ApiOperation
(
"回退券"
)
public
ResponseDto
<
Boolean
>
useBackCoupon
(
@RequestBody
@Valid
List
<
BackCouponParam
>
backCouponParam
)
{
public
ResponseDto
<
Boolean
>
useBackCoupon
(
@RequestBody
@Valid
List
<
BackCouponParam
>
backCouponParam
)
{
if
(
backCouponParam
.
size
()>
100
)
{
if
(
backCouponParam
.
size
()
>
100
)
{
return
ResponseDto
.
failure
(
"数据量不得大于100"
);
return
ResponseDto
.
failure
(
"数据量不得大于100"
);
}
}
candyCouponService
.
useBackCoupon
(
backCouponParam
);
candyCouponService
.
useBackCoupon
(
backCouponParam
);
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/service/impl/CandyCouponServiceImpl.java
View file @
49232118
...
@@ -126,7 +126,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
...
@@ -126,7 +126,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
}
@Override
@Override
public
CandyMyCouponListVo
preUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
,
String
produceId
,
Integer
type
)
{
public
CandyMyCouponListVo
preUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
,
Integer
type
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
String
uid
=
CurrentUtil
.
getCurrentUid
();
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
);
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
);
CandyMyCouponListVo
vo
=
CandyMyCouponListVo
.
getNew
();
CandyMyCouponListVo
vo
=
CandyMyCouponListVo
.
getNew
();
...
@@ -143,7 +143,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
...
@@ -143,7 +143,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
continue
;
continue
;
}
}
}
}
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
produceId
);
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
);
if
(
dtoItem
.
getExclusive
().
equals
(
1
))
{
//会员券
if
(
dtoItem
.
getExclusive
().
equals
(
1
))
{
//会员券
memberCoupon
.
add
(
baseVo
);
memberCoupon
.
add
(
baseVo
);
}
else
{
//非会员券
}
else
{
//非会员券
...
@@ -160,12 +160,12 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
...
@@ -160,12 +160,12 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
}
@Override
@Override
public
Integer
preCanUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
,
String
produceId
)
{
public
Integer
preCanUseGoodCoupon
(
BigDecimal
priceTotal
,
String
goodId
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
String
uid
=
CurrentUtil
.
getCurrentUid
();
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
);
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
);
int
canUse
=
0
;
int
canUse
=
0
;
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
produceId
);
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
);
if
(
baseVo
.
getState
().
equals
(
1
))
{
//可用
if
(
baseVo
.
getState
().
equals
(
1
))
{
//可用
canUse
=
1
;
canUse
=
1
;
break
;
break
;
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/util/CouponBaseUtil.java
View file @
49232118
...
@@ -12,6 +12,7 @@ import com.liquidnet.service.candy.vo.CandyCouponVo;
...
@@ -12,6 +12,7 @@ import com.liquidnet.service.candy.vo.CandyCouponVo;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
public
class
CouponBaseUtil
{
public
class
CouponBaseUtil
{
...
@@ -134,8 +135,7 @@ public class CouponBaseUtil {
...
@@ -134,8 +135,7 @@ public class CouponBaseUtil {
*/
*/
public
static
CandyCouponVo
getGoodCouponUserVo
(
CandyUserCouponBasicDto
dtoItem
,
public
static
CandyCouponVo
getGoodCouponUserVo
(
CandyUserCouponBasicDto
dtoItem
,
BigDecimal
priceTotal
,
BigDecimal
priceTotal
,
String
goodId
,
String
goodId
)
{
String
produceId
)
{
boolean
isTarget
=
false
;
boolean
isTarget
=
false
;
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
CandyCouponVo
vo
=
CandyCouponVo
.
getNew
();
CandyCouponVo
vo
=
CandyCouponVo
.
getNew
();
...
@@ -166,7 +166,7 @@ public class CouponBaseUtil {
...
@@ -166,7 +166,7 @@ public class CouponBaseUtil {
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
goodId
,
priceTotal
,
dtoItem
.
getValOver
());
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
goodId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
break
;
case
81
:
//款式
case
81
:
//款式
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
produceId
,
priceTotal
,
dtoItem
.
getValOver
());
//
isTarget = isTargetCoupon(ruleItem.getBusiId(), dtoItem.getCouType(), produceId, priceTotal, dtoItem.getValOver());
break
;
break
;
default
:
default
:
isTarget
=
false
;
isTarget
=
false
;
...
@@ -203,7 +203,8 @@ public class CouponBaseUtil {
...
@@ -203,7 +203,8 @@ public class CouponBaseUtil {
BigDecimal
priceTotal
,
BigDecimal
priceTotal
,
BigDecimal
valOver
)
{
BigDecimal
valOver
)
{
boolean
isTarget
=
false
;
boolean
isTarget
=
false
;
if
(
busiId
.
equals
(
targetId
))
{
//判断id 对应
ArrayList
<
String
>
targetIdList
=
new
ArrayList
(
Arrays
.
asList
(
targetId
.
split
(
","
)));
if
(
targetIdList
.
contains
(
busiId
))
{
//判断id 对应
if
(
couType
.
equals
(
2
))
{
if
(
couType
.
equals
(
2
))
{
if
(
priceTotal
.
compareTo
(
valOver
)
>=
0
)
{
if
(
priceTotal
.
compareTo
(
valOver
)
>=
0
)
{
isTarget
=
true
;
isTarget
=
true
;
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/KylinOrderTicketsServiceImpl.java
View file @
49232118
...
@@ -96,6 +96,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
...
@@ -96,6 +96,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if
(
payOrderParam
.
getVoucherType
()
!=
null
&&
payOrderParam
.
getVoucherType
().
equals
(
3
))
{
if
(
payOrderParam
.
getVoucherType
()
!=
null
&&
payOrderParam
.
getVoucherType
().
equals
(
3
))
{
isPay
=
false
;
isPay
=
false
;
}
}
HashMap
<
String
,
Object
>
advanceMap
=
null
;
try
{
try
{
KylinPerformanceVo
performanceData
=
dataUtils
.
getPerformanceVo
(
payOrderParam
.
getPerformanceId
());
KylinPerformanceVo
performanceData
=
dataUtils
.
getPerformanceVo
(
payOrderParam
.
getPerformanceId
());
KylinTicketTimesVo
ticketTimesData
=
null
;
KylinTicketTimesVo
ticketTimesData
=
null
;
...
@@ -176,7 +177,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
...
@@ -176,7 +177,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
//通用判断时间
//通用判断时间
HashMap
<
String
,
Object
>
advanceMap
=
null
;
if
(
payOrderParam
.
getAdvanceCode
()
!=
null
)
{
if
(
payOrderParam
.
getAdvanceCode
()
!=
null
)
{
advanceMap
=
orderUtils
.
useCoupon
(
payOrderParam
.
getAdvanceCode
(),
""
,
BigDecimal
.
ZERO
);
advanceMap
=
orderUtils
.
useCoupon
(
payOrderParam
.
getAdvanceCode
(),
""
,
BigDecimal
.
ZERO
);
Integer
typeVoucher
=
(
Integer
)
advanceMap
.
get
(
"type"
);
Integer
typeVoucher
=
(
Integer
)
advanceMap
.
get
(
"type"
);
...
@@ -216,7 +216,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
...
@@ -216,7 +216,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
// 判断库存
// 判断库存
int
surplusGeneral
=
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
-
payOrderParam
.
getNumber
());
int
surplusGeneral
=
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
-
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 正常 剩余库存 -> count:"
+
surplusGeneral
);
log
.
debug
(
"TAG_REDIS 正常 剩余库存 -> count:"
+
surplusGeneral
);
...
@@ -282,7 +281,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
...
@@ -282,7 +281,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
}
}
}
}
if
(
e
.
getMessage
().
equals
(
"券不可用"
)){
if
(
advanceMap
!=
null
)
{
orderUtils
.
backCoupon
(
advanceMap
.
get
(
"uCouponId"
).
toString
(),
uid
);
}
if
(
e
.
getMessage
().
equals
(
"券不可用"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20030"
));
//券不可用
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20030"
));
//券不可用
}
}
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20018"
));
//乱七八糟异常
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20018"
));
//乱七八糟异常
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/OrderUtils.java
View file @
49232118
package
com
.
liquidnet
.
service
.
order
.
utils
;
package
com
.
liquidnet
.
service
.
order
.
utils
;
import
brave.http.HttpRequest
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
...
@@ -10,12 +12,14 @@ import com.liquidnet.service.adam.constant.AdamRedisConst;
...
@@ -10,12 +12,14 @@ import com.liquidnet.service.adam.constant.AdamRedisConst;
import
com.liquidnet.service.adam.dto.vo.AdamAddressesVo
;
import
com.liquidnet.service.adam.dto.vo.AdamAddressesVo
;
import
com.liquidnet.service.adam.dto.vo.AdamEntersVo
;
import
com.liquidnet.service.adam.dto.vo.AdamEntersVo
;
import
com.liquidnet.service.adam.dto.vo.AdamUserMemberVo
;
import
com.liquidnet.service.adam.dto.vo.AdamUserMemberVo
;
import
com.liquidnet.service.candy.param.BackCouponParam
;
import
com.liquidnet.service.candy.vo.CandyUseResultVo
;
import
com.liquidnet.service.candy.vo.CandyUseResultVo
;
import
com.liquidnet.service.kylin.dto.param.SysDamaiParam
;
import
com.liquidnet.service.kylin.dto.param.SysDamaiParam
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.InnerReturnVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.InnerReturnVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.PayResultVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.PayResultVo
;
import
org.apache.http.client.methods.HttpRequestBase
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -176,16 +180,16 @@ public class OrderUtils {
...
@@ -176,16 +180,16 @@ public class OrderUtils {
* @param totalPrice 订单总价
* @param totalPrice 订单总价
* @return
* @return
*/
*/
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
)
{
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
)
{
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueMapStringString
();
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueMapStringString
();
params
.
add
(
"uCouponId"
,
uCouponId
);
params
.
add
(
"uCouponId"
,
uCouponId
);
params
.
add
(
"content"
,
content
);
params
.
add
(
"content"
,
content
);
params
.
add
(
"totalPrice"
,
totalPrice
.
toString
());
params
.
add
(
"totalPrice"
,
totalPrice
.
toString
());
MultiValueMap
<
String
,
String
>
header
=
CollectionUtil
.
linkedMultiValueMapStringString
();
MultiValueMap
<
String
,
String
>
header
=
CollectionUtil
.
linkedMultiValueMapStringString
();
header
.
add
(
"Authorization"
,
"Bearer "
+
CurrentUtil
.
getToken
());
header
.
add
(
"Authorization"
,
"Bearer "
+
CurrentUtil
.
getToken
());
String
returnData
=
HttpUtil
.
post
(
candyUrl
+
"/candy-coupon/use"
,
params
,
header
);
String
returnData
=
HttpUtil
.
post
(
candyUrl
+
"/candy-coupon/use"
,
params
,
header
);
InnerReturnVo
<
CandyUseResultVo
>
innerReturnVo
=
JsonUtils
.
fromJson
(
returnData
,
new
TypeReference
<
InnerReturnVo
<
CandyUseResultVo
>>()
{
InnerReturnVo
<
CandyUseResultVo
>
innerReturnVo
=
JsonUtils
.
fromJson
(
returnData
,
new
TypeReference
<
InnerReturnVo
<
CandyUseResultVo
>>()
{
});
});
CandyUseResultVo
candyUseResultVo
=
innerReturnVo
.
getData
();
CandyUseResultVo
candyUseResultVo
=
innerReturnVo
.
getData
();
...
@@ -212,12 +216,29 @@ public class OrderUtils {
...
@@ -212,12 +216,29 @@ public class OrderUtils {
voucher
=
BigDecimal
.
ZERO
;
voucher
=
BigDecimal
.
ZERO
;
break
;
break
;
}
}
HashMap
<
String
,
Object
>
hashMap
=
CollectionUtil
.
mapStringObject
();
HashMap
<
String
,
Object
>
hashMap
=
CollectionUtil
.
mapStringObject
();
hashMap
.
put
(
"type"
,
type
);
hashMap
.
put
(
"type"
,
type
);
hashMap
.
put
(
"voucher"
,
voucher
);
hashMap
.
put
(
"voucher"
,
voucher
);
return
hashMap
;
return
hashMap
;
}
}
public
void
backCoupon
(
String
uCouponId
,
String
uid
)
{
BackCouponParam
param
=
BackCouponParam
.
getNew
();
param
.
setuCouponIds
(
uCouponId
);
param
.
setUid
(
uid
);
MultiValueMap
<
String
,
String
>
header
=
CollectionUtil
.
linkedMultiValueMapStringString
();
header
.
add
(
"Authorization"
,
"Bearer "
+
CurrentUtil
.
getToken
());
ArrayList
<
BackCouponParam
>
params
=
new
ArrayList
();
params
.
add
(
param
);
String
jsonString
=
JSON
.
toJSONString
(
params
);
System
.
out
.
println
(
"jsonString = "
+
jsonString
);
String
returnData
=
HttpUtil
.
postRaw
(
"http://172.16.2.195:9009/candy"
+
"/candy-coupon/useBack"
,
jsonString
,
header
);
System
.
out
.
println
(
"returnData = "
+
returnData
);
}
/**
/**
* @param userId 用户id
* @param userId 用户id
* @param type 1新增 2修改
* @param type 1新增 2修改
...
...
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