Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
lei
fzm-joying
Commits
84360ed7
Commit
84360ed7
authored
Mar 22, 2022
by
33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码,修复隐藏BUG
parent
aa10f76f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
18 deletions
+31
-18
AuthenticationInterceptor.java
...com/fzm/common/interceptor/AuthenticationInterceptor.java
+7
-6
CopyrightApplyServiceImpl.java
...om/fzm/common/service/impl/CopyrightApplyServiceImpl.java
+14
-8
OrderServiceImpl.java
...in/java/com/fzm/common/service/impl/OrderServiceImpl.java
+4
-1
WxPayServiceImpl.java
...in/java/com/fzm/common/service/impl/WxPayServiceImpl.java
+6
-3
No files found.
joying-common/src/main/java/com/fzm/common/interceptor/AuthenticationInterceptor.java
View file @
84360ed7
...
...
@@ -12,13 +12,12 @@ import com.fzm.common.service.AdminService;
import
com.fzm.common.service.UserService
;
import
com.fzm.common.utils.JwtUtil
;
import
com.fzm.common.utils.RedisUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
...
...
@@ -28,11 +27,13 @@ import java.util.Date;
* @author tangtuo
* @date 2021/7/13 14:30
*/
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
AuthenticationInterceptor
implements
HandlerInterceptor
{
private
final
RedisUtil
redisUtil
;
private
final
UserService
userService
;
private
final
AdminService
adminService
;
@Resource
private
RedisUtil
redisUtil
;
@Resource
private
UserService
userService
;
@Resource
private
AdminService
adminService
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CopyrightApplyServiceImpl.java
View file @
84360ed7
...
...
@@ -39,6 +39,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -66,27 +67,32 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
private
final
CopyrightOwnerService
copyrightOwnerService
;
private
final
UserService
userService
;
private
final
AuthPersonService
authPersonService
;
private
final
NftService
nftService
;
private
final
ObsUtil
obsUtil
;
private
final
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
private
final
OpusCategoryService
opusCategoryService
;
private
final
CopyrightProperties
copyrightProperties
;
private
final
Redisson
redisson
;
private
final
DraftService
draftService
;
private
final
OrderService
orderService
;
private
final
WxPayService
wxPayService
;
private
final
NotifyPublisher
notifyPublisher
;
@Resource
private
NftService
nftService
;
@Resource
private
OrderService
orderService
;
@Resource
private
WxPayService
wxPayService
;
@Resource
private
Redisson
redisson
;
@Override
public
Integer
submit
(
CopyrightDTO
copyrightDTO
)
{
// 判断此nft是否属于当前登录用户所有
Nft
nft
=
nftService
.
getByNftHash
(
copyrightDTO
.
getNftHash
());
User
user
=
userService
.
getUserByToken
();
if
(
nft
==
null
||
!
nft
.
getUserId
().
equals
(
user
.
getId
()
))
{
Integer
userId
=
LoginUserInfo
.
getLoginUser
().
getUserId
();
if
(
nft
==
null
||
!
nft
.
getUserId
().
equals
(
user
Id
))
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"请先确认此nft的有效性"
);
}
AuthPerson
authPerson
=
authPersonService
.
getByUserId
(
user
.
getId
()
);
AuthPerson
authPerson
=
authPersonService
.
getByUserId
(
user
Id
);
if
(
authPerson
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
UNAUTHORIZED
,
"申请人尚未实名认证"
);
}
...
...
@@ -99,7 +105,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
CopyrightApply
copyrightApply
=
new
CopyrightApply
(
copyrightDTO
);
// 首次提交,登记状态为待支付
copyrightApply
.
setRegisterState
(
CopyrightApplyState
.
TO_BE_PAY
.
getCode
());
copyrightApply
.
setUserId
(
user
.
getId
()
);
copyrightApply
.
setUserId
(
user
Id
);
copyrightApply
.
setApplyName
(
authPerson
.
getName
());
copyrightApply
.
setApplyTime
(
new
Date
());
try
{
...
...
joying-common/src/main/java/com/fzm/common/service/impl/OrderServiceImpl.java
View file @
84360ed7
...
...
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.time.Duration
;
import
java.time.Instant
;
...
...
@@ -41,9 +42,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
private
final
SnowflakeUtil
snowflakeUtil
;
private
final
RabbitTemplate
rabbitTemplate
;
private
final
OrderMapper
orderMapper
;
private
final
WxPayService
wxPayService
;
private
final
ChargeService
chargeService
;
@Resource
private
WxPayService
wxPayService
;
@Override
public
Order
getByPaySceneAndProductId
(
Integer
payScene
,
Integer
productId
,
Integer
orderStatus
)
{
QueryWrapper
<
Order
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
joying-common/src/main/java/com/fzm/common/service/impl/WxPayServiceImpl.java
View file @
84360ed7
...
...
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Base64Utils
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -56,18 +57,20 @@ import java.util.concurrent.TimeUnit;
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
WxPayServiceImpl
implements
WxPayService
{
private
final
CloseableHttpClient
httpClient
;
private
final
WxPayProperties
wxPayProperties
;
private
final
PrivateKey
wxPrivateKey
;
private
final
OrderService
orderService
;
private
final
Redisson
redisson
;
private
final
PaymentService
paymentService
;
private
final
RabbitTemplate
rabbitTemplate
;
private
final
SnowflakeUtil
snowflakeUtil
;
private
final
RefundService
refundService
;
private
final
SmsService
smsService
;
@Resource
private
Redisson
redisson
;
@Resource
private
RefundService
refundService
;
public
Map
<
String
,
Object
>
payJsapi
(
JsapiPayDto
jsapiPayDto
)
throws
Exception
{
RLock
lock
=
redisson
.
getLock
(
"pay-"
+
jsapiPayDto
.
getOrderId
());
if
(!
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
))
{
...
...
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