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
70e49466
Commit
70e49466
authored
Oct 16, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提现
parent
513b1ce8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
49 deletions
+82
-49
BaseException.java
...thub/wxiaoqi/security/common/exception/BaseException.java
+1
-0
PlatformExceptionHandler.java
...oqi/security/common/handler/PlatformExceptionHandler.java
+2
-1
BaseResponse.java
.../com/github/wxiaoqi/security/common/msg/BaseResponse.java
+15
-0
MyWalletBiz.java
...va/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
+51
-44
ThirdFeign.java
...in/java/com/xxfc/platform/universal/feign/ThirdFeign.java
+1
-1
OrderPayController.java
...xfc/platform/universal/controller/OrderPayController.java
+12
-3
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/exception/BaseException.java
View file @
70e49466
...
...
@@ -38,6 +38,7 @@ public class BaseException extends RuntimeException {
public
BaseException
(
String
message
,
String
subCode
){
super
(
message
);
this
.
status
=
400
;
this
.
subCode
=
subCode
;
}
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/handler/PlatformExceptionHandler.java
View file @
70e49466
...
...
@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
...
...
@@ -16,7 +17,7 @@ public class PlatformExceptionHandler {
public
BaseResponse
baseExceptionHandler
(
Exception
e
)
{
if
(
e
instanceof
BaseException
){
BaseException
be
=
(
BaseException
)
e
;
return
new
BaseResponse
(
be
.
getStatus
(),
be
.
getMessage
());
return
new
BaseResponse
(
be
.
getStatus
(),
StringUtils
.
isEmpty
(
be
.
getSubCode
())?
"NAN"
:
be
.
getSubCode
(),
be
.
getMessage
());
}
return
new
BaseResponse
(
400
,
e
.
getMessage
());
}
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/msg/BaseResponse.java
View file @
70e49466
...
...
@@ -7,8 +7,15 @@ import com.github.wxiaoqi.security.common.constant.RestCode;
*/
public
class
BaseResponse
{
private
int
status
=
200
;
private
String
subCode
;
private
String
message
=
"SUCCESS"
;
public
BaseResponse
(
int
status
,
String
subCode
,
String
message
)
{
this
.
status
=
status
;
this
.
subCode
=
subCode
;
this
.
message
=
message
;
}
public
BaseResponse
(
int
status
,
String
message
)
{
this
.
status
=
status
;
this
.
message
=
message
;
...
...
@@ -33,6 +40,14 @@ public class BaseResponse {
this
.
status
=
status
;
}
public
void
setSubCode
(
String
subCode
)
{
this
.
subCode
=
subCode
;
}
public
String
getSubCode
()
{
return
subCode
;
}
public
BaseResponse
status
(
int
status
)
{
this
.
status
=
status
;
return
this
;
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
View file @
70e49466
...
...
@@ -92,8 +92,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
private
DateTimeFormatter
dateTimeFormatter
;
private
static
final
Integer
WITHDRAW_ONLINE_WAY
=
1
;
private
static
final
Integer
WITHDRAW_OFFLINE_WAY
=
2
;
private
static
final
Integer
WITHDRAW_ONLINE_WAY
=
1
;
private
static
final
Integer
WITHDRAW_OFFLINE_WAY
=
2
;
private
static
final
Integer
SUCCESS
=
200
;
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
...
...
@@ -318,10 +319,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
}
log
.
info
(
"-----提现申请-----proceduReates==="
+
sumDto
.
getProceduReates
()
+
"----commission===="
+
commission
+
"---realAmount==="
+
realAmount
);
ObjectRestResponse
<
String
>
response
=
null
;
//线上自动提现
if
(
WITHDRAW_ONLINE_WAY
.
equals
(
withdrawWay
)){
String
pay_no
;
if
(
WITHDRAW_ONLINE_WAY
.
equals
(
withdrawWay
))
{
String
cono
=
OrderUtil
.
GetOrderNumber
(
""
);
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
host
=
StringUtils
.
defaultIfBlank
(
request
.
getHeader
(
"userHost"
),
ClientUtil
.
getClientIp
(
request
));
...
...
@@ -334,16 +334,15 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
.
type
(
applyCathVo
.
getCathType
())
.
creatIp
(
host
)
.
build
();
try
{
//商户订单号
pay_no
=
thirdFeign
.
transferAccount
(
fundPayVo
);
response
=
thirdFeign
.
transferAccount
(
fundPayVo
);
if
(
response
.
getStatus
()
==
SUCCESS
)
{
walletCath
.
setStauts
(
1
);
walletCath
.
setCono
(
pay_no
);
walletCath
.
setCono
(
String
.
valueOf
(
response
.
getData
())
);
walletCath
.
setFinishTime
(
Instant
.
now
().
toEpochMilli
());
}
catch
(
BaseException
baex
){
throw
new
BaseException
(
baex
.
getMessage
(),
400
);
}
catch
(
Exception
ex
){
throw
new
BaseException
((
applyCathVo
.
getCathType
()
==
0
?
"微信提现"
:
applyCathVo
.
getCathType
()
==
1
?
"支付宝提现"
:
"银行提现"
)+
"转账失败"
,
ex
);
}
else
{
walletCath
.
setStauts
(
2
);
walletCath
.
setReason
(
response
.
getMessage
());
}
}
//提现单号
...
...
@@ -359,8 +358,12 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletCath
.
setCommission
(
commission
);
walletCath
.
setRealAmount
(
realAmount
);
myWalletCathBiz
.
insertSelective
(
walletCath
);
//提现金额
BigDecimal
withdrawals
=
new
BigDecimal
(
0
);
if
(
response
!=
null
&&
response
.
getStatus
()
==
SUCCESS
)
{
//提现金额
BigDecimal
withdrawals
=
realAmount
.
add
(
commission
);
withdrawals
=
realAmount
.
add
(
commission
);
balnece
=
balnece
.
subtract
(
withdrawals
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
log
.
info
(
"------钱包----withdrawals==="
+
withdrawals
+
"----balnece===="
+
balnece
);
MyWallet
myWallet
=
new
MyWallet
();
...
...
@@ -370,8 +373,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
myWallet
.
setWithdrawals
(
withdrawals
);
myWallet
.
setVersion
(
sumDto
.
getVersion
());
mapper
.
updMyWater
(
myWallet
);
}
//线上提现
if
(
WITHDRAW_ONLINE_WAY
.
equals
(
applyCathVo
.
getCathType
())
)
{
if
(
WITHDRAW_ONLINE_WAY
.
equals
(
applyCathVo
.
getCathType
())
&&
response
!=
null
&&
response
.
getStatus
()
==
SUCCESS
)
{
MyWalletDetail
detail
=
new
MyWalletDetail
();
detail
.
setUserId
(
userId
);
detail
.
setItype
(
1
);
...
...
@@ -414,8 +419,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
BigDecimal
balance
=
cath
.
getBalance
();
BigDecimal
realAmount
=
cath
.
getRealAmount
();
BigDecimal
commission
=
cath
.
getCommission
();
ObjectRestResponse
<
String
>
response
=
null
;
if
(
status
==
1
)
{
String
cono
=
StringUtil
.
isEmpty
(
cath
.
getCono
())
?
OrderUtil
.
GetOrderNumber
(
""
)
:
cath
.
getCono
();
String
cono
=
StringUtil
.
isEmpty
(
cath
.
getCono
())
?
OrderUtil
.
GetOrderNumber
(
""
)
:
cath
.
getCono
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
host
=
StringUtils
.
defaultIfBlank
(
request
.
getHeader
(
"userHost"
),
ClientUtil
.
getClientIp
(
request
));
FundPayVo
fundPayVo
=
FundPayVo
.
builder
()
...
...
@@ -427,24 +433,25 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
.
type
(
cath
.
getCathType
())
.
creatIp
(
host
)
.
build
();
try
{
cono
=
thirdFeign
.
transferAccount
(
fundPayVo
);
}
catch
(
BaseException
bex
)
{
if
(
PaySubErrorCodeEnum
.
PAY_NEED_ERROR
.
getSubCode
().
equals
(
bex
.
getSubCode
()))
{
response
=
thirdFeign
.
transferAccount
(
fundPayVo
);
if
(
response
.
getStatus
()
!=
SUCCESS
)
{
if
(
PaySubErrorCodeEnum
.
PAY_NEED_ERROR
.
getSubCode
().
equals
(
response
.
getSubCode
()))
{
isContinuePay
=
true
;
errorMsg
=
bex
.
getMessage
();
errorMsg
=
response
.
getMessage
();
cath
.
setCono
(
cono
);
}
else
{
throw
new
BaseException
(
bex
.
getMessage
(),
400
);
}
}
catch
(
Exception
ex
)
{
throw
new
BaseException
(
ex
);
return
ObjectRestResponse
.
createFailedResult
(
400
,
response
.
getMessage
());
}
}
else
{
cath
.
setStauts
(
isContinuePay
?
0
:
status
);
//设置第三方单号
cath
.
setCono
(
cono
);
cath
.
setCono
(
response
.
getData
()
);
cath
.
setFinishTime
(
System
.
currentTimeMillis
());
myWalletCathBiz
.
updateSelectiveByIdRe
(
cath
);
}
if
(
SUCCESS
==
response
.
getStatus
()
||
isContinuePay
)
{
myWalletCathBiz
.
updateSelectiveByIdRe
(
cath
);
}
MyWalletDetail
detail
=
new
MyWalletDetail
();
detail
.
setUserId
(
userId
);
detail
.
setItype
(
1
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/ThirdFeign.java
View file @
70e49466
...
...
@@ -82,7 +82,7 @@ public interface ThirdFeign {
/*************************************支付***************************************/
@PostMapping
(
"/pay/app/unauth/transfer_account"
)
String
transferAccount
(
@RequestBody
FundPayVo
fundPayVo
)
throws
Exception
;
ObjectRestResponse
<
String
>
transferAccount
(
@RequestBody
FundPayVo
fundPayVo
)
;
@GetMapping
(
"/info/app/unauth/getAliPayUserInfo"
)
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/OrderPayController.java
View file @
70e49466
...
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.universal.biz.OrderPayBiz
;
import
com.xxfc.platform.universal.entity.OrderPay
;
...
...
@@ -11,6 +12,7 @@ import com.xxfc.platform.universal.weixin.util.XMLUtil;
import
lombok.extern.slf4j.Slf4j
;
import
org.jdom.JDOMException
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -91,9 +93,10 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
}
out
.
print
(
"<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[]]></return_msg></xml>"
);
}
else
}
else
{
out
.
print
(
"<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[]]></return_msg></xml>"
);
}
}
@PostMapping
(
value
=
"/app/unauth/notify/alipay"
)
...
...
@@ -105,8 +108,14 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
@PostMapping
(
"/app/unauth/transfer_account"
)
@IgnoreUserToken
public
String
transferAccount
(
@RequestBody
FundPayVo
fundPayVo
)
throws
Exception
{
return
baseBiz
.
fundTrans
(
fundPayVo
);
public
ObjectRestResponse
<
String
>
transferAccount
(
@RequestBody
FundPayVo
fundPayVo
){
try
{
String
pay_no
=
baseBiz
.
fundTrans
(
fundPayVo
);
return
ObjectRestResponse
.
succ
(
pay_no
);
}
catch
(
Exception
ex
){
return
ObjectRestResponse
.
createFailedResult
(
400
,
ex
.
getMessage
());
}
}
...
...
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