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
c69f7885
Commit
c69f7885
authored
Oct 18, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提现修改
parent
65b26cd0
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
574 additions
and
225 deletions
+574
-225
RabbitConstant.java
...wxiaoqi/security/common/config/rabbit/RabbitConstant.java
+2
-0
WithDrawStatusEnum.java
...b/wxiaoqi/security/admin/constant/WithDrawStatusEnum.java
+44
-0
WalletDetailListDTO.java
...ithub/wxiaoqi/security/admin/dto/WalletDetailListDTO.java
+4
-0
MyWalletCath.java
...om/github/wxiaoqi/security/admin/entity/MyWalletCath.java
+4
-0
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+6
-0
MyWalletBiz.java
...va/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
+91
-108
MyWalletCathBiz.java
...om/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
+9
-2
MyWaterBiz.java
...ava/com/github/wxiaoqi/security/admin/biz/MyWaterBiz.java
+0
-3
RabbitAdminConfig.java
...thub/wxiaoqi/security/admin/config/RabbitAdminConfig.java
+8
-4
MyWalletController.java
...ithub/wxiaoqi/security/admin/rest/MyWalletController.java
+64
-55
AliNeedPayErrorEnum.java
...xxfc/platform/universal/constant/AliNeedPayErrorEnum.java
+1
-1
AliPayErrorEnum.java
...com/xxfc/platform/universal/constant/AliPayErrorEnum.java
+47
-0
PaySubErrorCodeEnum.java
...xxfc/platform/universal/constant/PaySubErrorCodeEnum.java
+1
-1
PayWay.java
...ain/java/com/xxfc/platform/universal/constant/PayWay.java
+46
-0
WxNeedPayErrorEnum.java
.../xxfc/platform/universal/constant/WxNeedPayErrorEnum.java
+1
-1
WxPayErrorEnum.java
.../com/xxfc/platform/universal/constant/WxPayErrorEnum.java
+34
-0
WxResponseProperties.java
...xfc/platform/universal/constant/WxResponseProperties.java
+1
-1
FundPayVo.java
...c/main/java/com/xxfc/platform/universal/vo/FundPayVo.java
+6
-2
WXSuppToUserPay.java
...m/xxfc/platform/universal/weixin/api/WXSuppToUserPay.java
+11
-4
OrderPayBiz.java
...ain/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
+19
-43
RabbitUniversalConfig.java
...xxfc/platform/universal/config/RabbitUniversalConfig.java
+33
-0
WithDrawMqHandler.java
...om/xxfc/platform/universal/handler/WithDrawMqHandler.java
+142
-0
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/config/rabbit/RabbitConstant.java
View file @
c69f7885
...
@@ -32,6 +32,8 @@ public class RabbitConstant {
...
@@ -32,6 +32,8 @@ public class RabbitConstant {
//钱包
//钱包
public
static
final
String
KEY_WALLET_ADD
=
"wallet.add"
;
public
static
final
String
KEY_WALLET_ADD
=
"wallet.add"
;
public
static
final
String
KEY_WALLET_WITH_DRAW
=
"wallet.withdraw"
;
static
{
static
{
exchangeTopicSet
=
new
HashSet
<
String
>()
{{
exchangeTopicSet
=
new
HashSet
<
String
>()
{{
add
(
ADMIN_TOPIC
);
add
(
ADMIN_TOPIC
);
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/constant/WithDrawStatusEnum.java
0 → 100644
View file @
c69f7885
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
constant
;
/**
* @author libin
* @version 1.0
* @description 提现状态
* @data 2019/10/18 12:30
*/
public
enum
WithDrawStatusEnum
{
/**
* 提现审核中
*/
AUDIT
(
0
),
/**
* 提现成功
*/
SUCCESS
(
1
),
/**
* 提现失败
*/
FAIL
(
2
),
/**
* 提现审核同意
*/
AGREE
(
1
),
/**
* 提现审核拒绝
*/
REJECT
(
2
);
private
int
code
;
WithDrawStatusEnum
(
int
code
)
{
this
.
code
=
code
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/WalletDetailListDTO.java
View file @
c69f7885
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -12,6 +14,8 @@ import java.math.BigDecimal;
...
@@ -12,6 +14,8 @@ import java.math.BigDecimal;
* @data 2019/7/18 9:50
* @data 2019/7/18 9:50
*/
*/
@Data
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
WalletDetailListDTO
{
public
class
WalletDetailListDTO
{
private
Integer
id
;
private
Integer
id
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/MyWalletCath.java
View file @
c69f7885
...
@@ -5,7 +5,9 @@ import java.math.BigDecimal;
...
@@ -5,7 +5,9 @@ import java.math.BigDecimal;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
/**
...
@@ -16,6 +18,8 @@ import lombok.Data;
...
@@ -16,6 +18,8 @@ import lombok.Data;
* @date 2019-07-11 14:14:54
* @date 2019-07-11 14:14:54
*/
*/
@Data
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"my_wallet_cath"
)
@Table
(
name
=
"my_wallet_cath"
)
public
class
MyWalletCath
implements
Serializable
{
public
class
MyWalletCath
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
c69f7885
...
@@ -129,4 +129,10 @@ public interface UserFeign {
...
@@ -129,4 +129,10 @@ public interface UserFeign {
@GetMapping
(
"/app/user/finduserIdsByphones"
)
@GetMapping
(
"/app/user/finduserIdsByphones"
)
Map
<
String
,
Integer
>
findAppusersByUserNames
(
@RequestParam
(
value
=
"phones"
)
List
<
String
>
phones
);
Map
<
String
,
Integer
>
findAppusersByUserNames
(
@RequestParam
(
value
=
"phones"
)
List
<
String
>
phones
);
@GetMapping
(
"/wallet/withdraw_do"
)
public
ObjectRestResponse
<
Void
>
withDrawprocess
(
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
,
@RequestParam
(
value
=
"cono"
,
required
=
false
)
String
cono
,
@RequestParam
(
value
=
"reason"
,
required
=
false
)
String
reason
,
@RequestParam
(
value
=
"isSuccess"
)
Boolean
isSuccess
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
View file @
c69f7885
This diff is collapsed.
Click to expand it.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
View file @
c69f7885
...
@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
...
@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import
com.github.wxiaoqi.security.admin.vo.WalletCathVo
;
import
com.github.wxiaoqi.security.admin.vo.WalletCathVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.universal.constant.PayWay
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -64,11 +65,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
...
@@ -64,11 +65,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
BeanUtils
.
copyProperties
(
walletCath
,
walletCathVo
);
BeanUtils
.
copyProperties
(
walletCath
,
walletCathVo
);
totalWithdraw
=
totalWithdraw
.
add
(
walletCathVo
.
getAmount
());
totalWithdraw
=
totalWithdraw
.
add
(
walletCathVo
.
getAmount
());
//微信
//微信
if
(
walletCath
.
getCathType
()==
0
){
if
(
walletCath
.
getCathType
()==
PayWay
.
WX_PAY
.
getCode
()
){
walletCathVo
.
setAccountNumberDesc
(
String
.
format
(
"%s%s%s"
,
"提现到微信("
,
walletCath
.
getAccountName
(),
")"
));
walletCathVo
.
setAccountNumberDesc
(
String
.
format
(
"%s%s%s"
,
"提现到微信("
,
walletCath
.
getAccountName
(),
")"
));
}
}
//支付宝
//支付宝
if
(
walletCath
.
getCathType
()==
1
){
if
(
walletCath
.
getCathType
()==
PayWay
.
ALI_PAY
.
getCode
()
){
walletCathVo
.
setAccountNumberDesc
(
String
.
format
(
"%s%s%s"
,
"提现到支付宝("
,
walletCath
.
getAccountName
(),
")"
));
walletCathVo
.
setAccountNumberDesc
(
String
.
format
(
"%s%s%s"
,
"提现到支付宝("
,
walletCath
.
getAccountName
(),
")"
));
}
}
walletCatchPageVos
.
add
(
walletCathVo
);
walletCatchPageVos
.
add
(
walletCathVo
);
...
@@ -147,4 +148,10 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
...
@@ -147,4 +148,10 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
public
void
insertSelective
(
MyWalletCath
entity
)
{
public
void
insertSelective
(
MyWalletCath
entity
)
{
mapper
.
insertSelective
(
entity
);
mapper
.
insertSelective
(
entity
);
}
}
public
MyWalletCath
findWalletCatchByOrderNo
(
String
orderNo
)
{
MyWalletCath
myWalletCath
=
new
MyWalletCath
();
myWalletCath
.
setOrderNo
(
orderNo
);
return
mapper
.
selectOne
(
myWalletCath
);
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWaterBiz.java
View file @
c69f7885
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
cn.hutool.core.date.DateTime
;
import
com.github.wxiaoqi.security.admin.dto.UserInfoDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserInfoDTO
;
import
com.github.wxiaoqi.security.admin.entity.MyWallet
;
import
com.github.wxiaoqi.security.admin.entity.MyWallet
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletDetail
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletDetail
;
import
com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper
;
import
com.github.wxiaoqi.security.admin.mapper.MyWalletMapper
;
import
com.github.wxiaoqi.security.admin.mapper.MyWalletMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
...
@@ -18,7 +16,6 @@ import org.springframework.transaction.annotation.Propagation;
...
@@ -18,7 +16,6 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/config/RabbitAdminConfig.java
View file @
c69f7885
...
@@ -7,9 +7,11 @@ import org.springframework.context.annotation.Configuration;
...
@@ -7,9 +7,11 @@ import org.springframework.context.annotation.Configuration;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.*;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.*;
/**
/**
* rabbitmq配置类
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
* 包含: 不知道什么orderWater队列
*
* @author zhoujw
* @author zhoujw
* @date 2019/7/15
* @date 2019/7/15
*/
*/
...
@@ -20,21 +22,23 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
...
@@ -20,21 +22,23 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
public
static
final
String
ORDER_FINLISH_USER_RE_QUEUE
=
"order.cancel.userRe.queue"
;
public
static
final
String
ORDER_FINLISH_USER_RE_QUEUE
=
"order.cancel.userRe.queue"
;
//钱包50入账
//钱包50入账
public
static
final
String
WALLET_ADD_QUEUE
=
"wallet.add.queue"
;
public
static
final
String
WALLET_ADD_QUEUE
=
"wallet.add.queue"
;
//支付完成后永久绑定关系
//支付完成后永久绑定关系
public
static
final
String
ORDER_RELATION_QUEUE
=
"order.relation.queue"
;
public
static
final
String
ORDER_RELATION_QUEUE
=
"order.relation.queue"
;
static
{
static
{
myQueue
=
new
ArrayList
<
BindDTO
>()
{{
myQueue
=
new
ArrayList
<
BindDTO
>()
{{
//支付完成后永久绑定关系
//支付完成后永久绑定关系
add
(
new
BindDTO
(
ORDER_RELATION_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_PAY
));
add
(
new
BindDTO
(
ORDER_RELATION_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_PAY
));
//拥金计算
//拥金计算
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_PAY
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_PAY
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_CANCEL
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_CANCEL
));
add
(
new
BindDTO
(
ORDER_FINLISH_USER_RE_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
add
(
new
BindDTO
(
ORDER_FINLISH_USER_RE_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
//钱包
//钱包
add
(
new
BindDTO
(
WALLET_ADD_QUEUE
,
ADMIN_TOPIC
,
KEY_WALLET_ADD
));
add
(
new
BindDTO
(
WALLET_ADD_QUEUE
,
ADMIN_TOPIC
,
KEY_WALLET_ADD
));
}};
}};
}
}
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/MyWalletController.java
View file @
c69f7885
...
@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...
@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
...
@@ -41,101 +42,109 @@ public class MyWalletController {
...
@@ -41,101 +42,109 @@ public class MyWalletController {
private
AppUserAlipayBiz
alipayBiz
;
private
AppUserAlipayBiz
alipayBiz
;
@GetMapping
@GetMapping
public
ObjectRestResponse
<
AppletWalletVo
>
findMyWallet
(
HttpServletRequest
request
){
public
ObjectRestResponse
<
AppletWalletVo
>
findMyWallet
(
HttpServletRequest
request
)
{
try
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
AppletWalletVo
wallet
=
myWalletBiz
.
findMyWallet
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
AppletWalletVo
wallet
=
myWalletBiz
.
findMyWallet
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
return
ObjectRestResponse
.
succ
(
wallet
);
return
ObjectRestResponse
.
succ
(
wallet
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@GetMapping
(
"/checkCode"
)
@GetMapping
(
"/checkCode"
)
@ApiOperation
(
"检查验证码"
)
@ApiOperation
(
"检查验证码"
)
public
ObjectRestResponse
checkCode
(
public
ObjectRestResponse
checkCode
(
@RequestParam
(
value
=
"phone"
,
defaultValue
=
""
)
String
phone
,
@RequestParam
(
value
=
"phone"
,
defaultValue
=
""
)
String
phone
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecod
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecod
)
{
)
{
return
myWalletBiz
.
checkCode
(
phone
,
mobilecod
);
return
myWalletBiz
.
checkCode
(
phone
,
mobilecod
);
}
}
@PostMapping
(
"/setPwd"
)
@PostMapping
(
"/setPwd"
)
@ApiOperation
(
"设置密码"
)
@ApiOperation
(
"设置密码"
)
public
ObjectRestResponse
setPwd
(
public
ObjectRestResponse
setPwd
(
@RequestParam
(
value
=
"phone"
,
defaultValue
=
""
)
String
phone
,
@RequestParam
(
value
=
"phone"
,
defaultValue
=
""
)
String
phone
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecod
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecod
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
,
HttpServletRequest
request
){
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
return
myWalletBiz
.
setPwd
(
userId
,
phone
,
mobilecod
,
password
,
type
);
return
myWalletBiz
.
setPwd
(
userId
,
phone
,
mobilecod
,
password
,
type
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@GetMapping
(
"/checkSetPwd"
)
@GetMapping
(
"/checkSetPwd"
)
@ApiOperation
(
"检查用户是否设置过支付密码"
)
@ApiOperation
(
"检查用户是否设置过支付密码"
)
public
ObjectRestResponse
checkSetPwd
(
HttpServletRequest
request
)
{
public
ObjectRestResponse
checkSetPwd
(
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
return
myWalletBiz
.
checkSetPwd
(
userId
);
return
myWalletBiz
.
checkSetPwd
(
userId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@GetMapping
(
"/checkAmount"
)
@GetMapping
(
"/checkAmount"
)
@ApiOperation
(
"检查提成下一步操作"
)
@ApiOperation
(
"检查提成下一步操作"
)
public
ObjectRestResponse
checkAmount
(
public
ObjectRestResponse
checkAmount
(
@RequestParam
(
value
=
"amount"
,
defaultValue
=
"0.00"
)
BigDecimal
amount
,
@RequestParam
(
value
=
"amount"
,
defaultValue
=
"0.00"
)
BigDecimal
amount
,
HttpServletRequest
request
){
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
return
myWalletBiz
.
checkAmount
(
userId
,
amount
,
null
);
return
myWalletBiz
.
checkAmount
(
userId
,
amount
,
null
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@PostMapping
(
"/applyCath"
)
@PostMapping
(
"/applyCath"
)
@ApiOperation
(
"提现申请"
)
@ApiOperation
(
"提现申请"
)
public
ObjectRestResponse
applyCath
(
@RequestBody
ApplyCathVo
applyCathVo
,
HttpServletRequest
request
)
{
public
ObjectRestResponse
applyCath
(
@RequestBody
ApplyCathVo
applyCathVo
,
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
applyCathVo
.
setUserId
(
userId
);
applyCathVo
.
setUserId
(
userId
);
return
myWalletBiz
.
applyCath
(
applyCathVo
);
return
myWalletBiz
.
applyCath
(
applyCathVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@GetMapping
(
"/txAlipayList"
)
@GetMapping
(
"/txAlipayList"
)
@ApiOperation
(
"获取支付账号列表"
)
@ApiOperation
(
"获取支付账号列表"
)
public
ObjectRestResponse
txAlipayList
(
HttpServletRequest
request
)
{
public
ObjectRestResponse
txAlipayList
(
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
return
ObjectRestResponse
.
succ
(
alipayBiz
.
getListByUserId
(
userId
))
;
return
ObjectRestResponse
.
succ
(
alipayBiz
.
getListByUserId
(
userId
))
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
}
}
@ApiOperation
(
"获取支付账号(微信|支付宝|银行卡)"
)
@ApiOperation
(
"获取支付账号(微信|支付宝|银行卡)"
)
@GetMapping
(
"/pay_account_list"
)
@GetMapping
(
"/pay_account_list"
)
public
ObjectRestResponse
listPayAccount
(
HttpServletRequest
request
){
public
ObjectRestResponse
listPayAccount
(
HttpServletRequest
request
)
{
try
{
try
{
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
Integer
userId
=
Integer
.
parseInt
(
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
());
List
<
PayAccountVo
>
payAccountVos
=
myWalletBiz
.
listPayAccountByUserId
(
userId
);
List
<
PayAccountVo
>
payAccountVos
=
myWalletBiz
.
listPayAccountByUserId
(
userId
);
return
ObjectRestResponse
.
succ
(
payAccountVos
);
return
ObjectRestResponse
.
succ
(
payAccountVos
);
}
catch
(
Exception
ex
){
}
catch
(
Exception
ex
)
{
throw
new
BaseException
(
ex
);
throw
new
BaseException
(
ex
);
}
}
}
@GetMapping
(
"/withdraw_do"
)
public
ObjectRestResponse
<
Void
>
withDrawprocess
(
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
,
@RequestParam
(
value
=
"cono"
,
required
=
false
)
String
cono
,
@RequestParam
(
value
=
"reason"
,
required
=
false
)
String
reason
,
@RequestParam
(
value
=
"isSuccess"
)
Boolean
isSuccess
)
{
myWalletBiz
.
withDrawProcess
(
orderNo
,
cono
,
reason
,
isSuccess
);
return
ObjectRestResponse
.
succ
();
}
}
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/
weixin/
constant/AliNeedPayErrorEnum.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/AliNeedPayErrorEnum.java
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
constant
;
package
com
.
xxfc
.
platform
.
universal
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/AliPayErrorEnum.java
0 → 100644
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
constant
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:22
*/
public
enum
AliPayErrorEnum
{
PAYEE_USER_INFO_ERROR
(
"支付宝账号和姓名不匹配,请确认姓名是否正确"
,
"请联系收款方确认收款用户姓名正确性"
),
PAYER_USER_INFO_ERROR
(
"付款用户姓名或其它信息不一致"
,
"请检查接口传递的付款方用户姓名正确性。"
),
PAYER_DATA_INCOMPLETE
(
"根据监管部门的要求,需要付款用户补充身份信息才能继续操作"
,
"根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"
),
CERT_MISS_ACC_LIMIT
(
"您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户补充身份信息才能继续操作"
,
"您连续10天余额账户的资金都超过5000元,根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端补充身份信息才能继续操作"
),
PAYEE_ACC_OCUPIED
(
"该手机号对应多个支付宝账户,请传入收款方姓名确定正确的收款账号"
,
"如果未传入payee_real_name,请传递payee_real_name;如果传递了payee_real_name,是因为收款登录号对应多个账户且账户名相同,请联系收款方更换登录号"
),
ACCOUNT_NOT_EXIST
(
"根据监管部门的要求,请补全你的身份信息,开立余额账户"
,
"请付款方登录支付宝站内或手机客户端补全身份信息"
),
PAYER_CERT_EXPIRED
(
"根据监管部门的要求,需要付款用户更新身份信息才能继续操作"
,
"根据监管部门的要求,需要付款用户登录支付宝站内或手机客户端更新身份信息才能继续操作"
),
PERMIT_NON_BANK_LIMIT_PAYEE
(
"根据监管部门的要求,对方未完善身份信息或未开立余额账户,无法收款"
,
"请联系收款方登录支付宝站内或手机客户端完善身份信息后,重试"
),
EXCEED_LIMIT_PERSONAL_SM_AMOUNT
(
"转账给个人支付宝账户单笔最多5万元"
,
"转账给个人支付宝账户单笔最多5万元。"
),
EXCEED_LIMIT_ENT_SM_AMOUNT
(
"转账给企业支付宝账户单笔最多10万元"
,
"转账给企业支付宝账户单笔最多10万元"
),
EXCEED_LIMIT_SM_MIN_AMOUNT
(
"单笔最低转账金额0.1元"
,
"请修改转账金额"
),
EXCEED_LIMIT_DM_MAX_AMOUNT
(
"单日最多可转100万元"
,
"单日最多可转100万元"
),
EXCEED_LIMIT_UNRN_DM_AMOUNT
(
"收款账户未实名,单日最多可收款1000元"
,
"收款账户未实名,单日最多可收款1000元"
),
PAYER_PAYEE_CANNOT_SAME
(
"收付款方不能相同"
,
"请检查一下收款方信息填写是否为付款方本人"
);
private
String
subReason
;
private
String
solution
;
AliPayErrorEnum
(
String
subReason
,
String
solution
)
{
this
.
subReason
=
subReason
;
this
.
solution
=
solution
;
}
public
String
getSubReason
()
{
return
subReason
;
}
public
void
setSubReason
(
String
subReason
)
{
this
.
subReason
=
subReason
;
}
public
String
getSolution
()
{
return
solution
;
}
public
void
setSolution
(
String
solution
)
{
this
.
solution
=
solution
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/
weixin/
constant/PaySubErrorCodeEnum.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/PaySubErrorCodeEnum.java
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
constant
;
package
com
.
xxfc
.
platform
.
universal
.
constant
;
/**
/**
* @author libin
* @author libin
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/PayWay.java
0 → 100644
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
constant
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/18 10:49
*/
public
enum
PayWay
{
/**
* 微信支付
*/
WX_PAY
(
0
,
"微信"
),
/**
* 支付宝
*/
ALI_PAY
(
1
,
"支付宝"
),
/**
* 银行
*/
BANK
(
2
,
"银行"
);
private
int
code
;
private
String
desc
;
PayWay
(
int
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/
weixin/
constant/WxNeedPayErrorEnum.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/WxNeedPayErrorEnum.java
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
constant
;
package
com
.
xxfc
.
platform
.
universal
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/WxPayErrorEnum.java
0 → 100644
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
constant
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 15:23
*/
public
enum
WxPayErrorEnum
{
SEND_FAILED
(
"付款错误,请查单确认付款结果"
,
"请查单确认付款结果,以查单结果为准"
),
SYSTEMERROR
(
"微信内部接口调用发生错误,请稍后重试"
,
"微信内部接口调用发生错误"
),
FREQ_LIMIT
(
"接口请求频率超时接口限制"
,
"调用接口过于频繁,请稍后再试,如果要继续付款必须使用原商户订单号重试"
),
MONEY_LIMIT
(
"已经达到今日付款总额上限"
,
"付款额度已经超限,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试"
),
V2_ACCOUNT_SIMPLE_BAN
(
"微信支付账户未知名,无法付款"
,
"不支持给非实名用户付款,如果要继续付款必须使用原商户订单号重试"
),
SENDNUM_LIMIT
(
"今日付款次数超过限制"
,
"向用户付款的次数超限了,请参考接口使用条件,如果要继续付款必须使用原商户订单号重试"
);
private
String
subReason
;
private
String
solution
;
WxPayErrorEnum
(
String
subReason
,
String
solution
)
{
this
.
subReason
=
subReason
;
this
.
solution
=
solution
;
}
public
String
getSubReason
()
{
return
subReason
;
}
public
void
setSubReason
(
String
subReason
)
{
this
.
subReason
=
subReason
;
}
public
String
getSolution
()
{
return
solution
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/
weixin/
constant/WxResponseProperties.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/WxResponseProperties.java
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
constant
;
package
com
.
xxfc
.
platform
.
universal
.
constant
;
/**
/**
* @author libin
* @author libin
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/FundPayVo.java
View file @
c69f7885
...
@@ -5,12 +5,14 @@ import lombok.Builder;
...
@@ -5,12 +5,14 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@Data
@Builder
(
toBuilder
=
true
)
@Builder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
public
class
FundPayVo
{
public
class
FundPayVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
//转账单号
//转账单号
private
String
outBizNo
;
private
String
outBizNo
;
...
@@ -32,5 +34,7 @@ public class FundPayVo {
...
@@ -32,5 +34,7 @@ public class FundPayVo {
private
String
checkName
;
private
String
checkName
;
private
String
orderNo
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/weixin/api/WXSuppToUserPay.java
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
api
;
package
com
.
xxfc
.
platform
.
universal
.
weixin
.
api
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.MD5Util
;
import
com.github.wxiaoqi.security.common.util.MD5Util
;
import
com.github.wxiaoqi.security.common.util.OrderUtil
;
import
com.github.wxiaoqi.security.common.util.OrderUtil
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
...
@@ -108,10 +109,9 @@ public class WXSuppToUserPay {
...
@@ -108,10 +109,9 @@ public class WXSuppToUserPay {
// System.out.println(map.get("payment_time"));
// System.out.println(map.get("payment_time"));
}
}
public
static
Map
<
String
,
String
>
WeiXinTiXian
(
String
openid
,
String
partnerTradeNo
,
String
check_name
,
String
amount
,
String
desc
,
String
spbill_create_ip
)
throws
Exception
public
static
Map
<
String
,
String
>
WeiXinTiXian
(
String
openid
,
String
partnerTradeNo
,
String
check_name
,
String
amount
,
String
desc
,
String
spbill_create_ip
)
{
{
WXSuppToUserPay
prePay
=
new
WXSuppToUserPay
();
WXSuppToUserPay
prePay
=
new
WXSuppToUserPay
();
prePay
.
setMch_appid
(
SystemConfig
.
WINXIN_AppID
);
prePay
.
setMch_appid
(
SystemConfig
.
WINXIN_AppID
);
prePay
.
setMchid
(
SystemConfig
.
WINXIN_PARTNER
);
prePay
.
setMchid
(
SystemConfig
.
WINXIN_PARTNER
);
prePay
.
setNonce_str
(
OrderUtil
.
CreateNoncestr
());
prePay
.
setNonce_str
(
OrderUtil
.
CreateNoncestr
());
...
@@ -123,8 +123,15 @@ public class WXSuppToUserPay {
...
@@ -123,8 +123,15 @@ public class WXSuppToUserPay {
prePay
.
setSpbill_create_ip
(
spbill_create_ip
);
prePay
.
setSpbill_create_ip
(
spbill_create_ip
);
String
result
=
postXML
(
suppTouser
,
prePay
.
getXMLTuiKuan
());
String
result
=
postXML
(
suppTouser
,
prePay
.
getXMLTuiKuan
());
result
=
result
.
replaceAll
(
"<![CDATA[|]]>"
,
""
).
replaceAll
(
"支付成功"
,
"pay sucess"
);
result
=
result
.
replaceAll
(
"<![CDATA[|]]>"
,
""
).
replaceAll
(
"支付成功"
,
"pay sucess"
);
Map
<
String
,
String
>
map
=
XMLUtil
.
doXMLParse
(
result
);
Map
<
String
,
String
>
map
=
null
;
return
map
;
try
{
map
=
XMLUtil
.
doXMLParse
(
result
);
}
catch
(
JDOMException
e
)
{
throw
new
BaseException
(
"微信转账参数xml解析错误"
,
e
);
}
catch
(
IOException
e
)
{
throw
new
BaseException
(
"微信转账参数xml解析读写IO异常"
,
e
);
}
return
map
;
}
}
public
static
String
postXML
(
String
uri
,
String
xml
)
{
public
static
String
postXML
(
String
uri
,
String
xml
)
{
CloseableHttpClient
httpclient
=
null
;
CloseableHttpClient
httpclient
=
null
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
View file @
c69f7885
...
@@ -20,6 +20,7 @@ import com.github.wxiaoqi.security.common.util.UUIDUtils;
...
@@ -20,6 +20,7 @@ import com.github.wxiaoqi.security.common.util.UUIDUtils;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.constant.PayWay
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.OrderPay
;
import
com.xxfc.platform.universal.entity.OrderPay
;
import
com.xxfc.platform.universal.mapper.OrderPayMapper
;
import
com.xxfc.platform.universal.mapper.OrderPayMapper
;
...
@@ -27,15 +28,11 @@ import com.xxfc.platform.universal.utils.SignUtils;
...
@@ -27,15 +28,11 @@ import com.xxfc.platform.universal.utils.SignUtils;
import
com.xxfc.platform.universal.vo.FundPayVo
;
import
com.xxfc.platform.universal.vo.FundPayVo
;
import
com.xxfc.platform.universal.vo.OrderPayVo
;
import
com.xxfc.platform.universal.vo.OrderPayVo
;
import
com.xxfc.platform.universal.weixin.api.*
;
import
com.xxfc.platform.universal.weixin.api.*
;
import
com.xxfc.platform.universal.weixin.constant.AliNeedPayErrorEnum
;
import
com.xxfc.platform.universal.constant.WxResponseProperties
;
import
com.xxfc.platform.universal.weixin.constant.PaySubErrorCodeEnum
;
import
com.xxfc.platform.universal.weixin.constant.WxNeedPayErrorEnum
;
import
com.xxfc.platform.universal.weixin.constant.WxResponseProperties
;
import
com.xxfc.platform.universal.weixin.util.HTTPUtils
;
import
com.xxfc.platform.universal.weixin.util.HTTPUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.InitializingBean
;
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
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -44,7 +41,6 @@ import tk.mybatis.mapper.entity.Example;
...
@@ -44,7 +41,6 @@ import tk.mybatis.mapper.entity.Example;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
PAY_DEMOTION
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
PAY_DEMOTION
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
UNIVERSAL_PAY
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
UNIVERSAL_PAY
;
...
@@ -58,7 +54,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
...
@@ -58,7 +54,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
*/
*/
@Service
@Service
@Slf4j
@Slf4j
public
class
OrderPayBiz
extends
BaseBiz
<
OrderPayMapper
,
OrderPay
>
implements
InitializingBean
{
public
class
OrderPayBiz
extends
BaseBiz
<
OrderPayMapper
,
OrderPay
>{
@Autowired
@Autowired
DictionaryBiz
dictionaryBiz
;
DictionaryBiz
dictionaryBiz
;
...
@@ -75,10 +71,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
...
@@ -75,10 +71,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
@Value
(
"${wx.appSercet}"
)
@Value
(
"${wx.appSercet}"
)
private
String
wy_secret
;
private
String
wy_secret
;
private
List
<
String
>
wxNeedPayErrorCodes
;
private
List
<
String
>
aliNeedPayErrorCodes
;
private
static
final
String
SUCCESS
=
"SUCCESS"
;
private
static
final
String
SUCCESS
=
"SUCCESS"
;
...
@@ -390,13 +382,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
...
@@ -390,13 +382,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
public
String
fundTrans
(
FundPayVo
fundPayVo
)
throws
Exception
{
public
String
fundTrans
(
FundPayVo
fundPayVo
)
throws
BaseException
{
if
(
fundPayVo
.
getType
()
==
0
)
{
String
cono
=
OrderUtil
.
GetOrderNumber
(
""
);
fundPayVo
.
setOutBizNo
(
cono
);
if
(
fundPayVo
.
getType
()
==
PayWay
.
WX_PAY
.
getCode
())
{
//微信
//微信
fundPayVo
.
setCheckName
(
"NO_CHECK"
);
fundPayVo
.
setCheckName
(
"NO_CHECK"
);
return
wxpayfundTrans
(
fundPayVo
);
return
wxpayfundTrans
(
fundPayVo
);
}
}
if
(
fundPayVo
.
getType
()
==
1
)
{
if
(
fundPayVo
.
getType
()
==
PayWay
.
ALI_PAY
.
getCode
()
)
{
//支付宝
//支付宝
return
alipayfundTrans
(
getAlipayClient
(),
fundPayVo
);
return
alipayfundTrans
(
getAlipayClient
(),
fundPayVo
);
}
}
...
@@ -409,7 +403,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
...
@@ -409,7 +403,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
* @param alipayClient
* @param alipayClient
* @throws AlipayApiException
* @throws AlipayApiException
*/
*/
public
String
alipayfundTrans
(
AlipayClient
alipayClient
,
FundPayVo
fundPayVo
)
throws
AlipayApiException
{
public
String
alipayfundTrans
(
AlipayClient
alipayClient
,
FundPayVo
fundPayVo
){
AlipayFundTransToaccountTransferRequest
request
=
new
AlipayFundTransToaccountTransferRequest
();
AlipayFundTransToaccountTransferRequest
request
=
new
AlipayFundTransToaccountTransferRequest
();
request
.
setBizContent
(
"{"
+
request
.
setBizContent
(
"{"
+
"\"out_biz_no\":\""
+
fundPayVo
.
getOutBizNo
()
+
"\","
+
"\"out_biz_no\":\""
+
fundPayVo
.
getOutBizNo
()
+
"\","
+
...
@@ -419,33 +413,25 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
...
@@ -419,33 +413,25 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
"\"payer_show_name\":\""
+
fundPayVo
.
getPayerShowName
()
+
"\","
+
"\"payer_show_name\":\""
+
fundPayVo
.
getPayerShowName
()
+
"\","
+
"\"remark\":\""
+
fundPayVo
.
getRemark
()
+
"\""
+
"\"remark\":\""
+
fundPayVo
.
getRemark
()
+
"\""
+
" }"
);
" }"
);
AlipayFundTransToaccountTransferResponse
response
=
alipayClient
.
execute
(
request
);
AlipayFundTransToaccountTransferResponse
response
=
null
;
try
{
response
=
alipayClient
.
execute
(
request
);
}
catch
(
AlipayApiException
e
)
{
throw
new
BaseException
(
"支付宝转账api调用错误"
,
e
);
}
if
(
response
.
isSuccess
())
{
if
(
response
.
isSuccess
())
{
log
.
info
(
"转账调用成功"
);
return
fundPayVo
.
getOutBizNo
();
return
fundPayVo
.
getOutBizNo
();
}
else
{
}
else
{
log
.
info
(
"转账调用失败"
);
throw
new
BaseException
(
response
.
getSubMsg
(),
response
.
getSubCode
());
String
subCode
=
response
.
getSubCode
();
if
(
aliNeedPayErrorCodes
.
contains
(
subCode
))
{
throw
new
BaseException
(
AliNeedPayErrorEnum
.
valueOf
(
subCode
).
getDesc
(),
PaySubErrorCodeEnum
.
PAY_NEED_ERROR
.
getSubCode
());
}
throw
new
BaseException
(
"支付宝转账失败:【错误码:"
+
response
.
getSubCode
()
+
" 错误信息:"
+
response
.
getSubMsg
()
+
"】"
,
PaySubErrorCodeEnum
.
PAY_ERROR
.
getSubCode
());
}
}
}
}
public
String
wxpayfundTrans
(
FundPayVo
fundPayVo
)
throws
Exception
{
public
String
wxpayfundTrans
(
FundPayVo
fundPayVo
)
{
Map
<
String
,
String
>
map
=
WXSuppToUserPay
.
WeiXinTiXian
(
fundPayVo
.
getAmount
(),
fundPayVo
.
getOutBizNo
(),
fundPayVo
.
getCheckName
(),
fundPayVo
.
getAmount
(),
fundPayVo
.
getRemark
(),
fundPayVo
.
getCreatIp
());
Map
<
String
,
String
>
map
=
WXSuppToUserPay
.
WeiXinTiXian
(
fundPayVo
.
getAmount
(),
fundPayVo
.
getOutBizNo
(),
fundPayVo
.
getCheckName
(),
fundPayVo
.
getAmount
(),
fundPayVo
.
getRemark
(),
fundPayVo
.
getCreatIp
());
log
.
info
(
"微信转账【{}】"
,
map
);
if
(
SUCCESS
.
equals
(
map
.
get
(
WxResponseProperties
.
RETURN_CODE
))
&&
SUCCESS
.
equals
(
map
.
get
(
WxResponseProperties
.
RESULT_CODE
)))
{
if
(
SUCCESS
.
equals
(
map
.
get
(
WxResponseProperties
.
RETURN_CODE
))
&&
SUCCESS
.
equals
(
map
.
get
(
WxResponseProperties
.
RESULT_CODE
)))
{
return
map
.
get
(
WxResponseProperties
.
PARTNER_TRADE_NO
);
return
map
.
get
(
WxResponseProperties
.
PARTNER_TRADE_NO
);
}
}
throw
new
BaseException
(
map
.
get
(
WxResponseProperties
.
ERR_CODE_DES
),
map
.
get
(
WxResponseProperties
.
ERROR_CODE
));
String
errorCode
=
map
.
get
(
WxResponseProperties
.
ERROR_CODE
);
if
(
wxNeedPayErrorCodes
.
contains
(
errorCode
))
{
throw
new
BaseException
(
WxNeedPayErrorEnum
.
valueOf
(
errorCode
).
getDesc
(),
PaySubErrorCodeEnum
.
PAY_NEED_ERROR
.
getSubCode
());
}
else
{
throw
new
BaseException
(
"微信转账失败:【错误码"
+
errorCode
+
" 错误信息:"
+
map
.
get
(
WxResponseProperties
.
ERR_CODE_DES
)
+
"】"
,
PaySubErrorCodeEnum
.
PAY_ERROR
.
getSubCode
());
}
}
}
...
@@ -647,16 +633,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
...
@@ -647,16 +633,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> implements In
fundPayVo
.
setAmount
(
"0.1"
);
fundPayVo
.
setAmount
(
"0.1"
);
fundPayVo
.
setPayeeAccount
(
"2088212169302286"
);
fundPayVo
.
setPayeeAccount
(
"2088212169302286"
);
AlipayClient
alipayClient
=
orderPayBiz
.
getAlipayClient
();
AlipayClient
alipayClient
=
orderPayBiz
.
getAlipayClient
();
try
{
System
.
out
.
println
(
orderPayBiz
.
alipayfundTrans
(
alipayClient
,
fundPayVo
));
System
.
out
.
println
(
orderPayBiz
.
alipayfundTrans
(
alipayClient
,
fundPayVo
));
}
catch
(
AlipayApiException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
wxNeedPayErrorCodes
=
EnumSet
.
allOf
(
WxNeedPayErrorEnum
.
class
).
stream
().
map
(
WxNeedPayErrorEnum:
:
name
).
collect
(
Collectors
.
toList
());
aliNeedPayErrorCodes
=
EnumSet
.
allOf
(
AliNeedPayErrorEnum
.
class
).
stream
().
map
(
AliNeedPayErrorEnum:
:
name
).
collect
(
Collectors
.
toList
());
}
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/config/RabbitUniversalConfig.java
0 → 100644
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
config
;
import
com.github.wxiaoqi.security.common.config.rabbit.BindDTO
;
import
com.github.wxiaoqi.security.common.config.rabbit.RabbitCommonConfig
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.ArrayList
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.
ADMIN_TOPIC
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.
KEY_WALLET_WITH_DRAW
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:23
*/
@Configuration
public
class
RabbitUniversalConfig
extends
RabbitCommonConfig
{
/**
* 提现支付
*/
public
static
final
String
WITH_DRAW_QUEUE
=
"withdraw.wallet.queue"
;
static
{
myQueue
=
new
ArrayList
<
BindDTO
>()
{{
//钱包提现
add
(
new
BindDTO
(
WITH_DRAW_QUEUE
,
ADMIN_TOPIC
,
KEY_WALLET_WITH_DRAW
));
}};
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/handler/WithDrawMqHandler.java
0 → 100644
View file @
c69f7885
package
com
.
xxfc
.
platform
.
universal
.
handler
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.xxfc.platform.universal.biz.OrderPayBiz
;
import
com.xxfc.platform.universal.constant.AliPayErrorEnum
;
import
com.xxfc.platform.universal.constant.PayWay
;
import
com.xxfc.platform.universal.constant.WxPayErrorEnum
;
import
com.xxfc.platform.universal.vo.FundPayVo
;
import
com.xxfc.platform.universal.constant.AliNeedPayErrorEnum
;
import
com.xxfc.platform.universal.constant.WxNeedPayErrorEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.support.AmqpHeaders
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.messaging.handler.annotation.Headers
;
import
org.springframework.stereotype.Component
;
import
com.rabbitmq.client.Channel
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.EnumSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
com
.
xxfc
.
platform
.
universal
.
config
.
RabbitUniversalConfig
.
WITH_DRAW_QUEUE
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/17 17:20
*/
@Component
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
@Slf4j
public
class
WithDrawMqHandler
implements
InitializingBean
{
private
List
<
String
>
needPayErrorCodes
;
private
List
<
String
>
wxPayErrorCodes
;
private
List
<
String
>
aliPayErrorCodes
;
private
final
UserFeign
userFeign
;
private
final
OrderPayBiz
orderPayBiz
;
@Resource
(
name
=
"redisTemplate"
)
private
ValueOperations
valueOperations
;
private
final
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
static
final
int
MAX_RETRY
=
3
;
private
static
final
String
DEFAULT_ERROR_MSG
=
"当前操作有误,如有疑问请咨询客服"
;
/**
* 钱包提现
*
* @param
*/
@RabbitListener
(
queues
=
WITH_DRAW_QUEUE
)
public
void
integralHandler
(
Message
message
,
@Headers
Map
<
String
,
Object
>
headers
,
Channel
channel
)
{
FundPayVo
fundPayVo
=
null
;
String
pay_way
=
""
;
Integer
cathType
=
null
;
String
orderNo
=
""
;
try
{
String
msg
=
new
String
(
message
.
getBody
(),
"UTF-8"
);
fundPayVo
=
JSON
.
parseObject
(
msg
,
FundPayVo
.
class
);
cathType
=
fundPayVo
.
getType
();
pay_way
=
fundPayVo
.
getType
()
==
PayWay
.
WX_PAY
.
getCode
()
?
PayWay
.
WX_PAY
.
getDesc
()
:
fundPayVo
.
getType
()
==
PayWay
.
ALI_PAY
.
getCode
()
?
PayWay
.
ALI_PAY
.
getDesc
()
:
fundPayVo
.
getType
()
==
PayWay
.
BANK
.
getCode
()
?
PayWay
.
BANK
.
getDesc
()
:
""
;
String
cono
=
orderPayBiz
.
fundTrans
(
fundPayVo
);
orderNo
=
fundPayVo
.
getOrderNo
();
log
.
info
(
"提现成功:【商户订单号:{}】-->【{}】"
,
cono
,
msg
);
userFeign
.
withDrawprocess
(
fundPayVo
.
getOrderNo
(),
cono
,
""
,
true
);
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
// 手动签收
basicAck
(
channel
,
deliveryTag
,
false
,
pay_way
);
}
catch
(
UnsupportedEncodingException
e
)
{
basicNack
(
channel
,
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
false
,
pay_way
);
String
reason
=
String
.
format
(
"%s%s%s"
,
pay_way
,
"转账失败"
,
"[不支持的编码:UTF-8]"
);
userFeign
.
withDrawprocess
(
fundPayVo
.
getOrderNo
(),
""
,
reason
,
false
);
log
.
info
(
"{}:【{}】"
,
reason
,
e
);
}
catch
(
BaseException
e
)
{
//错误码
String
subCode
=
e
.
getSubCode
();
//再次发消息
if
(
needPayErrorCodes
.
contains
(
subCode
))
{
Long
count
=
valueOperations
.
increment
(
orderNo
);
if
(
count
<=
MAX_RETRY
)
{
//重新把消息放回队列
basicNack
(
channel
,
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
true
,
pay_way
);
return
;
}
redisTemplate
.
delete
(
orderNo
);
}
String
msg
=
""
;
if
(
wxPayErrorCodes
.
contains
(
subCode
)
&&
cathType
!=
null
&&
cathType
==
PayWay
.
WX_PAY
.
getCode
())
{
msg
=
WxPayErrorEnum
.
valueOf
(
subCode
).
getSubReason
();
}
if
(
aliPayErrorCodes
.
contains
(
subCode
)
&&
cathType
!=
null
&&
cathType
==
PayWay
.
ALI_PAY
.
getCode
())
{
msg
=
AliPayErrorEnum
.
valueOf
(
subCode
).
getSubReason
();
}
msg
=
StringUtils
.
isEmpty
(
msg
)
?
DEFAULT_ERROR_MSG
:
msg
;
userFeign
.
withDrawprocess
(
fundPayVo
.
getOrderNo
(),
""
,
msg
,
false
);
//放弃此消息
basicNack
(
channel
,
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
false
,
pay_way
);
}
}
private
void
basicAck
(
Channel
channel
,
long
deliveryTag
,
boolean
multiple
,
String
pay_way
)
{
try
{
channel
.
basicAck
(
deliveryTag
,
multiple
);
}
catch
(
IOException
ex
)
{
log
.
info
(
"{}提现转账消息签收失败:【{}】"
,
pay_way
,
ex
);
}
}
private
void
basicNack
(
Channel
channel
,
long
deliveryTag
,
boolean
multiple
,
boolean
requeue
,
String
pay_way
)
{
try
{
channel
.
basicNack
(
deliveryTag
,
multiple
,
requeue
);
}
catch
(
IOException
ex
)
{
log
.
info
(
"{}提现转账消息{}失败:【{}】"
,
pay_way
,
requeue
?
"重回队列"
:
"丢弃"
,
ex
);
}
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
needPayErrorCodes
=
Stream
.
concat
(
EnumSet
.
allOf
(
WxNeedPayErrorEnum
.
class
).
stream
().
map
(
WxNeedPayErrorEnum:
:
name
),
EnumSet
.
allOf
(
AliNeedPayErrorEnum
.
class
).
stream
().
map
(
AliNeedPayErrorEnum:
:
name
))
.
distinct
()
.
collect
(
Collectors
.
toList
());
wxPayErrorCodes
=
EnumSet
.
allOf
(
WxPayErrorEnum
.
class
).
stream
().
map
(
WxPayErrorEnum:
:
name
).
collect
(
Collectors
.
toList
());
aliPayErrorCodes
=
EnumSet
.
allOf
(
AliPayErrorEnum
.
class
).
stream
().
map
(
AliPayErrorEnum:
:
name
).
collect
(
Collectors
.
toList
());
}
}
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