Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
cae2339f
Commit
cae2339f
authored
Jul 29, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
1c265729
6dd122ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
45 deletions
+56
-45
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+3
-3
BaseOrderMapper.xml
...rder-server/src/main/resources/mapper/BaseOrderMapper.xml
+6
-6
OrderPayVo.java
.../main/java/com/xxfc/platform/universal/vo/OrderPayVo.java
+5
-0
OrderPayBiz.java
...ain/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
+29
-31
OrderPayController.java
...xfc/platform/universal/controller/OrderPayController.java
+13
-5
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
cae2339f
...
@@ -146,7 +146,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -146,7 +146,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
if
(
orderPageVo
.
getStatus
()
==
4
)
{
//未交车
if
(
orderPageVo
.
getStatus
()
==
4
)
{
//未交车
List
<
VehicleUserLicense
>
vehicleUserLicenses
=
Lists
.
newArrayList
();
List
<
VehicleUserLicense
>
vehicleUserLicenses
=
Lists
.
newArrayList
();
boolean
flag
=
getTodyTime
(
orderPageVo
.
getOrderRentVehicleDetail
().
getStartTime
());
boolean
flag
=
getTod
a
yTime
(
orderPageVo
.
getOrderRentVehicleDetail
().
getStartTime
());
if
(!
flag
)
{
if
(!
flag
)
{
return
ObjectRestResponse
.
createFailedResult
(
3501
,
"今日不是交车日期"
);
return
ObjectRestResponse
.
createFailedResult
(
3501
,
"今日不是交车日期"
);
}
}
...
@@ -589,9 +589,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -589,9 +589,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
// }
// }
// }
// }
public
boolean
getTodyTime
(
Long
time
)
{
public
boolean
getTod
a
yTime
(
Long
time
)
{
Long
startTime
=
getDayStart
();
Long
startTime
=
getDayStart
();
if
(
time
>
startTime
&&
time
<
startTime
+
24
*
60
*
60
*
1000
-
1
)
{
if
(
time
>
=
startTime
&&
time
<=
startTime
+
24
*
60
*
60
*
1000
-
1
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
xx-order/xx-order-server/src/main/resources/mapper/BaseOrderMapper.xml
View file @
cae2339f
...
@@ -135,16 +135,16 @@
...
@@ -135,16 +135,16 @@
and b.name like CONCAT ("%", #{name}, "%")
and b.name like CONCAT ("%", #{name}, "%")
</if>
</if>
<if
test=
"startTime != null"
>
<if
test=
"startTime != null"
>
and r.start_time between #{startTime} and #{endTime}
and
(
r.start_time between #{startTime} and #{endTime}
or t.start_time between #{startTime} and #{endTime}
or t.start_time between #{startTime} and #{endTime}
)
</if>
</if>
<if
test=
"startCompanyId != null"
>
<if
test=
"startCompanyId != null"
>
and r.start_company_id = #{startCompanyId}
and
(
r.start_company_id = #{startCompanyId}
or t.start_company_id = #{startCompanyId}
or t.start_company_id = #{startCompanyId}
)
</if>
</if>
<if
test=
"startZoneId != null"
>
<if
test=
"startZoneId != null"
>
and r.start_zone_id = #{startZoneId}
and
(
r.start_zone_id = #{startZoneId}
or t.start_zone_id = #{startZoneId}
or t.start_zone_id = #{startZoneId}
)
</if>
</if>
</where>
</where>
order by b.crt_time desc
order by b.crt_time desc
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/OrderPayVo.java
View file @
cae2339f
...
@@ -64,5 +64,10 @@ public class OrderPayVo{
...
@@ -64,5 +64,10 @@ public class OrderPayVo{
@ApiModelProperty
(
value
=
"买家第三方付款账号"
)
@ApiModelProperty
(
value
=
"买家第三方付款账号"
)
private
String
buyerAccount
;
private
String
buyerAccount
;
//第三方支付请求订单号
@ApiModelProperty
(
value
=
"第三方支付请求订单号"
)
private
String
tradeNo
;
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
View file @
cae2339f
...
@@ -80,6 +80,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -80,6 +80,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"订单不能为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"订单不能为空"
);
}
}
String
trade_no
=
OrderUtil
.
GetOrderNumber
(
""
);
String
trade_no
=
OrderUtil
.
GetOrderNumber
(
""
);
orderPayVo
.
setTradeNo
(
trade_no
);
String
order_no
=
orderPayVo
.
getOrderNo
();
String
order_no
=
orderPayVo
.
getOrderNo
();
Integer
amount
=
orderPayVo
.
getAmount
();
Integer
amount
=
orderPayVo
.
getAmount
();
log
.
error
(
"---下单---order_no====="
+
order_no
+
"--支付订单号--trade_no===="
+
trade_no
+
"--金额---amount===="
+
amount
);
log
.
error
(
"---下单---order_no====="
+
order_no
+
"--支付订单号--trade_no===="
+
trade_no
+
"--金额---amount===="
+
amount
);
...
@@ -92,14 +93,21 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -92,14 +93,21 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
if
(
amount
<=
0
)
{
if
(
amount
<=
0
)
{
amount
=
1
;
amount
=
1
;
}
}
Integer
type
=
orderPayVo
.
getType
();
Integer
type
=
orderPayVo
.
getType
()
==
null
?
1
:
orderPayVo
.
getType
()
;
String
jsParam
=
""
;
String
jsParam
=
""
;
String
notify_url
=
weixinHost
+
"/api/universal/pay/app/unauth/notify"
;
String
notify_url
=
weixinHost
+
"/api/universal/pay/app/unauth/notify"
;
log
.
info
(
"报名费回调路径notify_url:"
+
notify_url
);
log
.
info
(
"报名费回调路径notify_url:"
+
notify_url
);
if
(
type
!=
null
&&
type
==
2
){
Integer
payWay
=
orderPayVo
.
getPayWay
()==
null
?
1
:
orderPayVo
.
getPayWay
();
String
sellerAccount
=
null
;
if
(
type
==
2
&&
payWay
==
1
){
sellerAccount
=
SystemConfig
.
APP_PARTNER
;
jsParam
=
WXPay
.
webPay
(
amount
+
""
,
orderPayVo
.
getBody
(),
notify_url
,
trade_no
,
orderPayVo
.
getBuyerIp
(),
orderPayVo
.
getBuyerAccount
());
jsParam
=
WXPay
.
webPay
(
amount
+
""
,
orderPayVo
.
getBody
(),
notify_url
,
trade_no
,
orderPayVo
.
getBuyerIp
(),
orderPayVo
.
getBuyerAccount
());
}
else
{
}
else
if
(
type
==
1
&&
payWay
==
1
){
sellerAccount
=
SystemConfig
.
APP_PARTNER
;
jsParam
=
WXPay
.
apppay
(
amount
+
""
,
orderPayVo
.
getBody
(),
notify_url
,
trade_no
,
orderPayVo
.
getBuyerIp
(),
0
);
jsParam
=
WXPay
.
apppay
(
amount
+
""
,
orderPayVo
.
getBody
(),
notify_url
,
trade_no
,
orderPayVo
.
getBuyerIp
(),
0
);
}
else
if
(
type
==
1
&&
payWay
==
2
){
sellerAccount
=
SystemConfig
.
ALIPAY_PID
;
jsParam
=
generateAliPayment
(
orderPayVo
);
}
}
log
.
info
(
"报名费回调路径jsParam:"
+
jsParam
);
log
.
info
(
"报名费回调路径jsParam:"
+
jsParam
);
if
(!
StringUtils
.
isBlank
(
jsParam
))
if
(!
StringUtils
.
isBlank
(
jsParam
))
...
@@ -107,8 +115,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -107,8 +115,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
try
{
try
{
OrderPay
orderPay
=
new
OrderPay
();
OrderPay
orderPay
=
new
OrderPay
();
BeanUtils
.
copyProperties
(
orderPay
,
orderPayVo
);
BeanUtils
.
copyProperties
(
orderPay
,
orderPayVo
);
orderPay
.
setTradeNo
(
trade_no
);
orderPay
.
setSellerAccount
(
sellerAccount
);
orderPay
.
setSellerAccount
(
SystemConfig
.
APP_PARTNER
);
insertSelective
(
orderPay
);
insertSelective
(
orderPay
);
log
.
error
(
"---下单---order_no====="
+
order_no
+
"----成功"
);
log
.
error
(
"---下单---order_no====="
+
order_no
+
"----成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -116,8 +123,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -116,8 +123,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
log
.
error
(
"---下单---order_no====="
+
order_no
+
"----异常---msg==="
+
e
.
getMessage
());
log
.
error
(
"---下单---order_no====="
+
order_no
+
"----异常---msg==="
+
e
.
getMessage
());
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXCEPTION_CODE
,
"出现异常"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXCEPTION_CODE
,
"出现异常"
);
}
}
JSONObject
temp
=
JSON
.
parseObject
(
jsParam
);
if
(
payWay
==
1
){
return
JsonResultUtil
.
createSuccessResultWithObj
(
temp
);
JSONObject
temp
=
JSON
.
parseObject
(
jsParam
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
temp
);
}
else
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
jsParam
);
}
}
else
{
}
else
{
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
}
}
...
@@ -246,6 +257,10 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -246,6 +257,10 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
// Map<String, Object> sendMap = DataUtils.objectToMap(paymentRecord);
// Map<String, Object> sendMap = DataUtils.objectToMap(paymentRecord);
// sendMap.put("amount", new BigDecimal(rsAmount).multiply(new BigDecimal(100)).intValue());
// sendMap.put("amount", new BigDecimal(rsAmount).multiply(new BigDecimal(100)).intValue());
// sendMsgToOrder(JSONObject.toJSONString(sendMap));
// sendMsgToOrder(JSONObject.toJSONString(sendMap));
String
tradeNo
=
params
.
get
(
"out_order_no"
);
String
operationId
=
params
.
get
(
"operation_id"
);
notice
(
tradeNo
,
operationId
);
return
ObjectRestResponse
.
succ
().
getMessage
();
return
ObjectRestResponse
.
succ
().
getMessage
();
}
catch
(
AlipayApiException
e
)
{
}
catch
(
AlipayApiException
e
)
{
log
.
error
(
""
,
e
);
log
.
error
(
""
,
e
);
...
@@ -258,7 +273,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -258,7 +273,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
* @return
* @return
*/
*/
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
private
ObjectRestResponse
generateAliPayment
(
OrderPayVo
orderPayVo
)
{
private
String
generateAliPayment
(
OrderPayVo
orderPayVo
)
{
String
notifyUrl
=
weixinHost
+
"/service/payment/notify/alipay"
;
String
notifyUrl
=
weixinHost
+
"/service/payment/notify/alipay"
;
...
@@ -275,7 +290,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -275,7 +290,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
//
//
return
ObjectRestResponse
.
createDefaultFail
()
;
return
null
;
}
}
//支付宝APP支付方法
//支付宝APP支付方法
...
@@ -309,13 +324,13 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -309,13 +324,13 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
//预授权冻结
//预授权冻结
public
ObjectRestResponse
fundAuthOrderAppFreeze
(
AlipayClient
alipayClient
,
OrderPayVo
orderPayVo
)
throws
AlipayApiException
{
public
String
fundAuthOrderAppFreeze
(
AlipayClient
alipayClient
,
OrderPayVo
orderPayVo
)
throws
AlipayApiException
{
AlipayFundAuthOrderAppFreezeRequest
request
=
new
AlipayFundAuthOrderAppFreezeRequest
();
AlipayFundAuthOrderAppFreezeRequest
request
=
new
AlipayFundAuthOrderAppFreezeRequest
();
AlipayFundAuthOrderAppFreezeModel
model
=
new
AlipayFundAuthOrderAppFreezeModel
();
AlipayFundAuthOrderAppFreezeModel
model
=
new
AlipayFundAuthOrderAppFreezeModel
();
BigDecimal
realAmount
=
new
BigDecimal
(
orderPayVo
.
getAmount
().
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
BigDecimal
realAmount
=
new
BigDecimal
(
orderPayVo
.
getAmount
().
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
model
.
setOrderTitle
(
orderPayVo
.
getSubject
());
model
.
setOrderTitle
(
orderPayVo
.
getSubject
());
model
.
setOutOrderNo
(
orderPayVo
.
get
Order
No
());
//替换为实际订单号
model
.
setOutOrderNo
(
orderPayVo
.
get
Trade
No
());
//替换为实际订单号
model
.
setOutRequestNo
(
orderPayVo
.
get
Order
No
());
//替换为实际请求单号,保证每次请求都是唯一的
model
.
setOutRequestNo
(
orderPayVo
.
get
Trade
No
());
//替换为实际请求单号,保证每次请求都是唯一的
model
.
setPayeeUserId
(
SystemConfig
.
APP_ID
);
//payee_user_id,Payee_logon_id不能同时为空
model
.
setPayeeUserId
(
SystemConfig
.
APP_ID
);
//payee_user_id,Payee_logon_id不能同时为空
model
.
setProductCode
(
"PRE_AUTH_ONLINE"
);
//PRE_AUTH_ONLINE为固定值,不要替换
model
.
setProductCode
(
"PRE_AUTH_ONLINE"
);
//PRE_AUTH_ONLINE为固定值,不要替换
model
.
setAmount
(
realAmount
.
toString
());
model
.
setAmount
(
realAmount
.
toString
());
...
@@ -329,10 +344,10 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -329,10 +344,10 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
if
(
response
.
isSuccess
()){
if
(
response
.
isSuccess
()){
log
.
info
(
"调用成功"
);
log
.
info
(
"调用成功"
);
log
.
info
(
"response: {}"
+
response
.
getBody
());
//签名后的参数,直接入参到
log
.
info
(
"response: {}"
+
response
.
getBody
());
//签名后的参数,直接入参到
return
ObjectRestResponse
.
succ
(
response
.
getBody
()
);
return
response
.
getBody
(
);
}
else
{
}
else
{
log
.
info
(
"调用失败"
);
log
.
info
(
"调用失败"
);
return
ObjectRestResponse
.
createDefaultFail
()
;
return
null
;
}
}
}
}
//解冻预授权
//解冻预授权
...
@@ -410,23 +425,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
...
@@ -410,23 +425,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
AlipayTradeRefundResponse
response
=
alipayClient
.
execute
(
request
);
AlipayTradeRefundResponse
response
=
alipayClient
.
execute
(
request
);
log
.
info
(
"response: {}"
+
response
.
getBody
());
log
.
info
(
"response: {}"
+
response
.
getBody
());
}
}
public
Object
generatePayment
(
OrderPayVo
orderPayVo
)
{
switch
(
orderPayVo
.
getType
())
{
case
1
:
//支付宝
ObjectRestResponse
objectRestResponse
=
generateAliPayment
(
orderPayVo
);
return
objectRestResponse
;
case
2
:
//微信
JSONObject
jsonObject
=
preparepay
(
orderPayVo
);
return
jsonObject
;
case
3
:
//银联
return
null
;
default
:
log
.
info
(
"不支持的付款类型,payType={}"
,
orderPayVo
.
getType
());
break
;
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/OrderPayController.java
View file @
cae2339f
...
@@ -36,6 +36,19 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
...
@@ -36,6 +36,19 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
}
}
/**
* APP支付
*
* @param orderPayVo
* @return
* @throws Exception
*/
@RequestMapping
(
value
=
"/app/unauth"
,
method
=
RequestMethod
.
POST
)
//匹配的是href中的download请求
public
JSONObject
app
(
@RequestBody
OrderPayVo
orderPayVo
)
{
return
baseBiz
.
preparepay
(
orderPayVo
);
}
/**
/**
* 支付回调
* 支付回调
*
*
...
@@ -88,10 +101,5 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
...
@@ -88,10 +101,5 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return
baseBiz
.
alipayNotify
();
return
baseBiz
.
alipayNotify
();
}
}
@GetMapping
(
value
=
"/app/generate_payment"
)
public
Object
generatePayment
(
OrderPayVo
orderPayVo
)
{
Object
resp
=
baseBiz
.
generatePayment
(
orderPayVo
);
return
resp
;
}
}
}
\ No newline at end of file
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