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
69c3eac9
Commit
69c3eac9
authored
Mar 14, 2018
by
Java-聂换换
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
快捷支付
parent
cce44d62
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
390 additions
and
19 deletions
+390
-19
pom.xml
pom.xml
+7
-0
ComCode.java
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
+21
-2
PayApiController.java
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
+54
-0
PayApiDao.java
src/main/java/com/thinkgem/jeesite/modules/pay/dao/PayApiDao.java
+4
-0
QuickDto.java
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/dto/QuickDto.java
+113
-0
JuHeZhongPayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
+84
-0
PayApiService.java
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
+79
-16
UserApiService.java
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
+5
-0
PayApiDao.xml
src/main/resources/mappings/modules/pay/PayApiDao.xml
+23
-1
No files found.
pom.xml
View file @
69c3eac9
...
@@ -604,6 +604,13 @@
...
@@ -604,6 +604,13 @@
<scope>
system
</scope>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/UserAgentUtils-1.13.jar
</systemPath>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/UserAgentUtils-1.13.jar
</systemPath>
</dependency>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib -->
<dependency>
<groupId>
net.sf.json-lib
</groupId>
<artifactId>
json-lib
</artifactId>
<version>
2.4
</version>
</dependency>
<!-- 自定义jar依赖包
<!-- 自定义jar依赖包
<dependency>
<dependency>
...
...
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
View file @
69c3eac9
...
@@ -16,16 +16,35 @@ public class ComCode {
...
@@ -16,16 +16,35 @@ public class ComCode {
*/
*/
public
static
final
String
HOST
=
"http://pay.hezhongpay.com"
;
// 请求地址
public
static
final
String
HOST
=
"http://pay.hezhongpay.com"
;
// 请求地址
public
static
final
String
MERCHANT_ID
=
"100532502195879"
;
// 商户号
public
static
final
String
MERCHANT_ID
=
"100532502195879"
;
// 商户号
public
static
final
String
MERCHANT_KEY
=
"670993bf-dd22-4464-9d81-69595d36b794"
;
// 商户key
public
static
final
String
MERCHANT_KEY
=
"670993bf-dd22-4464-9d81-69595d36b794"
;
//"670993bf-dd22-4464-9d81-69595d36b794";
// 商户key
public
static
final
String
MERCHANT_SECRET
=
"289ada73-27db-49e0-b2ad-3ae1613a665a"
;
// 商户sescet
public
static
final
String
MERCHANT_SECRET
=
"289ada73-27db-49e0-b2ad-3ae1613a665a"
;
//"289ada73-27db-49e0-b2ad-3ae1613a665a";
// 商户sescet
public
static
final
String
MERCHANT_REG_URL
=
"/api/quick/merchant/apply"
;
// 注册商户
public
static
final
String
MERCHANT_REG_URL
=
"/api/quick/merchant/apply"
;
// 注册商户
public
static
final
String
ORDER_QUERY_URL
=
"/order/query"
;
// 查询订单
public
static
final
String
ORDER_QUERY_URL
=
"/order/query"
;
// 查询订单
public
static
final
String
SETTLE_UPDATE_URL
=
"/api/quick/settle/card/update"
;
// 修改结算卡信息
public
static
final
String
SETTLE_UPDATE_URL
=
"/api/quick/settle/card/update"
;
// 修改结算卡信息
public
static
final
String
MERCHANT_INFO_URL
=
"/api/quick/merchant/info"
;
// 查询商户费率
public
static
final
String
MERCHANT_INFO_URL
=
"/api/quick/merchant/info"
;
// 查询商户费率
public
static
final
String
RATE_UPDATE_URL
=
"/api/quick/merchant/update/rate"
;
// 修改商户费率
public
static
final
String
RATE_UPDATE_URL
=
"/api/quick/merchant/update/rate"
;
// 修改商户费率
public
static
final
String
QUICK_PAY_URL
=
"/api/quick/pre/pay"
;
// 快捷支付
public
static
final
String
QUICK_PAY_URL
=
"/api/quick/pre/pay"
;
// 快捷支付
public
static
final
String
NO_INTEGRAL_QUICK_PAY_URL
=
"/quick/pay"
;
// 无积分快捷支付
public
static
final
String
NO_INTEGRAL_ORDER_QUERY_URL
=
"/order/query"
;
// 查询订单
public
static
final
String
EXTRA_RATE
=
"200"
;
// 附加手续费(单位:分)
public
static
final
String
EXTRA_RATE
=
"200"
;
// 附加手续费(单位:分)
/**
* duolabao相关参数
*
*/
public
static
final
String
DLB_HOST
=
"https://openapi.duolabao.com"
;
// 店铺编号(需要用户提供)
public
static
final
String
DLB_ACCESSKEY
=
"333833aa029449efb8ba37535f7fcaef0ac244ff"
;
// 公钥
public
static
final
String
DLB_SECRETKEY
=
"a5dac3f968ee4f3d966eafe1f5f323afa668f9e5"
;
// 私钥
public
static
final
String
DLB_CUSTOMERNUM
=
"10001114513826266541863"
;
// 商户编号(需要用户提供)
public
static
final
String
DLB_SHOPNUM
=
"10001214653797401143127"
;
// 店铺编号(需要用户提供)
public
static
final
String
DLB_MACHINENUM
=
"10011014593073262477203"
;
// 虚拟机序列(根据商户编号或者店铺编号获得)
public
static
final
String
DLB_CREATE_URL
=
"/v1/customer/order/pay/create"
;
// 创建支付订单的接口
/**
/**
* 时间相关参数
* 时间相关参数
*/
*/
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
View file @
69c3eac9
...
@@ -2,13 +2,22 @@ package com.thinkgem.jeesite.modules.pay.api;
...
@@ -2,13 +2,22 @@ package com.thinkgem.jeesite.modules.pay.api;
import
com.thinkgem.jeesite.common.baseBean.Response
;
import
com.thinkgem.jeesite.common.baseBean.Response
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.modules.pay.entity.OrderEntity
;
import
com.thinkgem.jeesite.modules.pay.service.PayApiService
;
import
com.thinkgem.jeesite.modules.pay.service.PayApiService
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.util.Enumeration
;
/**
/**
* 支付相关
* 支付相关
*/
*/
...
@@ -40,4 +49,49 @@ public class PayApiController {
...
@@ -40,4 +49,49 @@ public class PayApiController {
}
}
@RequestMapping
(
"/notifyPay"
)
public
Response
notifyPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Response
responseRetrun
=
new
Response
();
//设置编码
try
{
request
.
setCharacterEncoding
(
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
responseRetrun
.
setMessage
(
"设置编码异常"
);
responseRetrun
.
setStatus
(
ComCode
.
STATUS_CODE_9998
);
return
responseRetrun
;
}
String
orderId
=
request
.
getParameter
(
"orderId"
);
OrderEntity
orderEntity
=
new
OrderEntity
();
orderEntity
.
setPayNo
(
orderId
);
try
{
orderEntity
=
payService
.
notifyPay
(
orderEntity
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
responseRetrun
.
setMessage
(
"回调异常"
);
responseRetrun
.
setStatus
(
ComCode
.
STATUS_CODE_9998
);
return
responseRetrun
;
}
//返回true 收到请求,停止通知
PrintWriter
write
=
null
;
try
{
write
=
response
.
getWriter
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
responseRetrun
.
setMessage
(
"输出异常"
);
responseRetrun
.
setStatus
(
ComCode
.
STATUS_CODE_9998
);
return
responseRetrun
;
}
write
.
print
(
"true"
);
write
.
flush
();
write
.
close
();
responseRetrun
.
setMessage
(
"ok"
);
responseRetrun
.
setStatus
(
ComCode
.
STATUS_CODE_9998
);
responseRetrun
.
setData
(
orderEntity
);
return
responseRetrun
;
}
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/dao/PayApiDao.java
View file @
69c3eac9
...
@@ -17,4 +17,8 @@ public interface PayApiDao {
...
@@ -17,4 +17,8 @@ public interface PayApiDao {
List
<
UserRateEntity
>
getSABUsers
(
String
[]
pathIds
);
List
<
UserRateEntity
>
getSABUsers
(
String
[]
pathIds
);
void
saveBenefitInfo
(
BenefitEntity
benefitEntity
);
void
saveBenefitInfo
(
BenefitEntity
benefitEntity
);
void
updateOrderStatus
(
OrderEntity
orderEntity
);
OrderEntity
getOrder
(
OrderEntity
orderEntity
);
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/dto/QuickDto.java
0 → 100644
View file @
69c3eac9
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
juhezhong
.
dto
;
import
java.math.BigDecimal
;
/**
* Created by lishi on 2017/11/12.
*/
public
class
QuickDto
extends
CommonDto
{
private
Integer
trxType
;
//交易类型 默认传2 T1(2,"T1"), D0(3,"D0");
private
String
bankNo
;
//支付银行卡号
private
String
frontUrl
;
//前台返回地址
private
String
certificateCode
;
//身份证号
private
String
settleBankName
;
//结算银行
private
String
settleBankNo
;
//结算银行卡号
private
String
name
;
//真实姓名
private
String
phone
;
//交易卡预留手机号
private
String
settleBankPhone
;
//结算卡手机号
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getSettleBankPhone
()
{
return
settleBankPhone
;
}
public
void
setSettleBankPhone
(
String
settleBankPhone
)
{
this
.
settleBankPhone
=
settleBankPhone
;
}
private
BigDecimal
userFee
;
public
BigDecimal
getUserFee
()
{
return
userFee
;
}
public
void
setUserFee
(
BigDecimal
userFee
)
{
this
.
userFee
=
userFee
;
}
public
Integer
getTrxType
()
{
return
trxType
;
}
public
void
setTrxType
(
Integer
trxType
)
{
this
.
trxType
=
trxType
;
}
public
String
getBankNo
()
{
return
bankNo
;
}
public
void
setBankNo
(
String
bankNo
)
{
this
.
bankNo
=
bankNo
;
}
@Override
public
String
getFrontUrl
()
{
return
frontUrl
;
}
@Override
public
void
setFrontUrl
(
String
frontUrl
)
{
this
.
frontUrl
=
frontUrl
;
}
public
String
getCertificateCode
()
{
return
certificateCode
;
}
public
void
setCertificateCode
(
String
certificateCode
)
{
this
.
certificateCode
=
certificateCode
;
}
public
String
getSettleBankName
()
{
return
settleBankName
;
}
public
void
setSettleBankName
(
String
settleBankName
)
{
this
.
settleBankName
=
settleBankName
;
}
public
String
getSettleBankNo
()
{
return
settleBankNo
;
}
public
void
setSettleBankNo
(
String
settleBankNo
)
{
this
.
settleBankNo
=
settleBankNo
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
View file @
69c3eac9
...
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.ApiQuickPayDto
;
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.dto.MerchantDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.CommonDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.QuickDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.HttpUtil
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.HttpUtil
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.SignUtils
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.SignUtils
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -82,4 +85,85 @@ public class JuHeZhongPayService {
...
@@ -82,4 +85,85 @@ public class JuHeZhongPayService {
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
QUICK_PAY_URL
,
params
);
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
QUICK_PAY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
return
JSONObject
.
parseObject
(
respStr
);
}
}
/**
* 快捷支付 无积分
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
quickPay
(
QuickDto
dto
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
System
.
out
.
println
(
params
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
System
.
out
.
println
(
signBefore
);
String
sign
=
SignUtils
.
sign
(
signBefore
,
ComCode
.
MERCHANT_SECRET
);
params
.
put
(
"sign"
,
sign
);
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
NO_INTEGRAL_QUICK_PAY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
/**
* 查询订单状态
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
query
(
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
.
ORDER_QUERY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
/**
* 查询订单状态 无积分
*
* @param dto
* @return
* @throws Exception
*/
public
JSONObject
query
(
CommonDto
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
.
NO_INTEGRAL_ORDER_QUERY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// ApiQuickPayDto request = new ApiQuickPayDto();
// request.setAmount(10L);
// request.setBody("23");
// request.setFrontUrl("");
// request.setNotifyUrl("");
// request.setType(0);
// request.setName("");
// request.setUrl("");
//
// JuHeZhongPayService juHeZhongPayService = new JuHeZhongPayService();
// System.out.println(juHeZhongPayService.quickPay(request).toString());
ApiQuickPayDto
dto
=
new
ApiQuickPayDto
();
dto
.
setOrderId
(
"Dy58WqJG3MmNpSpQMq3wKZV55OiO48asPzRp4YUBBZUsVEiow7q6CZTQqwrBTl4k"
);
dto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
dto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
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
.
ORDER_QUERY_URL
,
params
);
System
.
out
.
println
(
respStr
);
}
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
View file @
69c3eac9
...
@@ -2,6 +2,7 @@ package com.thinkgem.jeesite.modules.pay.service;
...
@@ -2,6 +2,7 @@ package com.thinkgem.jeesite.modules.pay.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.thinkgem.jeesite.common.baseBean.Request
;
import
com.thinkgem.jeesite.common.baseBean.Request
;
import
com.thinkgem.jeesite.common.config.Global
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.utils.DateUtils
;
import
com.thinkgem.jeesite.common.utils.DateUtils
;
import
com.thinkgem.jeesite.common.utils.IdGen
;
import
com.thinkgem.jeesite.common.utils.IdGen
;
...
@@ -9,9 +10,11 @@ import com.thinkgem.jeesite.modules.commonError.MyException;
...
@@ -9,9 +10,11 @@ import com.thinkgem.jeesite.modules.commonError.MyException;
import
com.thinkgem.jeesite.modules.pay.dao.PayApiDao
;
import
com.thinkgem.jeesite.modules.pay.dao.PayApiDao
;
import
com.thinkgem.jeesite.modules.pay.entity.BenefitEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.BenefitEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.OrderEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.OrderEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.RateEntity
;
import
com.thinkgem.jeesite.modules.pay.entity.UserRateEntity
;
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.ApiQuickPayDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.MerchantDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.MerchantDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.dto.QuickDto
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.service.JuHeZhongPayService
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.service.JuHeZhongPayService
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest
;
import
com.thinkgem.jeesite.modules.user.entity.CardEntity
;
import
com.thinkgem.jeesite.modules.user.entity.CardEntity
;
...
@@ -73,22 +76,57 @@ public class PayApiService {
...
@@ -73,22 +76,57 @@ public class PayApiService {
*/
*/
public
void
quickPayJuHeZhongPay
(
UserEntity
userEntity
,
OrderEntity
orderEntity
,
JuHeZhongPayRequest
request
)
throws
Exception
{
public
void
quickPayJuHeZhongPay
(
UserEntity
userEntity
,
OrderEntity
orderEntity
,
JuHeZhongPayRequest
request
)
throws
Exception
{
// 快捷支付
// 快捷支付
ApiQuickPayDto
quickPayDto
=
new
ApiQuickPayDto
();
// ApiQuickPayDto quickPayDto = new ApiQuickPayDto();
quickPayDto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
// quickPayDto.setMerchantId(ComCode.MERCHANT_ID);
quickPayDto
.
setOrderId
(
orderEntity
.
getPayCode
());
// 将订单的支付号传给第三方平台
// quickPayDto.setOrderId(orderEntity.getPayCode()); // 将订单的支付号传给第三方平台
quickPayDto
.
setSubMchId
(
userEntity
.
getUserDetail
().
getCard
().
getSubMerchantId
());
//子商户号
// quickPayDto.setSubMchId(userEntity.getUserDetail().getCard().getSubMerchantId());//子商户号
quickPayDto
.
setAmount
(
Long
.
parseLong
(
request
.
getAmount
()));
// quickPayDto.setAmount(Long.parseLong(request.getAmount()));
quickPayDto
.
setBody
(
request
.
getSubject
());
// quickPayDto.setBody(request.getSubject());
quickPayDto
.
setType
(
"D"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
5
:
(
"C"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
6
:
0
));
// quickPayDto.setType("D".equalsIgnoreCase(userEntity.getUserDetail().getCard().getCardType()) ? 5 : ("C".equalsIgnoreCase(userEntity.getUserDetail().getCard().getCardType()) ? 6 : 0));
quickPayDto
.
setAccName
(
userEntity
.
getUserDetail
().
getRealName
());
// quickPayDto.setAccName(userEntity.getUserDetail().getRealName());
quickPayDto
.
setAccNo
(
userEntity
.
getUserDetail
().
getCard
().
getCardNo
());
// quickPayDto.setAccNo(userEntity.getUserDetail().getCard().getCardNo());
quickPayDto
.
setMobile
(
userEntity
.
getUserDetail
().
getCard
().
getCardMobile
());
// quickPayDto.setMobile(userEntity.getUserDetail().getCard().getCardMobile());
quickPayDto
.
setIdNo
(
userEntity
.
getUserDetail
().
getIdCard
());
// quickPayDto.setIdNo(userEntity.getUserDetail().getIdCard());
quickPayDto
.
setFrontUrl
(
""
);
// 前台地址
//
quickPayDto
.
setNotifyUrl
(
""
);
// 通知url
//
quickPayDto
.
setTimestamp
(
System
.
currentTimeMillis
());
// quickPayDto.setAccName("聂换换");
quickPayDto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
// quickPayDto.setAccNo("6217000180000770507");
JSONObject
jsonObject
=
juHeZhongPayService
.
quickPay
(
quickPayDto
);
// quickPayDto.setMobile("13722537737");
// quickPayDto.setIdNo("130434199212214429");
// quickPayDto.setFrontUrl("");// 前台地址
// quickPayDto.setNotifyUrl("");// 通知url
// quickPayDto.setTimestamp(System.currentTimeMillis());
// quickPayDto.setMerchantKey(ComCode.MERCHANT_KEY);
QuickDto
quickDto
=
new
QuickDto
();
quickDto
.
setTrxType
(
3
);
quickDto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
quickDto
.
setOrderId
(
orderEntity
.
getPayCode
());
// 将订单的支付号传给第三方平台
quickDto
.
setAmount
(
Long
.
parseLong
(
request
.
getAmount
()));
quickDto
.
setBankNo
(
userEntity
.
getUserDetail
().
getCard
().
getCardNo
());
// 支付卡号
quickDto
.
setSettleBankName
(
userEntity
.
getUserDetail
().
getCard
().
getBelongBank
());
quickDto
.
setSettleBankNo
(
userEntity
.
getUserDetail
().
getIdCard
());
quickDto
.
setSettleBankPhone
(
userEntity
.
getUserDetail
().
getCard
().
getCardMobile
());
quickDto
.
setName
(
userEntity
.
getUserDetail
().
getRealName
());
quickDto
.
setCertificateCode
(
userEntity
.
getUserDetail
().
getIdCard
());
quickDto
.
setType
(
"D"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
5
:
(
"C"
.
equalsIgnoreCase
(
userEntity
.
getUserDetail
().
getCard
().
getCardType
())
?
6
:
0
));
RateEntity
rateEntity
=
new
RateEntity
();
rateEntity
.
setUserLevel
(
userEntity
.
getLevel
());
rateEntity
.
setPayMethod
(
"quick"
);
rateEntity
=
userService
.
getRateByLevel
(
rateEntity
);
if
(
rateEntity
!=
null
){
quickDto
.
setUserFee
(
new
BigDecimal
(
Long
.
parseLong
(
request
.
getAmount
())*
Double
.
valueOf
(
rateEntity
.
getRate
())));
// 手续费 单位:分 ,D0 业务必传
}
else
{
quickDto
.
setUserFee
(
new
BigDecimal
(
0
));
}
quickDto
.
setFrontUrl
(
Global
.
getConfig
(
"sys.pre.url"
)+
"/api/pay/notifyPay"
);
// 前台地址
quickDto
.
setNotifyUrl
(
Global
.
getConfig
(
"sys.pre.url"
)+
"/api/pay/notifyPay"
);
// 通知url
quickDto
.
setTimestamp
(
System
.
currentTimeMillis
());
quickDto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
JSONObject
jsonObject
=
juHeZhongPayService
.
quickPay
(
quickDto
);
if
(!
"0000"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
if
(!
"0000"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
}
}
...
@@ -133,4 +171,29 @@ public class PayApiService {
...
@@ -133,4 +171,29 @@ public class PayApiService {
return
userBenefit
;
return
userBenefit
;
}
}
/**
* 回调
* @param orderEntity
* @return
* @throws Exception
*/
public
OrderEntity
notifyPay
(
OrderEntity
orderEntity
)
throws
Exception
{
QuickDto
dto
=
new
QuickDto
();
dto
.
setOrderId
(
orderEntity
.
getPayNo
());
dto
.
setMerchantId
(
ComCode
.
MERCHANT_ID
);
dto
.
setMerchantKey
(
ComCode
.
MERCHANT_KEY
);
JSONObject
jsonObject
=
juHeZhongPayService
.
query
(
dto
);
// 支付成功
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
orderEntity
.
setPayStatus
(
"2"
);
payDao
.
updateOrderStatus
(
orderEntity
);
}
else
if
(
"0001"
.
equals
(
jsonObject
.
get
(
"code"
))){
// 支付失败
orderEntity
.
setPayStatus
(
"4"
);
payDao
.
updateOrderStatus
(
orderEntity
);
}
orderEntity
=
payDao
.
getOrder
(
orderEntity
);
return
orderEntity
;
}
}
}
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
View file @
69c3eac9
...
@@ -344,4 +344,9 @@ public class UserApiService {
...
@@ -344,4 +344,9 @@ public class UserApiService {
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
}
}
}
}
public
RateEntity
getRateByLevel
(
RateEntity
rateEntityParam
){
return
userDao
.
getRateByLevel
(
rateEntityParam
);
}
}
}
src/main/resources/mappings/modules/pay/PayApiDao.xml
View file @
69c3eac9
...
@@ -19,6 +19,11 @@
...
@@ -19,6 +19,11 @@
update_by
update_by
) VALUES (#{code}, #{userCode}, #{payNo}, #{payCode}, #{payChannel}, #{payStatus}, #{amount}, #{subject}, #{tradeNo}, #{payType}, #{cardCode}, #{createdUser}, #{modifiedUser})
) VALUES (#{code}, #{userCode}, #{payNo}, #{payCode}, #{payChannel}, #{payStatus}, #{amount}, #{subject}, #{tradeNo}, #{payType}, #{cardCode}, #{createdUser}, #{modifiedUser})
</insert>
</insert>
<update
id=
"updateOrderStatus"
>
UPDATE youka_orders
SET pay_status = #{payStatus}
WHERE pay_no = #{payNo}
</update>
<select
id=
"getCDEUsers"
resultType=
"com.thinkgem.jeesite.modules.pay.entity.UserRateEntity"
>
<select
id=
"getCDEUsers"
resultType=
"com.thinkgem.jeesite.modules.pay.entity.UserRateEntity"
>
SELECT
SELECT
...
@@ -57,9 +62,26 @@
...
@@ -57,9 +62,26 @@
ORDER BY recommended_path DESC
ORDER BY recommended_path DESC
LIMIT 3
LIMIT 3
</select>
</select>
<select
id=
"getOrder"
resultType=
"com.thinkgem.jeesite.modules.pay.entity.OrderEntity"
>
SELECT
code,
user_code,
pay_no,
pay_code,
pay_channel,
pay_status,
amount,
subject,
trade_no,
pay_type,
card_code
FROM youka_orders
WHERE pay_no = #{payNo}
</select>
<insert
id=
"saveBenefitInfo"
>
<insert
id=
"saveBenefitInfo"
>
INSERT INTO youka_
orders
(
INSERT INTO youka_
benefit
(
code,
code,
user_code,
user_code,
order_code,
order_code,
...
...
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