Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
16faaf18
Commit
16faaf18
authored
Feb 05, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分销商订单显示倒计时、新增用户头像
parent
f4663441
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
133 additions
and
59 deletions
+133
-59
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayAutoCertificateConfig.java
...om/wwdz/ch/core/api/wxpay/WxPayAutoCertificateConfig.java
+5
-7
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayProperties.java
...main/java/com/wwdz/ch/core/api/wxpay/WxPayProperties.java
+28
-1
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayServiceApi.java
...main/java/com/wwdz/ch/core/api/wxpay/WxPayServiceApi.java
+57
-51
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
+6
-0
ch-core/src/main/resources/application-dev.yml
ch-core/src/main/resources/application-dev.yml
+2
-0
ch-core/src/main/resources/application-prod.yml
ch-core/src/main/resources/application-prod.yml
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DistributionOrderRequestDto.java
...dto/request/distribution/DistributionOrderRequestDto.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
...wdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+11
-0
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
+12
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayAutoCertificateConfig.java
View file @
16faaf18
...
@@ -7,12 +7,9 @@ import org.slf4j.LoggerFactory;
...
@@ -7,12 +7,9 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.ClassPathResource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.security.PrivateKey
;
import
java.security.PrivateKey
;
...
@@ -22,7 +19,7 @@ public class WxPayAutoCertificateConfig {
...
@@ -22,7 +19,7 @@ public class WxPayAutoCertificateConfig {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxPayAutoCertificateConfig
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxPayAutoCertificateConfig
.
class
);
@Autowired
@Autowired
WxPayP
aramConfig
wxPayParamConfig
;
WxPayP
roperties
wxPayProperties
;
/**
/**
...
@@ -32,14 +29,15 @@ public class WxPayAutoCertificateConfig {
...
@@ -32,14 +29,15 @@ public class WxPayAutoCertificateConfig {
@Bean
@Bean
public
RSAAutoCertificateConfig
rsaAutoCertificateConfig
()
{
public
RSAAutoCertificateConfig
rsaAutoCertificateConfig
()
{
RSAAutoCertificateConfig
config
=
new
RSAAutoCertificateConfig
.
Builder
()
RSAAutoCertificateConfig
config
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
wxPayP
aramConfig
.
getMerchantId
())
.
merchantId
(
wxPayP
roperties
.
getMerchantId
())
.
privateKey
(
getPrivateKey
())
.
privateKey
(
getPrivateKey
())
.
merchantSerialNumber
(
wxPayP
aramConfig
.
getMerchantSerialNumber
())
.
merchantSerialNumber
(
wxPayP
roperties
.
getMerchantSerialNumber
())
.
apiV3Key
(
wxPayP
aramConfig
.
getApiV3Key
())
.
apiV3Key
(
wxPayP
roperties
.
getApiV3Key
())
.
build
();
.
build
();
return
config
;
return
config
;
}
}
public
PrivateKey
getPrivateKey
()
{
public
PrivateKey
getPrivateKey
()
{
try
{
try
{
PrivateKey
privateKey
=
PemUtil
.
loadPrivateKey
(
new
ClassPathResource
(
"apiclient_key.pem"
).
getInputStream
());
PrivateKey
privateKey
=
PemUtil
.
loadPrivateKey
(
new
ClassPathResource
(
"apiclient_key.pem"
).
getInputStream
());
...
...
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayP
aramConfig
.java
→
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayP
roperties
.java
View file @
16faaf18
...
@@ -5,7 +5,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -5,7 +5,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@Configuration
@ConfigurationProperties
(
prefix
=
"dts.wx-pay"
)
@ConfigurationProperties
(
prefix
=
"dts.wx-pay"
)
public
class
WxPayP
aramConfig
{
public
class
WxPayP
roperties
{
/**
/**
* APPID
* APPID
...
@@ -42,6 +42,33 @@ public class WxPayParamConfig {
...
@@ -42,6 +42,33 @@ public class WxPayParamConfig {
*/
*/
private
String
privateKeyPath
;
private
String
privateKeyPath
;
/**
* p12证书的位置
*/
private
String
p12KeyPath
;
/**
* JSAPI--公众号支付
*/
private
String
tradeType
;
public
String
getP12KeyPath
()
{
return
p12KeyPath
;
}
public
void
setP12KeyPath
(
String
p12KeyPath
)
{
this
.
p12KeyPath
=
p12KeyPath
;
}
public
String
getTradeType
()
{
return
tradeType
;
}
public
void
setTradeType
(
String
tradeType
)
{
this
.
tradeType
=
tradeType
;
}
public
String
getAppId
()
{
public
String
getAppId
()
{
return
appId
;
return
appId
;
}
}
...
...
ch-core/src/main/java/com/wwdz/ch/core/api/wxpay/WxPayServiceApi.java
View file @
16faaf18
...
@@ -2,6 +2,9 @@ package com.wwdz.ch.core.api.wxpay;
...
@@ -2,6 +2,9 @@ package com.wwdz.ch.core.api.wxpay;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.binarywang.wxpay.bean.request.WxPayRefundRequest
;
import
com.github.binarywang.wxpay.bean.request.WxPayRefundRequest
;
import
com.github.binarywang.wxpay.bean.result.WxPayRefundResult
;
import
com.github.binarywang.wxpay.service.WxPayService
;
import
com.github.binarywang.wxpay.service.impl.WxPayServiceImpl
;
import
com.wechat.pay.contrib.apache.httpclient.util.PemUtil
;
import
com.wechat.pay.contrib.apache.httpclient.util.PemUtil
;
import
com.wechat.pay.java.core.RSAAutoCertificateConfig
;
import
com.wechat.pay.java.core.RSAAutoCertificateConfig
;
import
com.wechat.pay.java.core.exception.HttpException
;
import
com.wechat.pay.java.core.exception.HttpException
;
...
@@ -10,11 +13,19 @@ import com.wechat.pay.java.core.exception.ServiceException;
...
@@ -10,11 +13,19 @@ import com.wechat.pay.java.core.exception.ServiceException;
import
com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension
;
import
com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension
;
import
com.wechat.pay.java.service.payments.jsapi.model.*
;
import
com.wechat.pay.java.service.payments.jsapi.model.*
;
import
com.wechat.pay.java.service.payments.model.Transaction
;
import
com.wechat.pay.java.service.payments.model.Transaction
;
import
com.wechat.pay.java.service.refund.RefundService
;
import
com.wechat.pay.java.service.refund.model.AmountReq
;
import
com.wechat.pay.java.service.refund.model.CreateRequest
;
import
com.wechat.pay.java.service.refund.model.Refund
;
import
com.wechat.pay.java.service.refund.model.Status
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.UUID
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.StringUtils
;
import
com.xxdxxs.utils.StringUtils
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -32,11 +43,13 @@ public class WxPayServiceApi {
...
@@ -32,11 +43,13 @@ public class WxPayServiceApi {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxPayServiceApi
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxPayServiceApi
.
class
);
@Autowired
@Autowired
WxPayP
aramConfig
wxPayParamConfig
;
WxPayP
roperties
wxPayProperties
;
@Autowired
@Autowired
RSAAutoCertificateConfig
rsaAutoCertificateConfig
;
RSAAutoCertificateConfig
rsaAutoCertificateConfig
;
/* @Autowired
WxPayService wxPayService;*/
/**
/**
* 创建预支付订单
* 创建预支付订单
...
@@ -51,13 +64,13 @@ public class WxPayServiceApi {
...
@@ -51,13 +64,13 @@ public class WxPayServiceApi {
.
build
();
.
build
();
try
{
try
{
PrepayRequest
request
=
new
PrepayRequest
();
PrepayRequest
request
=
new
PrepayRequest
();
request
.
setAppid
(
wxPayP
aramConfig
.
getAppId
());
request
.
setAppid
(
wxPayP
roperties
.
getAppId
());
request
.
setMchid
(
wxPayP
aramConfig
.
getMerchantId
());
request
.
setMchid
(
wxPayP
roperties
.
getMerchantId
());
//商品描述
//商品描述
request
.
setDescription
(
dto
.
getItemName
());
request
.
setDescription
(
dto
.
getItemName
());
//商户订单号
//商户订单号
request
.
setOutTradeNo
(
dto
.
getDistributionOrderId
());
request
.
setOutTradeNo
(
dto
.
getDistributionOrderId
());
request
.
setNotifyUrl
(
wxPayP
aramConfig
.
getPayNotifyUrl
());
request
.
setNotifyUrl
(
wxPayP
roperties
.
getPayNotifyUrl
());
Amount
amount
=
new
Amount
();
Amount
amount
=
new
Amount
();
//单位为分,参数中的amount需要乘以过100
//单位为分,参数中的amount需要乘以过100
amount
.
setTotal
(
new
BigDecimal
(
dto
.
getAmount
()).
intValue
());
amount
.
setTotal
(
new
BigDecimal
(
dto
.
getAmount
()).
intValue
());
...
@@ -92,7 +105,7 @@ public class WxPayServiceApi {
...
@@ -92,7 +105,7 @@ public class WxPayServiceApi {
*/
*/
public
Result
queryOrderByTransactionId
(
DistributionOrderRequestDto
dto
)
{
public
Result
queryOrderByTransactionId
(
DistributionOrderRequestDto
dto
)
{
QueryOrderByIdRequest
queryRequest
=
new
QueryOrderByIdRequest
();
QueryOrderByIdRequest
queryRequest
=
new
QueryOrderByIdRequest
();
queryRequest
.
setMchid
(
wxPayP
aramConfig
.
getMerchantId
());
queryRequest
.
setMchid
(
wxPayP
roperties
.
getMerchantId
());
queryRequest
.
setTransactionId
(
dto
.
getPaymentId
());
queryRequest
.
setTransactionId
(
dto
.
getPaymentId
());
try
{
try
{
JsapiServiceExtension
service
=
JsapiServiceExtension
service
=
...
@@ -118,7 +131,7 @@ public class WxPayServiceApi {
...
@@ -118,7 +131,7 @@ public class WxPayServiceApi {
*/
*/
public
Result
<
Transaction
>
queryOrderBytOutTradeNo
(
DistributionOrderRequestDto
dto
)
{
public
Result
<
Transaction
>
queryOrderBytOutTradeNo
(
DistributionOrderRequestDto
dto
)
{
QueryOrderByOutTradeNoRequest
queryRequest
=
new
QueryOrderByOutTradeNoRequest
();
QueryOrderByOutTradeNoRequest
queryRequest
=
new
QueryOrderByOutTradeNoRequest
();
queryRequest
.
setMchid
(
wxPayP
aramConfig
.
getMerchantId
());
queryRequest
.
setMchid
(
wxPayP
roperties
.
getMerchantId
());
queryRequest
.
setOutTradeNo
(
dto
.
getDistributionOrderId
());
queryRequest
.
setOutTradeNo
(
dto
.
getDistributionOrderId
());
try
{
try
{
JsapiServiceExtension
service
=
JsapiServiceExtension
service
=
...
@@ -158,16 +171,16 @@ public class WxPayServiceApi {
...
@@ -158,16 +171,16 @@ public class WxPayServiceApi {
long
timestamp
=
System
.
currentTimeMillis
()
/
1000
;
long
timestamp
=
System
.
currentTimeMillis
()
/
1000
;
String
nonceStr
=
generateNonceStr
();
String
nonceStr
=
generateNonceStr
();
//加载签名
//加载签名
String
packageSign
=
sign
(
buildMessage
(
wxPayP
aramConfig
.
getAppId
(),
timestamp
,
nonceStr
,
prepayId
).
getBytes
(),
wxPayParamConfig
.
getPrivateKeyPath
());
String
packageSign
=
sign
(
buildMessage
(
wxPayP
roperties
.
getAppId
(),
timestamp
,
nonceStr
,
prepayId
).
getBytes
(),
wxPayProperties
.
getPrivateKeyPath
());
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"appId"
,
wxPayP
aramConfig
.
getAppId
());
jsonObject
.
put
(
"appId"
,
wxPayP
roperties
.
getAppId
());
jsonObject
.
put
(
"prepayid"
,
prepayId
);
jsonObject
.
put
(
"prepayid"
,
prepayId
);
jsonObject
.
put
(
"timeStamp"
,
String
.
valueOf
(
timestamp
));
jsonObject
.
put
(
"timeStamp"
,
String
.
valueOf
(
timestamp
));
jsonObject
.
put
(
"nonceStr"
,
nonceStr
);
jsonObject
.
put
(
"nonceStr"
,
nonceStr
);
jsonObject
.
put
(
"package"
,
"prepay_id="
+
prepayId
);
jsonObject
.
put
(
"package"
,
"prepay_id="
+
prepayId
);
jsonObject
.
put
(
"signType"
,
"RSA"
);
jsonObject
.
put
(
"signType"
,
"RSA"
);
jsonObject
.
put
(
"paySign"
,
packageSign
);
jsonObject
.
put
(
"paySign"
,
packageSign
);
jsonObject
.
put
(
"partnerId"
,
wxPayP
aramConfig
.
getMerchantId
());
jsonObject
.
put
(
"partnerId"
,
wxPayP
roperties
.
getMerchantId
());
return
Result
.
success
(
jsonObject
);
return
Result
.
success
(
jsonObject
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -215,50 +228,43 @@ public class WxPayServiceApi {
...
@@ -215,50 +228,43 @@ public class WxPayServiceApi {
}
}
/* public Result rebackPay(String orderNo,Integer amount){
/**
//微信支付-申请退款请求参数
* 微信支付申请退款
WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
* @param dto
WxPayRefundV3Request.Amount am = new WxPayRefundV3Request.Amount();
* @return
am.setTotal(amount);//原订单金额
*/
//退款币种
public
Result
refund
(
DistributionOrderRequestDto
dto
){
am.setCurrency("CNY");
//退款金额 单位为分
am.setRefund(amount);
//金额信息
request.setAmount(am);
//transaction_id:微信支付订单号
request.setTransactionId(orderNo);
//商户订单号
request.setOutRefundNo("return_"+orderNo);
request.setNotifyUrl(this.wxPayService.getConfig().getPayScoreNotifyUrl()); //设置回调地址
WxPayRefundV3Result result;
try
{
try
{
//调用微信V3退款API
// 构建退款service
result = wxPayService.refundV3(request);
RefundService
service
=
new
RefundService
.
Builder
().
config
(
rsaAutoCertificateConfig
).
build
();
String status = result.getStatus();
//构建退款请求
switch (status) {
CreateRequest
request
=
new
CreateRequest
();
case "SUCCESS":
//构建订单金额信息
res.success("退款成功");
AmountReq
amountReq
=
new
AmountReq
();
break;
//退款金额
case "CLOSED":
amountReq
.
setRefund
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getRefundPrice
()));
res.success("退款关闭");
//原订单金额
break;
amountReq
.
setTotal
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getAmount
()));
case "PROCESSING":
//货币类型(默认人民币)
res.success("退款处理中");
amountReq
.
setCurrency
(
"CNY"
);
break;
//商户系统单号
case "ABNORMAL":
request
.
setOutTradeNo
(
dto
.
getDistributionOrderId
());
res.success("退款异常");
request
.
setAmount
(
amountReq
);
break;
//商户退款单号
default:
request
.
setOutRefundNo
(
UUID
.
randomUUID
().
toString
(
true
));
res.error("受理失败");
//退款通知回调地址
break;
request
.
setNotifyUrl
(
null
);
Refund
refundResponse
=
service
.
create
(
request
);
logger
.
info
(
"微信申请退款接口返回:{}"
,
JsonUtils
.
from
(
refundResponse
));
if
(
refundResponse
.
getStatus
().
equals
(
Status
.
SUCCESS
)){
//说明退款成功,开始接下来的业务操作
//你的业务代码
}
}
res.setResult(result);
return
Result
.
success
();
} catch (Exception e) {
}
catch
(
Exception
e
){
e.printStackTrace();
logger
.
error
(
"微信退款接口错误error : {}"
,
e
);
res.error("申请退款失败,"+e.getMessage());
}
}
return
res
;
return
Result
.
failed
()
;
}
}
*/
}
}
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
View file @
16faaf18
...
@@ -26,6 +26,12 @@ public class PriceUtil {
...
@@ -26,6 +26,12 @@ public class PriceUtil {
return
bigDecimal
.
longValue
();
return
bigDecimal
.
longValue
();
}
}
public
static
Integer
convertPriceFromStrToInt
(
String
price
){
BigDecimal
bigDecimal
=
new
BigDecimal
(
price
);
bigDecimal
=
bigDecimal
.
multiply
(
new
BigDecimal
(
100
));
return
bigDecimal
.
intValue
();
}
public
static
String
convertDoubleToString
(
Double
price
){
public
static
String
convertDoubleToString
(
Double
price
){
BigDecimal
bigDecimal
=
new
BigDecimal
(
String
.
valueOf
(
price
/
100
));
BigDecimal
bigDecimal
=
new
BigDecimal
(
String
.
valueOf
(
price
/
100
));
DecimalFormat
df
=
new
DecimalFormat
(
"#0.00"
);
DecimalFormat
df
=
new
DecimalFormat
(
"#0.00"
);
...
...
ch-core/src/main/resources/application-dev.yml
View file @
16faaf18
...
@@ -39,6 +39,8 @@ dts:
...
@@ -39,6 +39,8 @@ dts:
apiV3Key
:
7e9504fd8a5c458ab7466b8aaae462a9
apiV3Key
:
7e9504fd8a5c458ab7466b8aaae462a9
payNotifyUrl
:
https://cjxc-applet-dev.wanwudezhi.com/wxPayCallback/getPayNotify
payNotifyUrl
:
https://cjxc-applet-dev.wanwudezhi.com/wxPayCallback/getPayNotify
privateKeyPath
:
apiclient_key.pem
privateKeyPath
:
apiclient_key.pem
p12KeyPath
:
apiclient_cert.p12
tradeType
:
JSAPI
#腾讯IM配置
#腾讯IM配置
...
...
ch-core/src/main/resources/application-prod.yml
View file @
16faaf18
...
@@ -31,6 +31,8 @@ dts:
...
@@ -31,6 +31,8 @@ dts:
apiV3Key
:
7e9504fd8a5c458ab7466b8aaae462a9
apiV3Key
:
7e9504fd8a5c458ab7466b8aaae462a9
payNotifyUrl
:
https://cjxc-applet.wanwudezhi.com/wxPayCallback/getPayNotify
payNotifyUrl
:
https://cjxc-applet.wanwudezhi.com/wxPayCallback/getPayNotify
privateKeyPath
:
apiclient_key.pem
privateKeyPath
:
apiclient_key.pem
p12KeyPath
:
apiclient_cert.p12
tradeType
:
JSAPI
#腾讯IM配置
#腾讯IM配置
im
:
im
:
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DistributionOrderRequestDto.java
View file @
16faaf18
...
@@ -122,4 +122,9 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit
...
@@ -122,4 +122,9 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit
* 预支付单号
* 预支付单号
*/
*/
private
String
prepayId
;
private
String
prepayId
;
/**
* 要退款的金额
*/
private
String
refundPrice
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
View file @
16faaf18
...
@@ -54,6 +54,11 @@ public class DistributionOrderVo implements Entity {
...
@@ -54,6 +54,11 @@ public class DistributionOrderVo implements Entity {
*/
*/
private
String
buyerName
;
private
String
buyerName
;
/**
* 买家名称
*/
private
String
buyerAvatar
;
/**
/**
* 店铺id
* 店铺id
*/
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
16faaf18
...
@@ -220,8 +220,14 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
...
@@ -220,8 +220,14 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderVo
.
setAmount
(
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
()));
distributionOrderVo
.
setAmount
(
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
()));
distributionOrderVo
.
setItemPrice
(
PriceUtil
.
convertPriceFenToYuan
(
itemPrice
));
distributionOrderVo
.
setItemPrice
(
PriceUtil
.
convertPriceFenToYuan
(
itemPrice
));
distributionOrderVo
.
setBuyerName
(
cacheUtil
.
getAppletUserNameById
(
distributionOrder
.
getBuyerId
()));
distributionOrderVo
.
setBuyerName
(
cacheUtil
.
getAppletUserNameById
(
distributionOrder
.
getBuyerId
()));
distributionOrderVo
.
setBuyerAvatar
(
cacheUtil
.
getAppletUserList
(
distributionOrder
.
getBuyerId
())
==
null
?
""
:
cacheUtil
.
getAppletUsers
(
distributionOrder
.
getBuyerId
()).
getAvatar
());
distributionOrderVo
.
setStateName
(
DistributionEnum
.
DistributionOrderStateEnum
.
getNameByCode
(
distributionOrder
.
getState
()));
distributionOrderVo
.
setStateName
(
DistributionEnum
.
DistributionOrderStateEnum
.
getNameByCode
(
distributionOrder
.
getState
()));
distributionOrderVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
distributionOrderVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
//支付截止时间,下单后2小时内
Date
date
=
distributionOrder
.
getCreateTime
();
Instant
instant
=
date
.
toInstant
().
plus
(
Duration
.
ofHours
(
2
));
Date
time
=
Date
.
from
(
instant
);
distributionOrderVo
.
setPayEndTime
(
time
);
distributionOrderVoList
.
add
(
distributionOrderVo
);
distributionOrderVoList
.
add
(
distributionOrderVo
);
});
});
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
distributionOrderVoList
));
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
distributionOrderVoList
));
...
@@ -257,6 +263,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
...
@@ -257,6 +263,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderDetailVo
.
setChannelCost
(
PriceUtil
.
convertDoubleToString
(
channelCost
));
distributionOrderDetailVo
.
setChannelCost
(
PriceUtil
.
convertDoubleToString
(
channelCost
));
//利润
//利润
Double
profit
=
distributionOrder
.
getAmount
().
doubleValue
()
-
distributionTotalPrice
.
doubleValue
()
-
channelCost
;
Double
profit
=
distributionOrder
.
getAmount
().
doubleValue
()
-
distributionTotalPrice
.
doubleValue
()
-
channelCost
;
//支付截止时间,下单后2小时内
Date
date
=
distributionOrder
.
getCreateTime
();
Instant
instant
=
date
.
toInstant
().
plus
(
Duration
.
ofHours
(
2
));
Date
time
=
Date
.
from
(
instant
);
distributionOrderDetailVo
.
setPayEndTime
(
time
);
distributionOrderDetailVo
.
setProfit
(
PriceUtil
.
convertDoubleToString
(
profit
));
distributionOrderDetailVo
.
setProfit
(
PriceUtil
.
convertDoubleToString
(
profit
));
return
Result
.
success
(
distributionOrderDetailVo
);
return
Result
.
success
(
distributionOrderDetailVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
View file @
16faaf18
...
@@ -32,5 +32,17 @@ public class WxPayServiceTest {
...
@@ -32,5 +32,17 @@ public class WxPayServiceTest {
}
}
@Test
public
void
refund
()
{
String
orderId
=
"DA2402051545434693338"
;
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setAmount
(
"0.1"
);
dto
.
setRefundPrice
(
"0.1"
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
}
}
}
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