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
b836bdb3
Commit
b836bdb3
authored
May 24, 2022
by
33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增版权审核操作记录
parent
fbcc355c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
199 additions
and
15 deletions
+199
-15
CopyrightTask.java
...n/src/main/java/com/fzm/admin/schedule/CopyrightTask.java
+16
-5
CopyrightLog.java
...mon/src/main/java/com/fzm/common/entity/CopyrightLog.java
+27
-0
CopyrightLogType.java
.../src/main/java/com/fzm/common/enums/CopyrightLogType.java
+37
-0
CopyrightLogMapper.java
...c/main/java/com/fzm/common/mapper/CopyrightLogMapper.java
+14
-0
CopyrightLogService.java
...main/java/com/fzm/common/service/CopyrightLogService.java
+18
-0
CopyrightApplyServiceImpl.java
...om/fzm/common/service/impl/CopyrightApplyServiceImpl.java
+9
-0
CopyrightLogServiceImpl.java
.../com/fzm/common/service/impl/CopyrightLogServiceImpl.java
+59
-0
OrderServiceImpl.java
...in/java/com/fzm/common/service/impl/OrderServiceImpl.java
+19
-10
No files found.
joying-admin/src/main/java/com/fzm/admin/schedule/CopyrightTask.java
View file @
b836bdb3
...
...
@@ -7,6 +7,7 @@ import cn.hutool.http.HttpUtil;
import
cn.hutool.json.JSONUtil
;
import
com.fzm.common.config.RabbitMQConfig
;
import
com.fzm.common.entity.CopyrightApply
;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.entity.Nft
;
import
com.fzm.common.entity.Order
;
import
com.fzm.common.entity.dto.CopyrightQueryRequest
;
...
...
@@ -19,10 +20,7 @@ import com.fzm.common.enums.PayScene;
import
com.fzm.common.enums.RefundLaunchChannel
;
import
com.fzm.common.mq.NotifyPublisher
;
import
com.fzm.common.properties.CopyrightProperties
;
import
com.fzm.common.service.CopyrightApplyService
;
import
com.fzm.common.service.NftService
;
import
com.fzm.common.service.OrderService
;
import
com.fzm.common.service.WxPayService
;
import
com.fzm.common.service.*
;
import
com.fzm.common.utils.CopyrightSignUtil
;
import
com.fzm.common.utils.JsonUtil
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -60,6 +58,7 @@ public class CopyrightTask {
private
final
WxPayService
wxPayService
;
private
final
OrderService
orderService
;
private
final
NotifyPublisher
notifyPublisher
;
private
final
CopyrightLogService
copyrightLogService
;
@Value
(
"${chain.para.cAddr}"
)
private
String
contractAddr
;
...
...
@@ -111,6 +110,7 @@ public class CopyrightTask {
continue
;
}
CopyrightApply
copyrightApply
=
copyrightApplyService
.
getBySerialNum
(
serial_code
);
Integer
copyrightApplyId
=
copyrightApply
.
getId
();
// 审核状态(0:未提交,1:待审核,2:同意,3:驳回,4:已提交,5:待终审,6:审核通过)
Integer
audit_status
=
copyrightResponse
.
getAudit_status
();
Integer
registerState
=
getRegisterState
(
audit_status
);
...
...
@@ -149,7 +149,7 @@ public class CopyrightTask {
}
else
if
(
registerState
.
equals
(
CopyrightApplyState
.
FAILED
.
getCode
()))
{
// 审核失败,更新驳回原因,主动发起退款
copyrightApply
.
setRejectReason
(
copyrightResponse
.
getRemark
());
Order
order
=
orderService
.
getByPaySceneAndProductId
(
PayScene
.
COPYRIGHT
.
getCode
(),
copyrightApply
.
getId
()
,
OrderStatus
.
PAYED
.
getStatus
());
Order
order
=
orderService
.
getByPaySceneAndProductId
(
PayScene
.
COPYRIGHT
.
getCode
(),
copyrightApply
Id
,
OrderStatus
.
PAYED
.
getStatus
());
log
.
info
(
"审核失败,更新驳回原因,主动发起退款: {}"
,
order
);
if
(
order
!=
null
)
{
wxPayService
.
refund
(
order
.
getId
(),
RefundLaunchChannel
.
USER
.
getCode
());
...
...
@@ -159,6 +159,17 @@ public class CopyrightTask {
notifyPublisher
.
copyrightApplyFailNotify
(
copyrightApply
.
getUserId
(),
copyrightResponse
.
getRemark
());
}
copyrightApplyService
.
updateById
(
copyrightApply
);
// 保存日志
CopyrightLog
copyrightLog
=
copyrightLogService
.
selectByIdAndType
(
copyrightApplyId
,
registerState
);
if
(
copyrightLog
==
null
)
{
try
{
copyrightLogService
.
saveTask
(
copyrightApplyId
,
registerState
,
copyrightResponse
.
getRemark
());
}
catch
(
Exception
ignored
)
{
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"更新版权状态发送异常, 当前流水号为:{}"
,
serial_code
);
log
.
error
(
e
.
getMessage
(),
e
);
...
...
joying-common/src/main/java/com/fzm/common/entity/CopyrightLog.java
0 → 100644
View file @
b836bdb3
package
com
.
fzm
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author wt
* @date 2022/5/24
*/
@Data
@TableName
(
"tb_copyright_log"
)
public
class
CopyrightLog
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
Integer
copyrightId
;
private
Integer
opTypeId
;
private
String
opType
;
private
String
opInfo
;
private
Integer
opUserId
;
private
String
opUserName
;
private
Date
opTime
;
}
joying-common/src/main/java/com/fzm/common/enums/CopyrightLogType.java
0 → 100644
View file @
b836bdb3
package
com
.
fzm
.
common
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author wt
* @date 2022/5/24
*/
@Getter
@AllArgsConstructor
public
enum
CopyrightLogType
{
submit
(
10
,
"提交"
),
withdraw
(
11
,
"撤回"
),
cancel
(
12
,
"撤回"
),
pass
(
13
,
"平台通过"
),
reject
(
14
,
"平台驳回"
),
to_be_reviewed
(
0
,
"版权局领件"
),
failed
(
5
,
"版权局驳回"
),
examine
(
6
,
"版权局审核"
),
FINAL_JUDGMENT
(
7
,
"版权局终审"
),
SUCCEEDED
(
4
,
"版权局通过"
),
;
private
final
int
id
;
private
final
String
type
;
public
static
CopyrightLogType
getById
(
int
id
)
{
for
(
CopyrightLogType
logType
:
CopyrightLogType
.
values
())
{
if
(
logType
.
getId
()
==
id
)
{
return
logType
;
}
}
return
null
;
}
}
joying-common/src/main/java/com/fzm/common/mapper/CopyrightLogMapper.java
0 → 100644
View file @
b836bdb3
package
com
.
fzm
.
common
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.fzm.common.entity.CopyrightLog
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author wt
* @date 2022/5/24
*/
@Mapper
public
interface
CopyrightLogMapper
extends
BaseMapper
<
CopyrightLog
>
{
}
joying-common/src/main/java/com/fzm/common/service/CopyrightLogService.java
0 → 100644
View file @
b836bdb3
package
com
.
fzm
.
common
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.enums.CopyrightLogType
;
/**
* @author wt
* @date 2022/5/24
*/
public
interface
CopyrightLogService
extends
IService
<
CopyrightLog
>
{
void
save
(
Integer
cid
,
CopyrightLogType
copyrightLogType
,
String
opInfo
);
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
);
CopyrightLog
selectByIdAndType
(
Integer
cid
,
Integer
typeId
);
}
joying-common/src/main/java/com/fzm/common/service/impl/CopyrightApplyServiceImpl.java
View file @
b836bdb3
...
...
@@ -93,6 +93,8 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
private
WxPayService
wxPayService
;
@Resource
private
Redisson
redisson
;
@Resource
private
CopyrightLogService
copyrightLogService
;
@Override
...
...
@@ -183,6 +185,9 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
if
(
order
!=
null
)
{
wxPayService
.
refund
(
order
.
getId
(),
RefundLaunchChannel
.
USER
.
getCode
());
}
copyrightLogService
.
save
(
id
,
CopyrightLogType
.
withdraw
,
""
);
return
true
;
}
...
...
@@ -353,6 +358,8 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
// 发送系统消息
notifyPublisher
.
copyrightApplyRejectNotify
(
copyright
.
getUserId
(),
rejectReason
);
copyrightLogService
.
save
(
id
,
CopyrightLogType
.
reject
,
""
);
return
true
;
}
...
...
@@ -404,6 +411,8 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
// 发送系统消息
notifyPublisher
.
copyrightApplyPassNotify
(
copyright
.
getUserId
());
copyrightLogService
.
save
(
id
,
CopyrightLogType
.
pass
,
""
);
return
updateResult
;
}
finally
{
lock
.
unlock
();
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CopyrightLogServiceImpl.java
0 → 100644
View file @
b836bdb3
package
com
.
fzm
.
common
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.fzm.common.entity.CopyrightLog
;
import
com.fzm.common.enums.CopyrightLogType
;
import
com.fzm.common.interceptor.LoginUserInfo
;
import
com.fzm.common.mapper.CopyrightLogMapper
;
import
com.fzm.common.service.CopyrightLogService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* @author wt
* @date 2022/5/24
*/
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
CopyrightLogServiceImpl
extends
ServiceImpl
<
CopyrightLogMapper
,
CopyrightLog
>
implements
CopyrightLogService
{
@Override
public
void
save
(
Integer
cid
,
CopyrightLogType
copyrightLogType
,
String
opInfo
)
{
CopyrightLog
copyrightLog
=
new
CopyrightLog
();
copyrightLog
.
setCopyrightId
(
cid
);
copyrightLog
.
setCopyrightId
(
copyrightLogType
.
getId
());
copyrightLog
.
setOpType
(
copyrightLogType
.
getType
());
copyrightLog
.
setOpInfo
(
opInfo
);
copyrightLog
.
setOpUserId
(
LoginUserInfo
.
getLoginUser
().
getUserId
());
copyrightLog
.
setOpUserName
(
LoginUserInfo
.
getLoginUser
().
getUsername
());
copyrightLog
.
setOpTime
(
new
Date
());
this
.
save
(
copyrightLog
);
}
@Override
public
void
saveTask
(
Integer
cid
,
Integer
typeId
,
String
opInfo
)
{
CopyrightLogType
logType
=
CopyrightLogType
.
getById
(
typeId
);
CopyrightLog
copyrightLog
=
new
CopyrightLog
();
copyrightLog
.
setCopyrightId
(
cid
);
copyrightLog
.
setCopyrightId
(
logType
.
getId
());
copyrightLog
.
setOpType
(
logType
.
getType
());
copyrightLog
.
setOpInfo
(
opInfo
);
copyrightLog
.
setOpUserId
(
0
);
copyrightLog
.
setOpUserName
(
"版权局"
);
copyrightLog
.
setOpTime
(
new
Date
());
this
.
save
(
copyrightLog
);
}
@Override
public
CopyrightLog
selectByIdAndType
(
Integer
cid
,
Integer
typeId
)
{
QueryWrapper
<
CopyrightLog
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"copyright_id"
,
cid
);
queryWrapper
.
eq
(
"op_type_id"
,
typeId
);
return
getOne
(
queryWrapper
);
}
}
joying-common/src/main/java/com/fzm/common/service/impl/OrderServiceImpl.java
View file @
b836bdb3
...
...
@@ -7,10 +7,7 @@ import com.fzm.common.entity.Order;
import
com.fzm.common.entity.dto.OrderDto
;
import
com.fzm.common.entity.dto.OrderProcessMsg
;
import
com.fzm.common.entity.vo.OrderVo
;
import
com.fzm.common.enums.OrderStatus
;
import
com.fzm.common.enums.PayScene
;
import
com.fzm.common.enums.PayType
;
import
com.fzm.common.enums.ResultCode
;
import
com.fzm.common.enums.*
;
import
com.fzm.common.exception.GlobalException
;
import
com.fzm.common.interceptor.LoginUserInfo
;
import
com.fzm.common.mapper.OrderMapper
;
...
...
@@ -47,6 +44,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
private
ChargeService
chargeService
;
@Resource
private
WxPayService
wxPayService
;
@Resource
private
CopyrightLogService
copyrightLogService
;
@Override
public
Order
getByPaySceneAndProductId
(
Integer
payScene
,
Integer
productId
,
Integer
orderStatus
)
{
...
...
@@ -68,21 +67,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Order
createOrder
(
OrderDto
orderDto
)
{
Integer
userId
=
LoginUserInfo
.
getLoginUser
().
getUserId
();
Charge
charge
=
chargeService
.
getByType
(
orderDto
.
getPayScene
());
if
(!
orderDto
.
getFee
().
equals
(
charge
.
getFee
()))
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"订单创建失败, 金额有误"
);
}
Order
successOrder
=
this
.
getByPaySceneAndProductId
(
orderDto
.
getPayScene
(),
orderDto
.
getProductId
(),
OrderStatus
.
PAYED
.
getStatus
());
Integer
productId
=
orderDto
.
getProductId
();
Order
successOrder
=
this
.
getByPaySceneAndProductId
(
orderDto
.
getPayScene
(),
productId
,
OrderStatus
.
PAYED
.
getStatus
());
if
(
successOrder
!=
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"当前产品已支付成功,请勿重复创建订单"
);
}
Order
payingOrder
=
this
.
getByPaySceneAndProductId
(
orderDto
.
getPayScene
(),
orderDto
.
getProductId
()
,
OrderStatus
.
PAYING
.
getStatus
());
Order
payingOrder
=
this
.
getByPaySceneAndProductId
(
orderDto
.
getPayScene
(),
productId
,
OrderStatus
.
PAYING
.
getStatus
());
if
(
payingOrder
!=
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"当前产品有一笔待支付订单,请勿重复创建"
);
}
Order
order
=
new
Order
();
long
id
=
snowflakeUtil
.
snowflakeId
();
Integer
productId
=
orderDto
.
getProductId
();
String
orderName
;
Integer
payScene
=
orderDto
.
getPayScene
();
if
(
PayScene
.
NFT
.
getCode
().
equals
(
payScene
))
{
...
...
@@ -90,15 +91,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
}
else
{
orderName
=
copyrightApplyService
.
getById
(
productId
).
getOpusName
();
}
Date
date
=
new
Date
();
order
.
setId
(
id
);
order
.
setOrderName
(
orderName
);
order
.
setPayScene
(
payScene
);
order
.
setOrderName
(
orderName
);
order
.
setFee
(
orderDto
.
getFee
());
order
.
setProductId
(
productId
);
order
.
setUserId
(
LoginUserInfo
.
getLoginUser
().
getUserId
()
);
order
.
setCreateDate
(
new
Date
()
);
order
.
setUpdateDate
(
new
Date
()
);
order
.
setUserId
(
userId
);
order
.
setCreateDate
(
date
);
order
.
setUpdateDate
(
date
);
Integer
orderStatus
;
if
(
orderDto
.
getFee
()
>
0
)
{
orderStatus
=
OrderStatus
.
PAYING
.
getStatus
();
...
...
@@ -109,6 +111,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
}
order
.
setOrderStatus
(
orderStatus
);
this
.
save
(
order
);
// 记录日志
copyrightLogService
.
save
(
productId
,
CopyrightLogType
.
submit
,
""
);
return
order
;
}
...
...
@@ -135,6 +141,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
}
// 修改订单状态为取消
this
.
updateOrderStatus
(
orderId
,
orderStatus
);
copyrightLogService
.
save
(
productId
,
CopyrightLogType
.
cancel
,
""
);
return
true
;
}
...
...
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