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
b1398588
Commit
b1398588
authored
May 24, 2022
by
33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
b836bdb3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
115 additions
and
86 deletions
+115
-86
CopyrightApplyController.java
...va/com/fzm/admin/controller/CopyrightApplyController.java
+14
-5
RefundController.java
.../main/java/com/fzm/admin/controller/RefundController.java
+1
-3
CopyrightApiTask.java
...rc/main/java/com/fzm/admin/schedule/CopyrightApiTask.java
+8
-4
CopyrightTask.java
...n/src/main/java/com/fzm/admin/schedule/CopyrightTask.java
+8
-4
CommemorateNftService.java
...in/java/com/fzm/common/service/CommemorateNftService.java
+1
-1
CopyrightApplyService.java
...in/java/com/fzm/common/service/CopyrightApplyService.java
+5
-7
CopyrightLogService.java
...main/java/com/fzm/common/service/CopyrightLogService.java
+4
-0
NftService.java
...mmon/src/main/java/com/fzm/common/service/NftService.java
+1
-2
OrderService.java
...on/src/main/java/com/fzm/common/service/OrderService.java
+1
-2
RefundService.java
...n/src/main/java/com/fzm/common/service/RefundService.java
+1
-3
WxPayService.java
...on/src/main/java/com/fzm/common/service/WxPayService.java
+6
-9
CommemorateNftServiceImpl.java
...om/fzm/common/service/impl/CommemorateNftServiceImpl.java
+7
-2
CopyrightApplyServiceImpl.java
...om/fzm/common/service/impl/CopyrightApplyServiceImpl.java
+17
-10
CopyrightLogServiceImpl.java
.../com/fzm/common/service/impl/CopyrightLogServiceImpl.java
+15
-2
NftServiceImpl.java
...main/java/com/fzm/common/service/impl/NftServiceImpl.java
+1
-2
OrderServiceImpl.java
...in/java/com/fzm/common/service/impl/OrderServiceImpl.java
+1
-2
RefundServiceImpl.java
...n/java/com/fzm/common/service/impl/RefundServiceImpl.java
+1
-2
UserServiceImpl.java
...ain/java/com/fzm/common/service/impl/UserServiceImpl.java
+0
-6
WxPayServiceImpl.java
...in/java/com/fzm/common/service/impl/WxPayServiceImpl.java
+0
-0
CommemorateNftController.java
...a/com/fzm/portal/controller/CommemorateNftController.java
+1
-1
CopyrightApplyController.java
...a/com/fzm/portal/controller/CopyrightApplyController.java
+2
-4
NftController.java
...rc/main/java/com/fzm/portal/controller/NftController.java
+1
-2
OrderController.java
.../main/java/com/fzm/portal/controller/OrderController.java
+1
-2
WxPayController.java
.../main/java/com/fzm/portal/controller/WxPayController.java
+4
-5
DraftTask.java
...rtal/src/main/java/com/fzm/portal/schedule/DraftTask.java
+7
-3
PayTask.java
...portal/src/main/java/com/fzm/portal/schedule/PayTask.java
+7
-3
No files found.
joying-admin/src/main/java/com/fzm/admin/controller/CopyrightApplyController.java
View file @
b1398588
package
com
.
fzm
.
admin
.
controller
;
package
com
.
fzm
.
admin
.
controller
;
import
com.fzm.common.annotation.Authentication
;
import
com.fzm.common.annotation.Authentication
;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.entity.vo.CopyrightApplyVo
;
import
com.fzm.common.entity.vo.CopyrightApplyVo
;
import
com.fzm.common.entity.vo.CopyrightVo
;
import
com.fzm.common.entity.vo.CopyrightVo
;
import
com.fzm.common.model.ResponseModel
;
import
com.fzm.common.model.ResponseModel
;
import
com.fzm.common.service.CopyrightApplyService
;
import
com.fzm.common.service.CopyrightApplyService
;
import
com.fzm.common.service.CopyrightLogService
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -13,8 +15,7 @@ import lombok.RequiredArgsConstructor;
...
@@ -13,8 +15,7 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
/**
/**
* @author tangtuo
* @author tangtuo
...
@@ -27,6 +28,7 @@ import java.util.concurrent.ExecutionException;
...
@@ -27,6 +28,7 @@ import java.util.concurrent.ExecutionException;
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
CopyrightApplyController
{
public
class
CopyrightApplyController
{
private
final
CopyrightApplyService
copyrightApplyService
;
private
final
CopyrightApplyService
copyrightApplyService
;
private
final
CopyrightLogService
copyrightLogService
;
@GetMapping
(
value
=
"/pages"
)
@GetMapping
(
value
=
"/pages"
)
@ApiOperation
(
value
=
"分页查询"
)
@ApiOperation
(
value
=
"分页查询"
)
...
@@ -43,21 +45,28 @@ public class CopyrightApplyController {
...
@@ -43,21 +45,28 @@ public class CopyrightApplyController {
@PostMapping
(
value
=
"/pass"
)
@PostMapping
(
value
=
"/pass"
)
@ApiOperation
(
value
=
"通过"
)
@ApiOperation
(
value
=
"通过"
)
public
ResponseModel
<
Boolean
>
pass
(
@RequestParam
Integer
id
)
throws
ExecutionException
,
InterruptedException
{
public
ResponseModel
<
Boolean
>
pass
(
@RequestParam
Integer
id
)
{
boolean
result
=
copyrightApplyService
.
pass
(
id
);
boolean
result
=
copyrightApplyService
.
pass
(
id
);
return
ResponseModel
.
success
(
result
);
return
ResponseModel
.
success
(
result
);
}
}
@PostMapping
(
value
=
"/reject"
)
@PostMapping
(
value
=
"/reject"
)
@ApiOperation
(
value
=
"驳回"
)
@ApiOperation
(
value
=
"驳回"
)
public
ResponseModel
<
Boolean
>
reject
(
@RequestParam
Integer
id
,
@RequestParam
String
rejectReason
)
throws
IOException
,
InterruptedException
{
public
ResponseModel
<
Boolean
>
reject
(
@RequestParam
Integer
id
,
@RequestParam
String
rejectReason
)
{
boolean
result
=
copyrightApplyService
.
reject
(
id
,
rejectReason
);
boolean
result
=
copyrightApplyService
.
reject
(
id
,
rejectReason
);
return
ResponseModel
.
success
(
result
);
return
ResponseModel
.
success
(
result
);
}
}
@GetMapping
(
value
=
"/detail"
)
@GetMapping
(
value
=
"/detail"
)
@ApiOperation
(
value
=
"获取详情"
)
@ApiOperation
(
value
=
"获取详情"
)
public
ResponseModel
<
CopyrightVo
>
details
(
@RequestParam
Integer
id
)
throws
ExecutionException
,
InterruptedException
{
public
ResponseModel
<
CopyrightVo
>
details
(
@RequestParam
Integer
id
)
{
return
ResponseModel
.
success
(
copyrightApplyService
.
getDetail
(
id
));
return
ResponseModel
.
success
(
copyrightApplyService
.
getDetail
(
id
));
}
}
@GetMapping
(
value
=
"/log"
)
@ApiOperation
(
value
=
"操作记录"
)
public
ResponseModel
<
List
<
CopyrightLog
>>
log
(
@RequestParam
Integer
id
)
{
List
<
CopyrightLog
>
logs
=
copyrightLogService
.
logs
(
id
);
return
ResponseModel
.
success
(
logs
);
}
}
}
joying-admin/src/main/java/com/fzm/admin/controller/RefundController.java
View file @
b1398588
...
@@ -17,8 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -17,8 +17,6 @@ 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.io.IOException
;
/**
/**
* @author tangtuo
* @author tangtuo
* @date 2022/2/9 10:16
* @date 2022/2/9 10:16
...
@@ -48,7 +46,7 @@ public class RefundController {
...
@@ -48,7 +46,7 @@ public class RefundController {
@GetMapping
(
"/submit"
)
@GetMapping
(
"/submit"
)
@ApiOperation
(
value
=
"提交退款申请"
)
@ApiOperation
(
value
=
"提交退款申请"
)
public
ResponseModel
<
Boolean
>
submit
(
@ApiParam
(
required
=
true
,
value
=
"订单id"
)
@RequestParam
String
orderId
)
throws
IOException
,
InterruptedException
{
public
ResponseModel
<
Boolean
>
submit
(
@ApiParam
(
required
=
true
,
value
=
"订单id"
)
@RequestParam
String
orderId
)
{
long
oid
;
long
oid
;
try
{
try
{
oid
=
Long
.
parseLong
(
orderId
);
oid
=
Long
.
parseLong
(
orderId
);
...
...
joying-admin/src/main/java/com/fzm/admin/schedule/CopyrightApiTask.java
View file @
b1398588
...
@@ -47,13 +47,17 @@ public class CopyrightApiTask {
...
@@ -47,13 +47,17 @@ public class CopyrightApiTask {
*/
*/
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateCopyrightState
()
throws
InterruptedException
{
public
void
updateCopyrightState
()
{
// 加锁,防止集群部署时,定时任务在多个节点上执行
// 加锁,防止集群部署时,定时任务在多个节点上执行
RLock
lock
=
redisson
.
getLock
(
"update:copyright:api:state"
);
RLock
lock
=
redisson
.
getLock
(
"update:copyright:api:state"
);
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
try
{
if
(
log
.
isDebugEnabled
())
{
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
log
.
debug
(
"更新版权状态的定时任务已在其他节点运行"
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"更新版权状态的定时任务已在其他节点运行"
);
}
return
;
}
}
}
catch
(
InterruptedException
e
)
{
return
;
return
;
}
}
try
{
try
{
...
...
joying-admin/src/main/java/com/fzm/admin/schedule/CopyrightTask.java
View file @
b1398588
...
@@ -68,13 +68,17 @@ public class CopyrightTask {
...
@@ -68,13 +68,17 @@ public class CopyrightTask {
*/
*/
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateCopyrightState
()
throws
InterruptedException
{
public
void
updateCopyrightState
()
{
// 加锁,防止集群部署时,定时任务在多个节点上执行
// 加锁,防止集群部署时,定时任务在多个节点上执行
RLock
lock
=
redisson
.
getLock
(
"update:copyright:state"
);
RLock
lock
=
redisson
.
getLock
(
"update:copyright:state"
);
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
try
{
if
(
log
.
isDebugEnabled
())
{
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
log
.
debug
(
"更新版权状态的定时任务已在其他节点运行"
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"更新版权状态的定时任务已在其他节点运行"
);
}
return
;
}
}
}
catch
(
InterruptedException
e
)
{
return
;
return
;
}
}
try
{
try
{
...
...
joying-common/src/main/java/com/fzm/common/service/CommemorateNftService.java
View file @
b1398588
...
@@ -23,5 +23,5 @@ public interface CommemorateNftService extends IService<CommemorateNft> {
...
@@ -23,5 +23,5 @@ public interface CommemorateNftService extends IService<CommemorateNft> {
* @param id
* @param id
* @return
* @return
*/
*/
Boolean
receive
(
Integer
id
)
throws
InterruptedException
;
Boolean
receive
(
Integer
id
);
}
}
joying-common/src/main/java/com/fzm/common/service/CopyrightApplyService.java
View file @
b1398588
...
@@ -8,9 +8,7 @@ import com.fzm.common.entity.vo.CopyrightCertificateVo;
...
@@ -8,9 +8,7 @@ import com.fzm.common.entity.vo.CopyrightCertificateVo;
import
com.fzm.common.entity.vo.CopyrightVo
;
import
com.fzm.common.entity.vo.CopyrightVo
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
/**
/**
* @author tangtuo
* @author tangtuo
...
@@ -41,7 +39,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
...
@@ -41,7 +39,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param id
* @param id
* @return
* @return
*/
*/
Boolean
withdraw
(
Integer
id
)
throws
IOException
,
InterruptedException
;
Boolean
withdraw
(
Integer
id
);
/**
/**
...
@@ -58,7 +56,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
...
@@ -58,7 +56,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param id
* @param id
* @return
* @return
*/
*/
CopyrightVo
getDetail
(
Integer
id
)
throws
ExecutionException
,
InterruptedException
;
CopyrightVo
getDetail
(
Integer
id
);
/**
/**
* 修改
* 修改
...
@@ -88,7 +86,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
...
@@ -88,7 +86,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param rejectReason
* @param rejectReason
* @return
* @return
*/
*/
boolean
reject
(
Integer
id
,
String
rejectReason
)
throws
IOException
,
InterruptedException
;
boolean
reject
(
Integer
id
,
String
rejectReason
);
/**
/**
* 审核通过
* 审核通过
...
@@ -96,7 +94,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
...
@@ -96,7 +94,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param id
* @param id
* @return
* @return
*/
*/
boolean
pass
(
Integer
id
)
throws
ExecutionException
,
InterruptedException
;
boolean
pass
(
Integer
id
);
/**
/**
* 获取存证成功的总数量
* 获取存证成功的总数量
...
@@ -119,7 +117,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
...
@@ -119,7 +117,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param nftHash
* @param nftHash
* @return
* @return
*/
*/
CopyrightVo
getByNftHash
(
String
nftHash
)
throws
ExecutionException
,
InterruptedException
;
CopyrightVo
getByNftHash
(
String
nftHash
);
/**
/**
* 查看证书
* 查看证书
...
...
joying-common/src/main/java/com/fzm/common/service/CopyrightLogService.java
View file @
b1398588
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.enums.CopyrightLogType
;
import
com.fzm.common.enums.CopyrightLogType
;
import
java.util.List
;
/**
/**
* @author wt
* @author wt
* @date 2022/5/24
* @date 2022/5/24
...
@@ -15,4 +17,6 @@ public interface CopyrightLogService extends IService<CopyrightLog> {
...
@@ -15,4 +17,6 @@ public interface CopyrightLogService extends IService<CopyrightLog> {
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
);
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
);
CopyrightLog
selectByIdAndType
(
Integer
cid
,
Integer
typeId
);
CopyrightLog
selectByIdAndType
(
Integer
cid
,
Integer
typeId
);
List
<
CopyrightLog
>
logs
(
Integer
cid
);
}
}
joying-common/src/main/java/com/fzm/common/service/NftService.java
View file @
b1398588
...
@@ -9,7 +9,6 @@ import com.fzm.common.params.NftTransferParam;
...
@@ -9,7 +9,6 @@ import com.fzm.common.params.NftTransferParam;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
/**
/**
* @author tangtuo
* @author tangtuo
...
@@ -166,7 +165,7 @@ public interface NftService extends IService<Nft> {
...
@@ -166,7 +165,7 @@ public interface NftService extends IService<Nft> {
* @param nftHash
* @param nftHash
* @return
* @return
*/
*/
NftVo
getDetail
(
String
nftHash
)
throws
ExecutionException
,
InterruptedException
;
NftVo
getDetail
(
String
nftHash
);
/**
/**
* 修改当前nfthash的是否已委托的状态
* 修改当前nfthash的是否已委托的状态
...
...
joying-common/src/main/java/com/fzm/common/service/OrderService.java
View file @
b1398588
...
@@ -6,7 +6,6 @@ import com.fzm.common.entity.dto.OrderDto;
...
@@ -6,7 +6,6 @@ import com.fzm.common.entity.dto.OrderDto;
import
com.fzm.common.entity.vo.OrderVo
;
import
com.fzm.common.entity.vo.OrderVo
;
import
com.fzm.common.enums.OrderStatus
;
import
com.fzm.common.enums.OrderStatus
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -73,7 +72,7 @@ public interface OrderService extends IService<Order> {
...
@@ -73,7 +72,7 @@ public interface OrderService extends IService<Order> {
* @param orderId
* @param orderId
* @return
* @return
*/
*/
Boolean
renewOrderStatus
(
Long
orderId
)
throws
IOException
,
InterruptedException
;
Boolean
renewOrderStatus
(
Long
orderId
);
/**
/**
* 查询超时的订单
* 查询超时的订单
...
...
joying-common/src/main/java/com/fzm/common/service/RefundService.java
View file @
b1398588
...
@@ -5,8 +5,6 @@ import com.fzm.common.entity.Refund;
...
@@ -5,8 +5,6 @@ import com.fzm.common.entity.Refund;
import
com.fzm.common.entity.vo.PaymentVo
;
import
com.fzm.common.entity.vo.PaymentVo
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
java.io.IOException
;
/**
/**
* @author tangtuo
* @author tangtuo
* @date 2022/1/24 14:26
* @date 2022/1/24 14:26
...
@@ -27,7 +25,7 @@ public interface RefundService extends IService<Refund> {
...
@@ -27,7 +25,7 @@ public interface RefundService extends IService<Refund> {
* @param orderId
* @param orderId
* @return
* @return
*/
*/
Boolean
submit
(
Long
orderId
)
throws
IOException
,
InterruptedException
;
Boolean
submit
(
Long
orderId
);
/**
/**
* 分页查询待处理的退款订单
* 分页查询待处理的退款订单
...
...
joying-common/src/main/java/com/fzm/common/service/WxPayService.java
View file @
b1398588
...
@@ -4,7 +4,6 @@ import cn.hutool.json.JSONObject;
...
@@ -4,7 +4,6 @@ import cn.hutool.json.JSONObject;
import
com.fzm.common.entity.dto.JsapiPayDto
;
import
com.fzm.common.entity.dto.JsapiPayDto
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -20,9 +19,7 @@ public interface WxPayService {
...
@@ -20,9 +19,7 @@ public interface WxPayService {
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
Map
<
String
,
Object
>
payJsapi
(
JsapiPayDto
jsapiPayDto
)
throws
Exception
;
Map
<
String
,
Object
>
payJsapi
(
JsapiPayDto
jsapiPayDto
);
String
encryptByPrivateKey
(
String
data
)
throws
Exception
;
Boolean
notifyH5
(
HttpServletRequest
request
);
Boolean
notifyH5
(
HttpServletRequest
request
);
...
@@ -31,9 +28,9 @@ public interface WxPayService {
...
@@ -31,9 +28,9 @@ public interface WxPayService {
*
*
* @param jsonObject
* @param jsonObject
*/
*/
void
processOrder
(
JSONObject
jsonObject
)
throws
InterruptedException
;
void
processOrder
(
JSONObject
jsonObject
);
String
queryOrder
(
Long
orderId
)
throws
IOException
,
InterruptedException
;
String
queryOrder
(
Long
orderId
);
/**
/**
* 退款
* 退款
...
@@ -41,7 +38,7 @@ public interface WxPayService {
...
@@ -41,7 +38,7 @@ public interface WxPayService {
* @param orderId 订单id
* @param orderId 订单id
* @param channel 退款发起渠道
* @param channel 退款发起渠道
*/
*/
Boolean
refund
(
Long
orderId
,
Integer
channel
)
throws
IOException
,
InterruptedException
;
Boolean
refund
(
Long
orderId
,
Integer
channel
);
/**
/**
* 退款回调
* 退款回调
...
@@ -49,12 +46,12 @@ public interface WxPayService {
...
@@ -49,12 +46,12 @@ public interface WxPayService {
* @param request
* @param request
* @return
* @return
*/
*/
Boolean
notifyRefund
(
HttpServletRequest
request
);
void
notifyRefund
(
HttpServletRequest
request
);
/**
/**
* 处理退款成功后的订单
* 处理退款成功后的订单
*
*
* @param jsonObject
* @param jsonObject
*/
*/
void
processRefund
(
JSONObject
jsonObject
)
throws
InterruptedException
;
void
processRefund
(
JSONObject
jsonObject
);
}
}
joying-common/src/main/java/com/fzm/common/service/impl/CommemorateNftServiceImpl.java
View file @
b1398588
...
@@ -98,12 +98,17 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
...
@@ -98,12 +98,17 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
}
}
@Override
@Override
public
Boolean
receive
(
Integer
id
)
throws
InterruptedException
{
public
Boolean
receive
(
Integer
id
)
{
User
user
=
userService
.
getUserByToken
();
User
user
=
userService
.
getUserByToken
();
// 加锁,避免一个用户可以并发领取
// 加锁,避免一个用户可以并发领取
RLock
lock
=
redisson
.
getLock
(
"receive:nft:"
+
user
.
getId
());
RLock
lock
=
redisson
.
getLock
(
"receive:nft:"
+
user
.
getId
());
boolean
tryLock
=
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
);
boolean
tryLock
;
try
{
tryLock
=
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
);
}
catch
(
InterruptedException
e
)
{
throw
GlobalException
.
newException
(
ResultCode
.
RECEIVE_ERROR
,
"操作频繁"
);
}
if
(!
tryLock
)
{
if
(!
tryLock
)
{
throw
GlobalException
.
newException
(
ResultCode
.
RECEIVE_ERROR
,
"操作频繁"
);
throw
GlobalException
.
newException
(
ResultCode
.
RECEIVE_ERROR
,
"操作频繁"
);
}
}
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CopyrightApplyServiceImpl.java
View file @
b1398588
...
@@ -38,13 +38,11 @@ import org.springframework.stereotype.Service;
...
@@ -38,13 +38,11 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -170,7 +168,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -170,7 +168,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
}
}
@Override
@Override
public
Boolean
withdraw
(
Integer
id
)
throws
IOException
,
InterruptedException
{
public
Boolean
withdraw
(
Integer
id
)
{
CopyrightApply
copyright
=
getById
(
id
);
CopyrightApply
copyright
=
getById
(
id
);
if
(
copyright
==
null
)
{
if
(
copyright
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此版权登记记录不存在,请核对后重试"
);
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此版权登记记录不存在,请核对后重试"
);
...
@@ -225,7 +223,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -225,7 +223,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
}
}
@Override
@Override
public
CopyrightVo
getDetail
(
Integer
id
)
throws
ExecutionException
,
InterruptedException
{
public
CopyrightVo
getDetail
(
Integer
id
)
{
// 使用异步编排查询
// 使用异步编排查询
CompletableFuture
<
CopyrightVo
>
applyFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
CopyrightVo
>
applyFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
CopyrightApply
copyrightApply
=
getById
(
id
);
CopyrightApply
copyrightApply
=
getById
(
id
);
...
@@ -257,8 +255,12 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -257,8 +255,12 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
result
.
setAuthorities
(
authorities
);
result
.
setAuthorities
(
authorities
);
},
threadPoolTaskExecutor
);
},
threadPoolTaskExecutor
);
// 等所有异步任务都完成以后返回结果
// 等所有异步任务都完成以后返回结果
CompletableFuture
.
allOf
(
categoryFuture
,
filesFuture
,
authorsFuture
,
ownerFuture
,
authoritiesFuture
).
get
();
try
{
return
applyFuture
.
get
();
CompletableFuture
.
allOf
(
categoryFuture
,
filesFuture
,
authorsFuture
,
ownerFuture
,
authoritiesFuture
).
get
();
return
applyFuture
.
get
();
}
catch
(
Exception
e
)
{
throw
GlobalException
.
newException
(
ResultCode
.
SELECT_FAILED
);
}
}
}
@Override
@Override
...
@@ -337,7 +339,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -337,7 +339,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
}
}
@Override
@Override
public
boolean
reject
(
Integer
id
,
String
rejectReason
)
throws
IOException
,
InterruptedException
{
public
boolean
reject
(
Integer
id
,
String
rejectReason
)
{
CopyrightApply
copyright
=
getById
(
id
);
CopyrightApply
copyright
=
getById
(
id
);
if
(
copyright
==
null
)
{
if
(
copyright
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此版权登记记录不存在,请核对后重试"
);
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此版权登记记录不存在,请核对后重试"
);
...
@@ -364,9 +366,14 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -364,9 +366,14 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
}
}
@Override
@Override
public
boolean
pass
(
Integer
id
)
throws
ExecutionException
,
InterruptedException
{
public
boolean
pass
(
Integer
id
)
{
RLock
lock
=
redisson
.
getLock
(
"copyright:apply:"
+
id
);
RLock
lock
=
redisson
.
getLock
(
"copyright:apply:"
+
id
);
boolean
tryLock
=
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
);
boolean
tryLock
;
try
{
tryLock
=
lock
.
tryLock
(
10
,
TimeUnit
.
SECONDS
);
}
catch
(
InterruptedException
e
)
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"操作频繁"
);
}
if
(!
tryLock
)
{
if
(!
tryLock
)
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"操作频繁"
);
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"操作频繁"
);
}
}
...
@@ -443,7 +450,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
...
@@ -443,7 +450,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
}
}
@Override
@Override
public
CopyrightVo
getByNftHash
(
String
nftHash
)
throws
ExecutionException
,
InterruptedException
{
public
CopyrightVo
getByNftHash
(
String
nftHash
)
{
QueryWrapper
<
CopyrightApply
>
wrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
CopyrightApply
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"nft_hash"
,
nftHash
);
wrapper
.
eq
(
"nft_hash"
,
nftHash
);
CopyrightApply
copyrightApply
=
this
.
getOne
(
wrapper
);
CopyrightApply
copyrightApply
=
this
.
getOne
(
wrapper
);
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CopyrightLogServiceImpl.java
View file @
b1398588
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* @author wt
* @author wt
...
@@ -31,12 +32,16 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
...
@@ -31,12 +32,16 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
copyrightLog
.
setOpUserId
(
LoginUserInfo
.
getLoginUser
().
getUserId
());
copyrightLog
.
setOpUserId
(
LoginUserInfo
.
getLoginUser
().
getUserId
());
copyrightLog
.
setOpUserName
(
LoginUserInfo
.
getLoginUser
().
getUsername
());
copyrightLog
.
setOpUserName
(
LoginUserInfo
.
getLoginUser
().
getUsername
());
copyrightLog
.
setOpTime
(
new
Date
());
copyrightLog
.
setOpTime
(
new
Date
());
this
.
save
(
copyrightLog
);
save
(
copyrightLog
);
}
}
@Override
@Override
public
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
)
{
public
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
)
{
CopyrightLogType
logType
=
CopyrightLogType
.
getById
(
typeId
);
CopyrightLogType
logType
=
CopyrightLogType
.
getById
(
typeId
);
if
(
logType
==
null
)
{
return
;
}
CopyrightLog
copyrightLog
=
new
CopyrightLog
();
CopyrightLog
copyrightLog
=
new
CopyrightLog
();
copyrightLog
.
setCopyrightId
(
cid
);
copyrightLog
.
setCopyrightId
(
cid
);
...
@@ -46,7 +51,8 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
...
@@ -46,7 +51,8 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
copyrightLog
.
setOpUserId
(
0
);
copyrightLog
.
setOpUserId
(
0
);
copyrightLog
.
setOpUserName
(
"版权局"
);
copyrightLog
.
setOpUserName
(
"版权局"
);
copyrightLog
.
setOpTime
(
new
Date
());
copyrightLog
.
setOpTime
(
new
Date
());
this
.
save
(
copyrightLog
);
save
(
copyrightLog
);
}
}
@Override
@Override
...
@@ -56,4 +62,11 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
...
@@ -56,4 +62,11 @@ public class CopyrightLogServiceImpl extends ServiceImpl<CopyrightLogMapper, Cop
queryWrapper
.
eq
(
"op_type_id"
,
typeId
);
queryWrapper
.
eq
(
"op_type_id"
,
typeId
);
return
getOne
(
queryWrapper
);
return
getOne
(
queryWrapper
);
}
}
@Override
public
List
<
CopyrightLog
>
logs
(
Integer
cid
)
{
QueryWrapper
<
CopyrightLog
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"copyright_id"
,
cid
);
return
list
(
queryWrapper
);
}
}
}
joying-common/src/main/java/com/fzm/common/service/impl/NftServiceImpl.java
View file @
b1398588
...
@@ -45,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -45,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -225,7 +224,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -225,7 +224,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
}
}
@Override
@Override
public
NftVo
getDetail
(
String
nftHash
)
throws
ExecutionException
,
InterruptedException
{
public
NftVo
getDetail
(
String
nftHash
)
{
Nft
nft
=
this
.
getByNftHash
(
nftHash
);
Nft
nft
=
this
.
getByNftHash
(
nftHash
);
if
(
nft
==
null
)
{
if
(
nft
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
SELECT_FAILED
,
"没找到此nft详情,请核对后再试"
);
throw
GlobalException
.
newException
(
ResultCode
.
SELECT_FAILED
,
"没找到此nft详情,请核对后再试"
);
...
...
joying-common/src/main/java/com/fzm/common/service/impl/OrderServiceImpl.java
View file @
b1398588
...
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
...
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -161,7 +160,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
...
@@ -161,7 +160,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
}
}
@Override
@Override
public
Boolean
renewOrderStatus
(
Long
orderId
)
throws
IOException
,
InterruptedException
{
public
Boolean
renewOrderStatus
(
Long
orderId
)
{
Order
order
=
this
.
getById
(
orderId
);
Order
order
=
this
.
getById
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"unknown orderId: "
+
orderId
);
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"unknown orderId: "
+
orderId
);
...
...
joying-common/src/main/java/com/fzm/common/service/impl/RefundServiceImpl.java
View file @
b1398588
...
@@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -41,7 +40,7 @@ public class RefundServiceImpl extends ServiceImpl<RefundMapper, Refund> impleme
...
@@ -41,7 +40,7 @@ public class RefundServiceImpl extends ServiceImpl<RefundMapper, Refund> impleme
}
}
@Override
@Override
public
Boolean
submit
(
Long
orderId
)
throws
IOException
,
InterruptedException
{
public
Boolean
submit
(
Long
orderId
)
{
return
wxPayService
.
refund
(
orderId
,
RefundLaunchChannel
.
ADMIN
.
getCode
());
return
wxPayService
.
refund
(
orderId
,
RefundLaunchChannel
.
ADMIN
.
getCode
());
}
}
...
...
joying-common/src/main/java/com/fzm/common/service/impl/UserServiceImpl.java
View file @
b1398588
...
@@ -32,12 +32,6 @@ import com.fzm.common.utils.ObsUtil;
...
@@ -32,12 +32,6 @@ import com.fzm.common.utils.ObsUtil;
import
com.fzm.common.utils.RedisUtil
;
import
com.fzm.common.utils.RedisUtil
;
import
com.fzm.common.utils.SmsUtil
;
import
com.fzm.common.utils.SmsUtil
;
import
com.fzm.common.utils.TencentApi
;
import
com.fzm.common.utils.TencentApi
;
import
com.tencentcloudapi.common.Credential
;
import
com.tencentcloudapi.common.exception.TencentCloudSDKException
;
import
com.tencentcloudapi.common.profile.ClientProfile
;
import
com.tencentcloudapi.common.profile.HttpProfile
;
import
com.tencentcloudapi.faceid.v20180301.FaceidClient
;
import
com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationRequest
;
import
com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse
;
import
com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
...
joying-common/src/main/java/com/fzm/common/service/impl/WxPayServiceImpl.java
View file @
b1398588
This diff is collapsed.
Click to expand it.
joying-portal/src/main/java/com/fzm/portal/controller/CommemorateNftController.java
View file @
b1398588
...
@@ -83,7 +83,7 @@ public class CommemorateNftController {
...
@@ -83,7 +83,7 @@ public class CommemorateNftController {
@Authentication
@Authentication
@PostMapping
(
"/receive"
)
@PostMapping
(
"/receive"
)
@ApiOperation
(
value
=
"领取纪念版nft"
)
@ApiOperation
(
value
=
"领取纪念版nft"
)
public
ResponseModel
<
Boolean
>
receive
(
@RequestParam
Integer
id
)
throws
InterruptedException
{
public
ResponseModel
<
Boolean
>
receive
(
@RequestParam
Integer
id
)
{
Boolean
result
=
commemorateNftService
.
receive
(
id
);
Boolean
result
=
commemorateNftService
.
receive
(
id
);
return
ResponseModel
.
success
(
result
);
return
ResponseModel
.
success
(
result
);
}
}
...
...
joying-portal/src/main/java/com/fzm/portal/controller/CopyrightApplyController.java
View file @
b1398588
...
@@ -20,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
/**
/**
* @author tangtuo
* @author tangtuo
...
@@ -57,7 +55,7 @@ public class CopyrightApplyController {
...
@@ -57,7 +55,7 @@ public class CopyrightApplyController {
@Authentication
@Authentication
@PostMapping
(
value
=
"/withdraw"
)
@PostMapping
(
value
=
"/withdraw"
)
@ApiOperation
(
value
=
"撤回"
)
@ApiOperation
(
value
=
"撤回"
)
public
ResponseModel
<
Boolean
>
withdraw
(
@RequestParam
Integer
id
)
throws
IOException
,
InterruptedException
{
public
ResponseModel
<
Boolean
>
withdraw
(
@RequestParam
Integer
id
)
{
Boolean
result
=
copyrightApplyService
.
withdraw
(
id
);
Boolean
result
=
copyrightApplyService
.
withdraw
(
id
);
return
ResponseModel
.
success
(
result
);
return
ResponseModel
.
success
(
result
);
}
}
...
@@ -72,7 +70,7 @@ public class CopyrightApplyController {
...
@@ -72,7 +70,7 @@ public class CopyrightApplyController {
@GetMapping
(
value
=
"/detail"
)
@GetMapping
(
value
=
"/detail"
)
@ApiOperation
(
value
=
"获取详情"
)
@ApiOperation
(
value
=
"获取详情"
)
public
ResponseModel
<
CopyrightVo
>
getById
(
@RequestParam
Integer
id
)
throws
ExecutionException
,
InterruptedException
{
public
ResponseModel
<
CopyrightVo
>
getById
(
@RequestParam
Integer
id
)
{
CopyrightVo
copyrightVo
=
copyrightApplyService
.
getDetail
(
id
);
CopyrightVo
copyrightVo
=
copyrightApplyService
.
getDetail
(
id
);
return
ResponseModel
.
success
(
copyrightVo
);
return
ResponseModel
.
success
(
copyrightVo
);
}
}
...
...
joying-portal/src/main/java/com/fzm/portal/controller/NftController.java
View file @
b1398588
...
@@ -32,7 +32,6 @@ import java.io.IOException;
...
@@ -32,7 +32,6 @@ import java.io.IOException;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ExecutionException
;
/**
/**
* @author tangtuo
* @author tangtuo
...
@@ -78,7 +77,7 @@ public class NftController {
...
@@ -78,7 +77,7 @@ public class NftController {
@GetMapping
(
"get/{nftHash}"
)
@GetMapping
(
"get/{nftHash}"
)
@ApiOperation
(
value
=
"获取nft详情"
)
@ApiOperation
(
value
=
"获取nft详情"
)
public
ResponseModel
<
NftVo
>
get
(
@PathVariable
String
nftHash
)
throws
ExecutionException
,
InterruptedException
{
public
ResponseModel
<
NftVo
>
get
(
@PathVariable
String
nftHash
)
{
NftVo
nftVo
=
nftService
.
getDetail
(
nftHash
);
NftVo
nftVo
=
nftService
.
getDetail
(
nftHash
);
if
(
nftVo
.
getCopyright
()
!=
null
&&
!
nftVo
.
getCopyright
().
getRegisterState
().
equals
(
CopyrightApplyState
.
SUCCEEDED
.
getCode
()))
{
if
(
nftVo
.
getCopyright
()
!=
null
&&
!
nftVo
.
getCopyright
().
getRegisterState
().
equals
(
CopyrightApplyState
.
SUCCEEDED
.
getCode
()))
{
nftVo
.
setCopyright
(
null
);
nftVo
.
setCopyright
(
null
);
...
...
joying-portal/src/main/java/com/fzm/portal/controller/OrderController.java
View file @
b1398588
...
@@ -13,7 +13,6 @@ import lombok.RequiredArgsConstructor;
...
@@ -13,7 +13,6 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -62,7 +61,7 @@ public class OrderController {
...
@@ -62,7 +61,7 @@ public class OrderController {
@PostMapping
(
"/renew-order-status"
)
@PostMapping
(
"/renew-order-status"
)
@ApiOperation
(
"更新订单状态"
)
@ApiOperation
(
"更新订单状态"
)
public
ResponseModel
<
Boolean
>
renewOrderStatus
(
@RequestParam
Long
orderId
)
throws
IOException
,
InterruptedException
{
public
ResponseModel
<
Boolean
>
renewOrderStatus
(
@RequestParam
Long
orderId
)
{
return
ResponseModel
.
success
(
orderService
.
renewOrderStatus
(
orderId
));
return
ResponseModel
.
success
(
orderService
.
renewOrderStatus
(
orderId
));
}
}
...
...
joying-portal/src/main/java/com/fzm/portal/controller/WxPayController.java
View file @
b1398588
...
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
...
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -58,12 +57,12 @@ public class WxPayController {
...
@@ -58,12 +57,12 @@ public class WxPayController {
@PostMapping
(
"/notify/refund"
)
@PostMapping
(
"/notify/refund"
)
public
Map
<
String
,
String
>
notifyRefund
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
Map
<
String
,
String
>
notifyRefund
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
Map
<
String
,
String
>
result
=
new
HashMap
<>();
Boolean
refund
=
wxPayService
.
notifyRefund
(
request
);
try
{
if
(
refund
)
{
wxPayService
.
notifyRefund
(
request
);
result
.
put
(
"code"
,
"SUCCESS"
);
result
.
put
(
"code"
,
"SUCCESS"
);
result
.
put
(
"message"
,
"成功"
);
result
.
put
(
"message"
,
"成功"
);
response
.
setStatus
(
HttpStatus
.
HTTP_OK
);
response
.
setStatus
(
HttpStatus
.
HTTP_OK
);
}
else
{
}
catch
(
Exception
e
)
{
result
.
put
(
"code"
,
"FAILED"
);
result
.
put
(
"code"
,
"FAILED"
);
result
.
put
(
"message"
,
"系统异常"
);
result
.
put
(
"message"
,
"系统异常"
);
response
.
setStatus
(
HttpStatus
.
HTTP_INTERNAL_ERROR
);
response
.
setStatus
(
HttpStatus
.
HTTP_INTERNAL_ERROR
);
...
@@ -73,7 +72,7 @@ public class WxPayController {
...
@@ -73,7 +72,7 @@ public class WxPayController {
@GetMapping
(
"/refund/{orderId}"
)
@GetMapping
(
"/refund/{orderId}"
)
public
ResponseModel
<
String
>
refund
(
@PathVariable
Long
orderId
)
throws
IOException
,
InterruptedException
{
public
ResponseModel
<
String
>
refund
(
@PathVariable
Long
orderId
)
{
wxPayService
.
refund
(
orderId
,
RefundLaunchChannel
.
USER
.
getCode
());
wxPayService
.
refund
(
orderId
,
RefundLaunchChannel
.
USER
.
getCode
());
return
ResponseModel
.
success
(
"退款成功"
);
return
ResponseModel
.
success
(
"退款成功"
);
}
}
...
...
joying-portal/src/main/java/com/fzm/portal/schedule/DraftTask.java
View file @
b1398588
...
@@ -29,11 +29,15 @@ public class DraftTask {
...
@@ -29,11 +29,15 @@ public class DraftTask {
* 删除创建时间大于7天的草稿
* 删除创建时间大于7天的草稿
*/
*/
@Scheduled
(
cron
=
"0 */15 * * * ?"
)
@Scheduled
(
cron
=
"0 */15 * * * ?"
)
public
void
deleteTimeoutDraft
()
throws
InterruptedException
{
public
void
deleteTimeoutDraft
()
{
RLock
lock
=
redisson
.
getLock
(
"delete-draft"
);
RLock
lock
=
redisson
.
getLock
(
"delete-draft"
);
// 加锁,避免集群环境下多个节点同事运行此定时任务
// 加锁,避免集群环境下多个节点同事运行此定时任务
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
try
{
log
.
warn
(
"删除超时草稿的任务正在运行中"
);
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
log
.
warn
(
"删除超时草稿的任务正在运行中"
);
return
;
}
}
catch
(
InterruptedException
e
)
{
return
;
return
;
}
}
try
{
try
{
...
...
joying-portal/src/main/java/com/fzm/portal/schedule/PayTask.java
View file @
b1398588
...
@@ -35,11 +35,15 @@ public class PayTask {
...
@@ -35,11 +35,15 @@ public class PayTask {
* 定时关单的任务
* 定时关单的任务
*/
*/
@Scheduled
(
cron
=
"0 */5 * * * ?"
)
@Scheduled
(
cron
=
"0 */5 * * * ?"
)
public
void
closeOrder
()
throws
InterruptedException
{
public
void
closeOrder
()
{
RLock
lock
=
redisson
.
getLock
(
"close-order"
);
RLock
lock
=
redisson
.
getLock
(
"close-order"
);
// 加锁,避免集群环境下多个节点同事运行此定时任务
// 加锁,避免集群环境下多个节点同事运行此定时任务
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
try
{
log
.
warn
(
"关单任务正在运行中"
);
if
(!
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
))
{
log
.
warn
(
"关单任务正在运行中"
);
return
;
}
}
catch
(
InterruptedException
e
)
{
return
;
return
;
}
}
try
{
try
{
...
...
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