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
cce44d62
Commit
cce44d62
authored
Mar 09, 2018
by
Java-张振楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
①新增快捷支付接口
parent
18ad8e1c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
546 additions
and
6 deletions
+546
-6
ComCode.java
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
+1
-1
PayApiController.java
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
+3
-3
PayApiDao.java
src/main/java/com/thinkgem/jeesite/modules/pay/dao/PayApiDao.java
+12
-0
BenefitEntity.java
src/main/java/com/thinkgem/jeesite/modules/pay/entity/BenefitEntity.java
+87
-0
OrderEntity.java
src/main/java/com/thinkgem/jeesite/modules/pay/entity/OrderEntity.java
+117
-0
UserRateEntity.java
src/main/java/com/thinkgem/jeesite/modules/pay/entity/UserRateEntity.java
+33
-0
JuHeZhongPayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
+17
-0
PayApiService.java
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
+117
-1
JuHeZhongPayRequest.java
src/main/java/com/thinkgem/jeesite/modules/user/bean/JuHeZhongPayRequest.java
+36
-0
UserApiDao.java
src/main/java/com/thinkgem/jeesite/modules/user/dao/UserApiDao.java
+2
-0
UserApiService.java
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
+10
-1
PayApiDao.xml
src/main/resources/mappings/modules/pay/PayApiDao.xml
+76
-0
UserDao.xml
src/main/resources/mappings/modules/user/UserDao.xml
+35
-0
No files found.
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
View file @
cce44d62
...
...
@@ -34,7 +34,7 @@ public class ComCode {
public
static
final
long
minutes
=
60
;
public
static
final
long
hours
=
24
;
public
static
final
SimpleDateFormat
YYYYMMDD_HHMMSS
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
public
static
final
SimpleDateFormat
YYYYMMDDHHMM
=
new
SimpleDateFormat
(
"yyyyMMddhhmm"
);
/**
* 系统公共
*/
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
View file @
cce44d62
...
...
@@ -24,11 +24,11 @@ public class PayApiController {
* @param request
* @return
*/
@PostMapping
(
"/quick"
)
public
Response
checkValidation
(
JuHeZhongPayRequest
request
)
{
@PostMapping
(
"/quick
Pay
"
)
public
Response
quickPay
(
JuHeZhongPayRequest
request
)
{
Response
resp
=
new
Response
();
try
{
payService
.
quickPay
(
request
);
resp
.
setStatus
(
ComCode
.
STATUS_CODE_2000
);
resp
.
setMessage
(
ComCode
.
STATUS_CODE_2000_DESC
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/dao/PayApiDao.java
View file @
cce44d62
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
dao
;
import
com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao
;
import
com.thinkgem.jeesite.modules.pay.entity.BenefitEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.OrderEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.UserRateEntity
;
import
java.util.List
;
@MyBatisDao
public
interface
PayApiDao
{
void
saveOrderInfo
(
OrderEntity
orderEntity
);
List
<
UserRateEntity
>
getCDEUsers
(
String
[]
pathIds
);
List
<
UserRateEntity
>
getSABUsers
(
String
[]
pathIds
);
void
saveBenefitInfo
(
BenefitEntity
benefitEntity
);
}
src/main/java/com/thinkgem/jeesite/modules/pay/entity/BenefitEntity.java
0 → 100644
View file @
cce44d62
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
entity
;
import
com.thinkgem.jeesite.common.baseBean.BaseEntity
;
import
java.io.Serializable
;
public
class
BenefitEntity
extends
BaseEntity
implements
Serializable
{
private
String
userCode
;
// 用户code
private
String
orderCode
;
// 订单code
private
String
payChannel
;
// 来源渠道
private
String
benefitStatus
;
// 分润状态 0不可提现 1可以提现
private
String
benefitType
;
// 分润类型 A收益 M提现
private
String
amount
;
// 金额
private
String
cardCode
;
// 提现卡code
public
BenefitEntity
()
{
}
public
BenefitEntity
(
String
code
,
String
userCode
,
String
orderCode
,
String
payChannel
,
String
benefitStatus
,
String
benefitType
,
String
amount
,
String
cardCode
)
{
this
.
setCode
(
code
);
this
.
userCode
=
userCode
;
this
.
orderCode
=
orderCode
;
this
.
payChannel
=
payChannel
;
this
.
benefitStatus
=
benefitStatus
;
this
.
benefitType
=
benefitType
;
this
.
amount
=
amount
;
this
.
cardCode
=
cardCode
;
this
.
setCreatedUser
(
"sys"
);
this
.
setModifiedUser
(
"sys"
);
}
public
String
getUserCode
()
{
return
userCode
;
}
public
void
setUserCode
(
String
userCode
)
{
this
.
userCode
=
userCode
;
}
public
String
getOrderCode
()
{
return
orderCode
;
}
public
void
setOrderCode
(
String
orderCode
)
{
this
.
orderCode
=
orderCode
;
}
public
String
getPayChannel
()
{
return
payChannel
;
}
public
void
setPayChannel
(
String
payChannel
)
{
this
.
payChannel
=
payChannel
;
}
public
String
getBenefitStatus
()
{
return
benefitStatus
;
}
public
void
setBenefitStatus
(
String
benefitStatus
)
{
this
.
benefitStatus
=
benefitStatus
;
}
public
String
getBenefitType
()
{
return
benefitType
;
}
public
void
setBenefitType
(
String
benefitType
)
{
this
.
benefitType
=
benefitType
;
}
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
public
String
getCardCode
()
{
return
cardCode
;
}
public
void
setCardCode
(
String
cardCode
)
{
this
.
cardCode
=
cardCode
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/entity/OrderEntity.java
0 → 100644
View file @
cce44d62
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
entity
;
import
com.thinkgem.jeesite.common.baseBean.BaseEntity
;
import
java.io.Serializable
;
public
class
OrderEntity
extends
BaseEntity
implements
Serializable
{
private
String
userCode
;
// 用户code
private
String
payNo
;
// 订单号 4位年+2位月+2位日+2位时+2位分+8位随机数
private
String
payCode
;
// 支付号
private
String
payChannel
;
// 支付渠道
private
String
payStatus
;
// 订单状态 0待支付 1支付中 2已支付 3逾期取消
private
String
amount
;
// 金额
private
String
subject
;
// 商品名称
private
String
tradeNo
;
// 交易号
private
String
payType
;
// 交易类型 5借记卡 6贷记卡
private
String
cardCode
;
// 支付卡code
public
OrderEntity
()
{
}
public
OrderEntity
(
String
code
,
String
userCode
,
String
payNo
,
String
payCode
,
String
payChannel
,
String
payStatus
,
String
amount
,
String
subject
,
String
tradeNo
,
String
payType
,
String
cardCode
)
{
this
.
setCode
(
code
);
this
.
userCode
=
userCode
;
this
.
payNo
=
payNo
;
this
.
payCode
=
payCode
;
this
.
payChannel
=
payChannel
;
this
.
payStatus
=
payStatus
;
this
.
amount
=
amount
;
this
.
subject
=
subject
;
this
.
tradeNo
=
tradeNo
;
this
.
payType
=
payType
;
this
.
cardCode
=
cardCode
;
this
.
setCreatedUser
(
"sys"
);
this
.
setModifiedUser
(
"sys"
);
}
public
String
getUserCode
()
{
return
userCode
;
}
public
void
setUserCode
(
String
userCode
)
{
this
.
userCode
=
userCode
;
}
public
String
getPayNo
()
{
return
payNo
;
}
public
void
setPayNo
(
String
payNo
)
{
this
.
payNo
=
payNo
;
}
public
String
getPayCode
()
{
return
payCode
;
}
public
void
setPayCode
(
String
payCode
)
{
this
.
payCode
=
payCode
;
}
public
String
getPayChannel
()
{
return
payChannel
;
}
public
void
setPayChannel
(
String
payChannel
)
{
this
.
payChannel
=
payChannel
;
}
public
String
getPayStatus
()
{
return
payStatus
;
}
public
void
setPayStatus
(
String
payStatus
)
{
this
.
payStatus
=
payStatus
;
}
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
public
String
getSubject
()
{
return
subject
;
}
public
void
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
}
public
String
getTradeNo
()
{
return
tradeNo
;
}
public
void
setTradeNo
(
String
tradeNo
)
{
this
.
tradeNo
=
tradeNo
;
}
public
String
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
String
payType
)
{
this
.
payType
=
payType
;
}
public
String
getCardCode
()
{
return
cardCode
;
}
public
void
setCardCode
(
String
cardCode
)
{
this
.
cardCode
=
cardCode
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/entity/UserRateEntity.java
0 → 100644
View file @
cce44d62
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
entity
;
import
java.io.Serializable
;
public
class
UserRateEntity
implements
Serializable
{
private
String
userCode
;
// 用户等级
private
String
userLevel
;
// 支付方式
private
String
rate
;
// 费率
public
String
getUserCode
()
{
return
userCode
;
}
public
void
setUserCode
(
String
userCode
)
{
this
.
userCode
=
userCode
;
}
public
String
getUserLevel
()
{
return
userLevel
;
}
public
void
setUserLevel
(
String
userLevel
)
{
this
.
userLevel
=
userLevel
;
}
public
String
getRate
()
{
return
rate
;
}
public
void
setRate
(
String
rate
)
{
this
.
rate
=
rate
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
View file @
cce44d62
...
...
@@ -2,6 +2,7 @@ package com.thinkgem.jeesite.modules.pay.juhezhong.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.ApiQuickPayDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.MerchantDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.HttpUtil
;
...
...
@@ -65,4 +66,20 @@ public class JuHeZhongPayService {
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
SETTLE_UPDATE_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
/**
* 快捷支付
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
quickPay
(
ApiQuickPayDto
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
.
QUICK_PAY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
View file @
cce44d62
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.thinkgem.jeesite.common.baseBean.Request
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.utils.DateUtils
;
import
com.thinkgem.jeesite.common.utils.IdGen
;
import
com.thinkgem.jeesite.modules.commonError.MyException
;
import
com.thinkgem.jeesite.modules.pay.dao.PayApiDao
;
import
com.thinkgem.jeesite.modules.pay.entity.BenefitEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.OrderEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.UserRateEntity
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.ApiQuickPayDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.MerchantDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.service.JuHeZhongPayService
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
com.thinkgem.jeesite.modules.user.entity.CardEntity
;
import
com.thinkgem.jeesite.modules.user.entity.UserEntity
;
import
com.thinkgem.jeesite.modules.user.service.UserApiService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
*
前端用户
相关
*
支付
相关
*/
@Service
@Transactional
(
readOnly
=
true
)
...
...
@@ -15,6 +33,104 @@ public class PayApiService {
@Autowired
private
PayApiDao
payDao
;
@Autowired
private
UserApiService
userService
;
@Autowired
private
JuHeZhongPayService
juHeZhongPayService
;
@Transactional
(
readOnly
=
false
)
public
void
quickPay
(
JuHeZhongPayRequest
request
)
throws
MyException
,
Exception
{
// 1. 根据入参获取用户详情信息,包括支付卡片信息
UserEntity
userEntity
=
userService
.
getUserInfo
(
new
Request
(
request
.
getSubMerchantCode
()));
userEntity
=
userService
.
getUserDetailInfo
(
userEntity
);
userEntity
.
getUserDetail
().
setCard
(
userService
.
getCardInfo
(
request
));
// 2. 创建支付订单信息,并保存
String
code
=
IdGen
.
randomBase62
(
64
);
String
payNo
=
ComCode
.
YYYYMMDDHHMM
.
format
(
new
Date
())
+
IdGen
.
randomBase62
(
8
);
// 订单号
String
payCode
=
IdGen
.
randomBase62
(
64
);
OrderEntity
orderEntity
=
new
OrderEntity
(
code
,
request
.
getSubMerchantCode
(),
payNo
,
payCode
,
request
.
getPayChannel
(),
"1"
,
request
.
getAmount
(),
request
.
getSubject
(),
""
,
String
.
valueOf
(
"D"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
5
:
(
"C"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
6
:
0
)),
request
.
getCardCode
());
payDao
.
saveOrderInfo
(
orderEntity
);
// 3. 创建分润信息,并保存
Map
<
String
,
String
>
userBenefits
=
getUserBenefit
(
userEntity
,
request
);
for
(
String
key
:
userBenefits
.
keySet
())
{
String
benefitCode
=
IdGen
.
randomBase62
(
64
);
BenefitEntity
benefitEntity
=
new
BenefitEntity
(
benefitCode
,
request
.
getSubMerchantCode
(),
code
,
request
.
getPayChannel
(),
"0"
,
"A"
,
userBenefits
.
get
(
key
),
""
);
payDao
.
saveBenefitInfo
(
benefitEntity
);
}
// 4. JuHeZhong支付
quickPayJuHeZhongPay
(
userEntity
,
orderEntity
,
request
);
}
/*
* 以下为类内使用方法
*/
/**
* JuHeZhong快捷支付
*
* @param userEntity
* @param request
* @throws Exception
*/
public
void
quickPayJuHeZhongPay
(
UserEntity
userEntity
,
OrderEntity
orderEntity
,
JuHeZhongPayRequest
request
)
throws
Exception
{
// 快捷支付
ApiQuickPayDto
quickPayDto
=
new
ApiQuickPayDto
();
quickPayDto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
quickPayDto
.
setOrderId
(
orderEntity
.
getPayCode
());
// 将订单的支付号传给第三方平台
quickPayDto
.
setSubMchId
(
userEntity
.
getUserDetail
().
getCard
().
getSubMerchantId
());
//子商户号
quickPayDto
.
setAmount
(
Long
.
parseLong
(
request
.
getAmount
()));
quickPayDto
.
setBody
(
request
.
getSubject
());
quickPayDto
.
setType
(
"D"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
5
:
(
"C"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
6
:
0
));
quickPayDto
.
setAccName
(
userEntity
.
getUserDetail
().
getRealName
());
quickPayDto
.
setAccNo
(
userEntity
.
getUserDetail
().
getCard
().
getCardNo
());
quickPayDto
.
setMobile
(
userEntity
.
getUserDetail
().
getCard
().
getCardMobile
());
quickPayDto
.
setIdNo
(
userEntity
.
getUserDetail
().
getIdCard
());
quickPayDto
.
setFrontUrl
(
""
);
// 前台地址
quickPayDto
.
setNotifyUrl
(
""
);
// 通知url
quickPayDto
.
setTimestamp
(
System
.
currentTimeMillis
());
quickPayDto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
JSONObject
jsonObject
=
juHeZhongPayService
.
quickPay
(
quickPayDto
);
if
(!
"0000"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
}
}
public
Map
<
String
,
String
>
getUserBenefit
(
UserEntity
userEntity
,
JuHeZhongPayRequest
request
)
{
Map
<
String
,
String
>
userBenefit
=
new
HashMap
<>();
String
[]
pathIds
=
(
userEntity
.
getRecommendedPath
()
+
userEntity
.
getId
()
+
","
).
split
(
","
);
// 获取三级的会员
List
<
UserRateEntity
>
pathCDEUsers
=
payDao
.
getCDEUsers
(
pathIds
);
int
countLevelC
=
0
;
// 判断上级有几个黄金会员(C)
for
(
UserRateEntity
entity
:
pathCDEUsers
)
{
// 不考虑该用户本身
if
(
entity
.
getUserCode
().
equals
(
userEntity
.
getCode
()))
{
continue
;
}
if
(
"C"
.
equals
(
entity
.
getUserLevel
()))
{
countLevelC
++;
}
}
double
minRate
=
1
;
int
levelCPosition
=
0
;
for
(
UserRateEntity
entity
:
pathCDEUsers
)
{
levelCPosition
++;
minRate
=
minRate
>=
Double
.
parseDouble
(
entity
.
getRate
())
?
Double
.
parseDouble
(
entity
.
getRate
())
:
minRate
;
if
(
entity
.
getUserCode
().
equals
(
userEntity
.
getCode
()))
{
continue
;
}
// 只有黄金会员(C)以上才分润
if
(
"C"
.
equals
(
entity
.
getUserLevel
()))
{
double
percent
=
countLevelC
==
1
?
1
d
:
(
levelCPosition
==
2
?
0.95
:
0.05
);
userBenefit
.
put
(
entity
.
getUserCode
(),
String
.
valueOf
((
minRate
-
Double
.
parseDouble
(
entity
.
getRate
()))
>
0
?
(
minRate
-
Double
.
parseDouble
(
entity
.
getRate
()))
*
Double
.
parseDouble
(
request
.
getAmount
())
*
percent
:
"0"
));
}
}
// 获取顶级管理员
List
<
UserRateEntity
>
pathSABUsers
=
payDao
.
getSABUsers
(
pathIds
);
for
(
UserRateEntity
entity
:
pathSABUsers
)
{
userBenefit
.
put
(
entity
.
getUserCode
(),
String
.
valueOf
((
minRate
-
Double
.
parseDouble
(
entity
.
getRate
()))
*
Double
.
parseDouble
(
request
.
getAmount
())));
minRate
=
Double
.
valueOf
(
entity
.
getRate
());
}
return
userBenefit
;
}
}
src/main/java/com/thinkgem/jeesite/modules/user/bean/JuHeZhongPayRequest.java
View file @
cce44d62
...
...
@@ -3,4 +3,40 @@ package com.thinkgem.jeesite.modules.user.bean;
import
com.thinkgem.jeesite.common.baseBean.Request
;
public
class
JuHeZhongPayRequest
extends
Request
{
private
String
amount
;
// 金额
private
String
cardCode
;
// 支付卡code
private
String
subject
;
// 商品名称
private
String
payChannel
;
// 渠道 目前合众支付接口仅传入quick
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
public
String
getCardCode
()
{
return
cardCode
;
}
public
void
setCardCode
(
String
cardCode
)
{
this
.
cardCode
=
cardCode
;
}
public
String
getSubject
()
{
return
subject
;
}
public
void
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
}
public
String
getPayChannel
()
{
return
payChannel
;
}
public
void
setPayChannel
(
String
payChannel
)
{
this
.
payChannel
=
payChannel
;
}
}
src/main/java/com/thinkgem/jeesite/modules/user/dao/UserApiDao.java
View file @
cce44d62
...
...
@@ -33,6 +33,8 @@ public interface UserApiDao {
List
<
CardEntity
>
getCardsInfo
(
UserRequest
request
);
CardEntity
getCardInfo
(
Request
request
);
void
removeCards
(
UserRequest
request
);
void
updateCardStatus
(
CardEntity
cardStatusEntity
);
...
...
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
View file @
cce44d62
...
...
@@ -38,7 +38,7 @@ public class UserApiService {
@Autowired
private
JuHeZhongPayService
juHeZhongPayService
;
public
UserEntity
getUserInfo
(
User
Request
request
)
{
public
UserEntity
getUserInfo
(
Request
request
)
{
UserEntity
user
=
userDao
.
getUserInfo
(
request
);
// 以下两行代码应Android要求,增加空detail和card
user
.
setUserDetail
(
new
UserDetailEntity
());
...
...
@@ -141,6 +141,15 @@ public class UserApiService {
return
list
;
}
public
CardEntity
getCardInfo
(
Request
request
)
{
CardEntity
entity
=
userDao
.
getCardInfo
(
request
);
entity
.
setCardSrc
(
Global
.
getConfig
(
"sys.pre.url"
)
+
entity
.
getCardSrc
());
if
(
StringUtils
.
isNotBlank
(
entity
.
getBankShort
()))
{
entity
.
setBankUrl
(
Global
.
getConfig
(
"logo.bank.url"
)
+
entity
.
getBankShort
());
}
return
entity
;
}
@Transactional
(
readOnly
=
false
)
public
void
removeCards
(
UserRequest
request
)
{
userDao
.
removeCards
(
request
);
...
...
src/main/resources/mappings/modules/pay/PayApiDao.xml
0 → 100644
View file @
cce44d62
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.thinkgem.jeesite.modules.pay.dao.PayApiDao"
>
<insert
id=
"saveOrderInfo"
>
INSERT INTO youka_orders(
code,
user_code,
pay_no,
pay_code,
pay_channel,
pay_status,
amount,
subject,
trade_no,
pay_type,
card_code,
create_by,
update_by
) VALUES (#{code}, #{userCode}, #{payNo}, #{payCode}, #{payChannel}, #{payStatus}, #{amount}, #{subject}, #{tradeNo}, #{payType}, #{cardCode}, #{createdUser}, #{modifiedUser})
</insert>
<select
id=
"getCDEUsers"
resultType=
"com.thinkgem.jeesite.modules.pay.entity.UserRateEntity"
>
SELECT
yu.code AS userCode,
yu.level AS userLevel,
yr.rate AS rate
FROM
youka_users yu
LEFT JOIN youka_rate yr ON yu.level = yr.user_level AND yr.pay_method = 'quick'
WHERE
yu.id IN
<foreach
collection=
"array"
item=
"pathIds"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{pathIds}
</foreach>
AND yu.level IN ('C', 'D', 'E')
ORDER BY recommended_path DESC
LIMIT 3
</select>
<select
id=
"getSABUsers"
resultType=
"com.thinkgem.jeesite.modules.pay.entity.UserRateEntity"
>
SELECT
yu.code AS userCode,
yu.level AS userLevel,
yr.rate AS rate
FROM
youka_users yu
LEFT JOIN youka_rate yr ON yu.level = yr.user_level AND yr.pay_method = 'quick'
WHERE
yu.id IN
<foreach
collection=
"array"
item=
"pathIds"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{pathIds}
</foreach>
AND yu.level IN ('S', 'A', 'B')
ORDER BY recommended_path DESC
LIMIT 3
</select>
<insert
id=
"saveBenefitInfo"
>
INSERT INTO youka_orders(
code,
user_code,
order_code,
pay_channel,
benefit_status,
benefit_type,
amount,
card_code,
create_by,
update_by
) VALUES (#{code}, #{userCode}, #{orderCode}, #{payChannel}, #{benefitStatus}, #{benefitType}, #{amount}, #{cardCode}, #{createdUser}, #{modifiedUser})
</insert>
</mapper>
\ No newline at end of file
src/main/resources/mappings/modules/user/UserDao.xml
View file @
cce44d62
...
...
@@ -247,6 +247,41 @@
AND yc.del_flag = '0'
</select>
<select
id=
"getCardInfo"
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,
yb.bank_name AS bankName,
yb.bank_short AS bankShort,
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
LEFT JOIN youka_bank yb ON yc.belong_bank = yb.bank_code
WHERE
yc.user_code = #{subMerchantCode}
AND yc.code = #{cardCode}
AND yc.del_flag = '0'
LIMIT 1
</select>
<update
id=
"removeCards"
>
UPDATE
youka_cards
...
...
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