Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
youka-api
Overview
Overview
Details
Activity
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
java-youka-wallet
youka-api
Commits
636ec1d2
Commit
636ec1d2
authored
Mar 05, 2018
by
Java-张振楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
①增加切换结算卡
parent
e8164668
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
165 additions
and
4 deletions
+165
-4
JuHeZhongPayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
+31
-1
UserApiController.java
src/main/java/com/thinkgem/jeesite/modules/user/api/UserApiController.java
+26
-0
UserRequest.java
src/main/java/com/thinkgem/jeesite/modules/user/bean/UserRequest.java
+9
-0
UserApiDao.java
src/main/java/com/thinkgem/jeesite/modules/user/dao/UserApiDao.java
+6
-1
CardEntity.java
src/main/java/com/thinkgem/jeesite/modules/user/entity/CardEntity.java
+4
-0
UserApiService.java
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
+42
-2
UserDao.xml
src/main/resources/mappings/modules/user/UserDao.xml
+47
-0
No files found.
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
View file @
636ec1d2
...
...
@@ -18,6 +18,13 @@ import java.util.Map;
@Transactional
(
readOnly
=
true
)
public
class
JuHeZhongPayService
{
/**
* 注册子商户
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
register
(
MerchantDto
dto
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
...
...
@@ -27,7 +34,14 @@ public class JuHeZhongPayService {
return
JSONObject
.
parseObject
(
respStr
);
}
public
JSONObject
updateSettle
(
MerchantDto
dto
)
throws
Exception
{
/**
* 更新费率
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
updateRate
(
MerchantDto
dto
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
String
sign
=
SignUtils
.
sign
(
signBefore
,
ComCode
.
MERCHANT_SECRET
);
...
...
@@ -35,4 +49,20 @@ public class JuHeZhongPayService {
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
RATE_UPDATE_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
/**
* 更新结算信息
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
updateSettle
(
MerchantDto
dto
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
String
sign
=
SignUtils
.
sign
(
signBefore
,
ComCode
.
MERCHANT_SECRET
);
params
.
put
(
"sign"
,
sign
);
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
SETTLE_UPDATE_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
}
src/main/java/com/thinkgem/jeesite/modules/user/api/UserApiController.java
View file @
636ec1d2
...
...
@@ -493,5 +493,31 @@ public class UserApiController {
return
resp
;
}
/**
* 切换结算卡
*
* @param request
* @return
*/
@PostMapping
(
"/changeDebit"
)
public
Response
changeDebit
(
UserRequest
request
)
{
Response
resp
=
new
Response
();
try
{
// 判断业务入参是否为空
if
(
StringUtils
.
isBlank
(
request
.
getSubMerchantCode
())
||
StringUtils
.
isBlank
(
request
.
getDebitCardCode
()))
{
resp
.
setStatus
(
ComCode
.
STATUS_CODE_4001
);
resp
.
setMessage
(
ComCode
.
STATUS_CODE_4001_DESC
);
return
resp
;
}
userService
.
changeDebit
(
request
);
resp
.
setStatus
(
ComCode
.
STATUS_CODE_2000
);
resp
.
setMessage
(
ComCode
.
STATUS_CODE_2000_DESC
);
}
catch
(
Exception
e
)
{
resp
.
setStatus
(
ComCode
.
STATUS_CODE_9998
);
resp
.
setMessage
(
ComCode
.
STATUS_CODE_9998_DESC
);
resp
.
setError
(
e
.
getMessage
());
}
return
resp
;
}
}
src/main/java/com/thinkgem/jeesite/modules/user/bean/UserRequest.java
View file @
636ec1d2
...
...
@@ -31,6 +31,7 @@ public class UserRequest extends Request {
private
String
cardSrc
;
// 银行卡正面
private
String
type
;
// 省市类型 P省 C市
private
String
pid
;
// 父级id
private
String
debitCardCode
;
// 结算卡code
public
String
getMobile
()
{
return
mobile
;
...
...
@@ -239,4 +240,12 @@ public class UserRequest extends Request {
public
void
setPid
(
String
pid
)
{
this
.
pid
=
pid
;
}
public
String
getDebitCardCode
()
{
return
debitCardCode
;
}
public
void
setDebitCardCode
(
String
debitCardCode
)
{
this
.
debitCardCode
=
debitCardCode
;
}
}
src/main/java/com/thinkgem/jeesite/modules/user/dao/UserApiDao.java
View file @
636ec1d2
...
...
@@ -59,11 +59,16 @@ public interface UserApiDao {
List
<
CardEntity
>
getRecommendCardsInfo
(
UserEntity
recommendedUser
);
void
updateCardNoDebit
(
UserRequest
request
);
void
updateCardDebit
(
UserRequest
request
);
CardEntity
getDebitCard
(
CardEntity
cardEntity
);
List
<
ProvinceCityEntity
>
getProvince
(
UserRequest
request
);
List
<
ProvinceCityEntity
>
getCity
(
UserRequest
request
);
List
<
BelongBankEntity
>
getBelongBank
(
UserRequest
request
);
}
src/main/java/com/thinkgem/jeesite/modules/user/entity/CardEntity.java
View file @
636ec1d2
...
...
@@ -38,6 +38,10 @@ public class CardEntity extends BaseEntity implements Serializable {
public
CardEntity
()
{
}
public
CardEntity
(
String
code
)
{
this
.
setCode
(
code
);
}
public
CardEntity
(
String
userCode
,
String
isDebit
)
{
this
.
userCode
=
userCode
;
this
.
isDebit
=
isDebit
;
...
...
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
View file @
636ec1d2
...
...
@@ -198,7 +198,7 @@ public class UserApiService {
RateEntity
rateEntity
=
userDao
.
getRateByLevel
(
rateEntityParam
);
List
<
CardEntity
>
recommendCards
=
userDao
.
getRecommendCardsInfo
(
recommendedUser
);
for
(
CardEntity
entity
:
recommendCards
)
{
update
Settl
eJuHeZhongPay
(
entity
,
rateEntity
);
update
Rat
eJuHeZhongPay
(
entity
,
rateEntity
);
}
}
}
...
...
@@ -216,6 +216,18 @@ public class UserApiService {
public
List
<
BelongBankEntity
>
getBelongBank
(
UserRequest
request
)
{
return
userDao
.
getBelongBank
(
request
);
}
@Transactional
(
readOnly
=
false
)
public
void
changeDebit
(
UserRequest
request
)
throws
MyException
,
Exception
{
// 将该用户的所有卡类型置为非结算卡
userDao
.
updateCardNoDebit
(
request
);
// 设置结算卡
userDao
.
updateCardDebit
(
request
);
// 获取结算卡信息
CardEntity
cardEntity
=
userDao
.
getDebitCard
(
new
CardEntity
(
request
.
getDebitCardCode
()));
// 修改用户的结算卡
updateSettleJuHeZhongPay
(
cardEntity
);
}
/*
* 以下为类内使用方法
*/
...
...
@@ -273,7 +285,7 @@ public class UserApiService {
* @throws MyException
* @throws Exception
*/
public
void
update
Settl
eJuHeZhongPay
(
CardEntity
cardEntity
,
RateEntity
rateEntity
)
throws
MyException
,
Exception
{
public
void
update
Rat
eJuHeZhongPay
(
CardEntity
cardEntity
,
RateEntity
rateEntity
)
throws
MyException
,
Exception
{
// 修改费率
MerchantDto
dto
=
new
MerchantDto
();
dto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
...
...
@@ -283,6 +295,34 @@ public class UserApiService {
dto
.
setExtraRate
(
new
BigDecimal
(
ComCode
.
EXTRA_RATE
));
dto
.
setTimestamp
(
System
.
currentTimeMillis
());
dto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
JSONObject
jsonObject
=
juHeZhongPayService
.
updateRate
(
dto
);
if
(!
"0000"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
}
}
/**
* 修改JuHeZhong支付用户结算信息
*
* @param cardEntity
* @return
* @throws MyException
* @throws Exception
*/
public
void
updateSettleJuHeZhongPay
(
CardEntity
cardEntity
)
throws
Exception
{
// 修改费率
MerchantDto
dto
=
new
MerchantDto
();
dto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
dto
.
setSubMchId
(
cardEntity
.
getSubMerchantId
());
dto
.
setOrderId
(
IdGen
.
uuid
());
//不会产生交易订单
dto
.
setAccType
(
Integer
.
parseInt
(
cardEntity
.
getType
()));
//1 对私 2对公
dto
.
setAccNo
(
cardEntity
.
getCardNo
());
dto
.
setAccProvince
(
cardEntity
.
getProvince
());
dto
.
setAccCity
(
cardEntity
.
getCity
());
dto
.
setBankCode
(
cardEntity
.
getBelongBank
());
dto
.
setMobile
(
cardEntity
.
getCardMobile
());
dto
.
setTimestamp
(
System
.
currentTimeMillis
());
dto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
JSONObject
jsonObject
=
juHeZhongPayService
.
updateSettle
(
dto
);
if
(!
"0000"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
...
...
src/main/resources/mappings/modules/user/UserDao.xml
View file @
636ec1d2
...
...
@@ -474,6 +474,53 @@
AND yc.del_flag = '0'
</select>
<update
id=
"updateCardNoDebit"
>
UPDATE
youka_cards
SET
is_debit = 'N'
WHERE
user_code = #{subMerchantCode}
</update>
<update
id=
"updateCardDebit"
>
UPDATE
youka_cards
SET
is_debit = 'Y'
WHERE
code = #{debitCardCode}
</update>
<select
id=
"getDebitCard"
resultType=
"com.thinkgem.jeesite.modules.user.entity.CardEntity"
>
SELECT
yc.id,
yc.code,
yc.user_code AS userCode,
yc.card_type AS cardType,
yc.card_no AS cardNo,
yc.card_mobile AS cardMobile,
yc.belong_bank AS belongBank,
yc.card_bank AS cardBank,
yc.card_place AS cardPlace,
yc.is_debit AS isDebit,
yc.sub_merchant_id AS subMerchantId,
yc.card_src AS cardSrc,
yc.type,
yc.status,
yc.province,
yc.city,
yc.create_date AS created,
yc.create_by AS createdUser,
yc.update_date AS modified,
yc.update_by AS modifiedUser,
yc.del_flag AS delFlag
FROM
youka_cards yc
WHERE
yc.code = #{code}
</select>
<select
id=
"getProvince"
resultType=
"com.thinkgem.jeesite.modules.user.entity.ProvinceCityEntity"
>
SELECT
id,
...
...
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