Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
ae6d9884
Commit
ae6d9884
authored
Mar 22, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信支付接口
parent
63b8ee92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
8 deletions
+87
-8
LicenceOrderApiServiceImpl.java
.../service/out/impl/licence/LicenceOrderApiServiceImpl.java
+18
-3
LicenceOrderController.java
...manage/web/controller/licence/LicenceOrderController.java
+69
-5
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/licence/LicenceOrderApiServiceImpl.java
View file @
ae6d9884
...
@@ -130,9 +130,24 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
...
@@ -130,9 +130,24 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override
@Override
public
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
params
)
{
public
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
params
)
{
logger
.
info
(
"接收企业微信回调参数:{}"
,
params
);
logger
.
info
(
"接收企业微信回调参数:{}"
,
JSON
.
toJSONString
(
params
));
if
(
StrUtil
.
isBlank
(
params
)){
return
ServiceResponse
.
success
(
false
);
}
JSONObject
object
=
JSONObject
.
parseObject
(
params
,
JSONObject
.
class
);
String
infoType
=
object
.
getString
(
"infoType"
);
String
openCorpId
=
object
.
getString
(
"openCorpId"
);
String
orderId
=
object
.
getString
(
"orderId"
);
String
timeStamp
=
object
.
getString
(
"timeStamp"
);
Integer
orderStatus
=
object
.
getInteger
(
"orderStatus"
);
String
buyerUserId
=
object
.
getString
(
"buyerUserId"
);
if
(
"license_pay_success"
.
equals
(
infoType
)){
//支付回调
return
null
;
}
if
(
"license_refund"
.
equals
(
infoType
)){
//退款回调
}
return
ServiceResponse
.
success
(
true
);
}
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/licence/LicenceOrderController.java
View file @
ae6d9884
...
@@ -3,11 +3,14 @@ package com.gic.haoban.manage.web.controller.licence;
...
@@ -3,11 +3,14 @@ package com.gic.haoban.manage.web.controller.licence;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
...
@@ -25,6 +28,12 @@ import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
...
@@ -25,6 +28,12 @@ import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
import
com.gic.haoban.manage.web.qo.licence.LicenceOrderQO
;
import
com.gic.haoban.manage.web.qo.licence.LicenceOrderQO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderVO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderVO
;
import
com.gic.marketing.api.dto.AccountChargeInfoDTO
;
import
com.gic.marketing.api.enums.AccountChargeSceneEnum
;
import
com.gic.marketing.api.service.EnterpriseAccountInfoApiService
;
import
com.gic.thirdparty.api.dto.ScanPayReqDataDTO
;
import
com.gic.thirdparty.api.service.Pay4WXService
;
import
com.gic.thirdparty.api.service.RechargeCenterService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -34,7 +43,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -34,7 +43,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* 企业微信许可账号购买
* 企业微信许可账号购买
...
@@ -53,7 +65,12 @@ public class LicenceOrderController {
...
@@ -53,7 +65,12 @@ public class LicenceOrderController {
private
EnterpriseService
enterpriseService
;
private
EnterpriseService
enterpriseService
;
@Autowired
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
EnterpriseAccountInfoApiService
enterpriseAccountInfoApiService
;
@Autowired
private
Pay4WXService
pay4WXService
;
@Autowired
private
RechargeCenterService
rechargeCenterService
;
/**
/**
* 查询订单详情
* 查询订单详情
*/
*/
...
@@ -156,16 +173,63 @@ public class LicenceOrderController {
...
@@ -156,16 +173,63 @@ public class LicenceOrderController {
/**
/**
* 支付订单
* 支付订单
*/
*/
@RequestMapping
(
"licence-order-pay"
)
@RequestMapping
(
"licence-order-pay
-1
"
)
public
RestResponse
<
Boolean
>
payLicenceOrder
(
@RequestParam
Long
orderId
)
{
public
RestResponse
<
Map
<
String
,
Object
>>
payLicenceOrder
(
@RequestParam
Long
orderId
,
@RequestParam
(
defaultValue
=
"0"
)
int
accountType
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
}
Boolean
result
=
licenceOrderApiService
.
payLicenceOrder
(
orderId
).
getResult
();
LicenceOrderDTO
result
=
licenceOrderApiService
.
getLicenceOrderDetail
(
orderId
,
1
).
getResult
();
return
RestResponse
.
successResult
(
result
);
if
(
result
==
null
){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_5
.
getCode
()),
HaoBanErrCode
.
ERR_5
.
getMsg
());
}
Integer
money
=
result
.
getPrice
();
// 交易订单号
String
transactionCode
=
ToolUtil
.
randomStringByTime
();
ScanPayReqDataDTO
scanPayReqData
=
new
ScanPayReqDataDTO
(
"好办平台企业微信许可账号购买"
,
loginUser
.
getEnterpriseId
(),
transactionCode
,
money
,
DateUtil
.
dateToStr
(
new
Date
(),
DateUtil
.
FORMAT_DATETIME_14
),
""
,
"NATIVE"
);
String
accountDepartId
=
""
;
if
(
accountType
==
0
)
{
AccountChargeInfoDTO
dto
=
this
.
enterpriseAccountInfoApiService
.
getAccountDeparment
(
loginUser
.
getEnterpriseId
(),
AccountChargeSceneEnum
.
creator_only
,
null
,
loginUser
.
getClerkId
())
;
logger
.
info
(
"充值账号信息={}"
,
dto
);
accountDepartId
=
dto
.
getAccountDepartId
()
;
}
if
(
accountType
==
1
)
{
accountDepartId
=
"1"
;
}
scanPayReqData
.
setAccountType
(
accountType
);
scanPayReqData
.
setAccountDepartId
(
accountDepartId
);
//二维码
String
url
=
pay4WXService
.
createPrePaymentOrderForWX
(
scanPayReqData
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"transactionCode"
,
transactionCode
);
map
.
put
(
"url"
,
url
);
map
.
put
(
"money"
,
money
);
// TODO: 2023/3/21 记录订单号transactionCode
return
RestResponse
.
successResult
(
map
);
}
}
/**
/**
* 支付订单-判断是否支付成功
*/
@RequestMapping
(
"licence-order-pay-2"
)
public
RestResponse
<
Boolean
>
payLicenceOrder2
(
@RequestParam
String
transactionCode
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
if
(
StrUtil
.
isBlank
(
transactionCode
)){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_5
.
getCode
()),
HaoBanErrCode
.
ERR_5
.
getMsg
());
}
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"enterpriseId"
,
loginUser
.
getEnterpriseId
());
params
.
put
(
"out_trade_no"
,
transactionCode
);
boolean
flag
=
rechargeCenterService
.
isRechargeSuccess
(
params
);
logger
.
info
(
"定时刷新(判断是否充值成功) FLAG====> [{}]"
,
flag
);
return
RestResponse
.
successResult
(
flag
);
}
/**
* 查询企业品牌名称
* 查询企业品牌名称
*/
*/
@RequestMapping
(
"get-enterprise-name"
)
@RequestMapping
(
"get-enterprise-name"
)
...
...
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