Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
f2385f3e
Commit
f2385f3e
authored
Aug 29, 2024
by
YG8429
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
096c9769
8cb185e9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
193 additions
and
2 deletions
+193
-2
PayConstants.java
...mon/src/main/java/share/common/constant/PayConstants.java
+4
-0
pom.xml
share-system/pom.xml
+6
-0
WithdrawLog.java
...system/src/main/java/share/system/domain/WithdrawLog.java
+117
-0
WechatNewService.java
.../src/main/java/share/system/service/WechatNewService.java
+2
-0
MqttxServiceImpl.java
...main/java/share/system/service/impl/MqttxServiceImpl.java
+6
-2
WechatNewServiceImpl.java
.../java/share/system/service/impl/WechatNewServiceImpl.java
+58
-0
No files found.
share-common/src/main/java/share/common/constant/PayConstants.java
View file @
f2385f3e
...
...
@@ -47,4 +47,8 @@ public class PayConstants {
// 扫呗支付回调地址
public
static
final
String
SAOBEI_PAY_NOTIFY_API_URI
=
"/prod-api/admin/payment/callback/saobei/wechat"
;
// 微信商家给用户转账到零钱-回调地址
public
static
final
String
WX_INITIATEBATCHTRANSFER_NOTIFY_API_URI
=
"/prod-api/admin/payment/callback/wechat/initiateBatchTransfer"
;
}
share-system/pom.xml
View file @
f2385f3e
...
...
@@ -156,5 +156,10 @@
<artifactId>
cron-utils
</artifactId>
<version>
9.1.3
</version>
</dependency>
<dependency>
<groupId>
com.github.wechatpay-apiv3
</groupId>
<artifactId>
wechatpay-java
</artifactId>
<version>
0.2.14
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
share-system/src/main/java/share/system/domain/WithdrawLog.java
0 → 100644
View file @
f2385f3e
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 提现记录对象 s_withdraw_log
*
* @author lwj
* @date 2024-08-28
*/
@Data
public
class
WithdrawLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/** 提现用户ID */
@Excel
(
name
=
"提现用户ID"
)
private
Long
consumerId
;
/** 提现金额 */
@Excel
(
name
=
"提现金额"
)
private
BigDecimal
amount
;
/** 状态:1-提现申请,2-审核通过,3-审核不通过,4-已撤销,5-交易成功,6-交易失败 */
@Excel
(
name
=
"状态"
)
private
Integer
status
;
/** 提现订单号,系统自动生成的 */
@Excel
(
name
=
"提现订单号"
)
private
String
withdrawOrder
;
/** 提现手续费 */
@Excel
(
name
=
"提现手续费"
)
private
BigDecimal
withdrawCharge
;
/** 申请提现时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"申请提现时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
withdrawApplyTime
;
/** 提现备注 */
@Excel
(
name
=
"提现备注"
)
private
String
withdrawRemark
;
/** 提现方式:1-微信 */
@Excel
(
name
=
"提现方式:1-微信"
)
private
Integer
withdrawType
;
/** 是否删除 */
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
/** 微信转账场景 */
@Excel
(
name
=
"微信转账场景"
)
private
String
transferSceneId
;
/** 用户的openid */
@Excel
(
name
=
"用户的openid"
)
private
String
openid
;
/** 微信批次单号 */
@Excel
(
name
=
"微信批次单号"
)
private
String
batchId
;
/** 微信批次状态 */
@Excel
(
name
=
"微信批次状态"
)
private
String
batchStatus
;
/** 微信接口错误描述 */
@Excel
(
name
=
"微信接口错误描述"
)
private
String
errorDesc
;
/** 错误码 */
@Excel
(
name
=
"错误码"
)
private
String
errorCode
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"amount"
,
getAmount
())
.
append
(
"status"
,
getStatus
())
.
append
(
"withdrawOrder"
,
getWithdrawOrder
())
.
append
(
"withdrawCharge"
,
getWithdrawCharge
())
.
append
(
"withdrawApplyTime"
,
getWithdrawApplyTime
())
.
append
(
"withdrawRemark"
,
getWithdrawRemark
())
.
append
(
"withdrawType"
,
getWithdrawType
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"transferSceneId"
,
getTransferSceneId
())
.
append
(
"openid"
,
getOpenid
())
.
append
(
"batchId"
,
getBatchId
())
.
append
(
"batchStatus"
,
getBatchStatus
())
.
append
(
"errorDesc"
,
getErrorDesc
())
.
append
(
"errorCode"
,
getErrorCode
())
.
toString
();
}
}
share-system/src/main/java/share/system/service/WechatNewService.java
View file @
f2385f3e
...
...
@@ -3,6 +3,7 @@ package share.system.service;
import
com.alibaba.fastjson.JSONObject
;
import
share.common.enums.MessageReminderEnum
;
import
share.system.domain.SOrder
;
import
share.system.domain.WithdrawLog
;
import
share.system.domain.vo.*
;
import
share.system.response.WeChatJsSdkConfigResponse
;
...
...
@@ -192,4 +193,5 @@ public interface WechatNewService {
*/
WeChatPhoneNumberVo
getPhoneNumber
(
String
code
);
Boolean
initiateBatchTransfer
(
WithdrawLog
withdrawLog
);
}
share-system/src/main/java/share/system/service/impl/MqttxServiceImpl.java
View file @
f2385f3e
...
...
@@ -9,6 +9,8 @@ import cn.hutool.json.JSONArray;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
...
...
@@ -40,6 +42,8 @@ import java.util.stream.Collectors;
@Service
public
class
MqttxServiceImpl
implements
MqttxService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
MqttxServiceImpl
.
class
);
@Autowired
private
DeviceGatewayMapper
deviceGatewayMapper
;
@Autowired
...
...
@@ -148,7 +152,7 @@ public class MqttxServiceImpl implements MqttxService {
@Override
public
boolean
mqttReport
(
String
topic
,
String
payload
)
{
boolean
isSuccess
=
false
;
System
.
out
.
println
(
"cespayload: "
+
payload
);
log
.
info
(
"cespayload: "
+
payload
);
if
(
topic
.
endsWith
(
MqttReportType
.
getTopicStr
(
"batch_report"
)))
{
JSONObject
json
=
JSONUtil
.
parseObj
(
payload
);
if
(
json
.
size
()
>
0
)
{
...
...
@@ -757,7 +761,7 @@ public class MqttxServiceImpl implements MqttxService {
l
=
10L
-
betweenDay
;
}
}
System
.
out
.
println
(
"测试设备消息间隔:"
+
l
);
log
.
info
(
"测试设备消息间隔:"
+
l
);
// 异步执行
this
.
supplyAsync
(
l
,
vo
,
room
.
getStoreId
());
...
...
share-system/src/main/java/share/system/service/impl/WechatNewServiceImpl.java
View file @
f2385f3e
...
...
@@ -3,11 +3,18 @@ package share.system.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.crypto.SecureUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wechat.pay.java.core.Config
;
import
com.wechat.pay.java.core.RSAAutoCertificateConfig
;
import
com.wechat.pay.java.service.transferbatch.TransferBatchService
;
import
com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferRequest
;
import
com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferResponse
;
import
com.wechat.pay.java.service.transferbatch.model.TransferDetailInput
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -78,6 +85,11 @@ public class WechatNewServiceImpl implements WechatNewService {
@Value
(
"${wechat.miniprogram_state}"
)
private
String
miniprogramState
;
/**
* 获取域名
*/
@Value
(
"${api.domain}"
)
private
String
apiDomain
;
/**
* 获取公众号accessToken
...
...
@@ -1100,6 +1112,52 @@ public class WechatNewServiceImpl implements WechatNewService {
}
/**
* 微信商家给用户转账到零钱
* @param withdrawLog 提现记录
* @return
*/
@Override
public
Boolean
initiateBatchTransfer
(
WithdrawLog
withdrawLog
)
{
Config
config
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
weChatConfig
.
getMchId
())
// 商户号
.
privateKeyFromPath
(
"商户API私钥路径"
)
// 商户API私钥路径
.
merchantSerialNumber
(
"商户证书序列号"
)
// 商户证书序列号
.
apiV3Key
(
"商户APIV3密钥"
)
// 商户APIV3密钥
.
build
();
TransferBatchService
service
=
new
TransferBatchService
.
Builder
().
config
(
config
).
build
();
InitiateBatchTransferRequest
initiateBatchTransferRequest
=
new
InitiateBatchTransferRequest
();
initiateBatchTransferRequest
.
setAppid
(
weChatConfig
.
getAppId
());
initiateBatchTransferRequest
.
setOutBatchNo
(
withdrawLog
.
getWithdrawOrder
());
initiateBatchTransferRequest
.
setBatchName
(
withdrawLog
.
getWithdrawRemark
());
initiateBatchTransferRequest
.
setBatchRemark
(
withdrawLog
.
getWithdrawRemark
());
initiateBatchTransferRequest
.
setTotalAmount
(
NumberUtil
.
mul
(
withdrawLog
.
getAmount
(),
100
).
longValue
());
initiateBatchTransferRequest
.
setTotalNum
(
1
);
List
<
TransferDetailInput
>
transferDetailListList
=
new
ArrayList
<>();
{
TransferDetailInput
transferDetailInput
=
new
TransferDetailInput
();
transferDetailInput
.
setOutDetailNo
(
withdrawLog
.
getWithdrawOrder
());
transferDetailInput
.
setTransferAmount
(
NumberUtil
.
mul
(
withdrawLog
.
getAmount
(),
100
).
longValue
());
transferDetailInput
.
setTransferRemark
(
withdrawLog
.
getWithdrawRemark
());
transferDetailInput
.
setOpenid
(
withdrawLog
.
getOpenid
());
transferDetailListList
.
add
(
transferDetailInput
);
}
initiateBatchTransferRequest
.
setTransferDetailList
(
transferDetailListList
);
initiateBatchTransferRequest
.
setTransferSceneId
(
withdrawLog
.
getTransferSceneId
());
initiateBatchTransferRequest
.
setNotifyUrl
(
apiDomain
+
PayConstants
.
WX_INITIATEBATCHTRANSFER_NOTIFY_API_URI
);
InitiateBatchTransferResponse
response
=
service
.
initiateBatchTransfer
(
initiateBatchTransferRequest
);
if
(
response
!=
null
)
{
// 回填记录数据
withdrawLog
.
setBatchId
(
response
.
getBatchId
());
withdrawLog
.
setBatchStatus
(
response
.
getBatchStatus
());
return
Boolean
.
TRUE
;
}
else
{
return
Boolean
.
FALSE
;
}
}
/**
* 获取JS-SDK的签名
*
* @param nonceStr 随机字符串
...
...
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