记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
f908ce0f
Commit
f908ce0f
authored
Dec 02, 2021
by
Tice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加审核逻辑
parent
f023b74c
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
206 additions
and
58 deletions
+206
-58
MerchantAuthorizationConst.java
...service/merchant/constant/MerchantAuthorizationConst.java
+7
-5
IMerchantAuthorizationRecordsAdminService.java
...nt/service/IMerchantAuthorizationRecordsAdminService.java
+2
-0
MerchantAuthorizationRecordsAdminServiceImpl.java
...ce/impl/MerchantAuthorizationRecordsAdminServiceImpl.java
+138
-4
MerchantMongoUtil.java
...ient/admin/zhengzai/merchant/utils/MerchantMongoUtil.java
+2
-0
MerchantRedisUtil.java
...ient/admin/zhengzai/merchant/utils/MerchantRedisUtil.java
+5
-5
MerchantMongoService.java
...uidnet/service/merchant/service/MerchantMongoService.java
+19
-0
MerchantAuthorizationRecordsServiceImpl.java
...service/impl/MerchantAuthorizationRecordsServiceImpl.java
+12
-10
MerchantFieldAppliesServiceImpl.java
...erchant/service/impl/MerchantFieldAppliesServiceImpl.java
+10
-8
MerchantFieldsServiceImpl.java
...vice/merchant/service/impl/MerchantFieldsServiceImpl.java
+4
-4
MerchantSponsorAppliesServiceImpl.java
...chant/service/impl/MerchantSponsorAppliesServiceImpl.java
+7
-12
MerchantSponsorsServiceImpl.java
...ce/merchant/service/impl/MerchantSponsorsServiceImpl.java
+0
-10
No files found.
liquidnet-bus-api/liquidnet-service-merchant-api/src/main/java/com/liquidnet/service/merchant/constant/MerchantAuthorizationConst.java
View file @
f908ce0f
...
...
@@ -9,7 +9,8 @@ public class MerchantAuthorizationConst {
LINE
(
"3"
,
"上下线"
),
SALES
(
"4"
,
"销售统计"
),
CHECK
(
"5"
,
"验票"
),
ACCREDIT
(
"6"
,
"授权"
);
GRANT
(
"6"
,
"授权"
),
AUDIT
(
"7"
,
"审核"
);
private
final
String
id
;
private
final
String
name
;
...
...
@@ -29,10 +30,11 @@ public class MerchantAuthorizationConst {
}
public
enum
PerformanceRole
{
CREATOR
(
"CREATOR"
,
"创建者"
,
4
),
SPONSOR
(
"SPONSOR"
,
"主办方"
,
3
),
FIELDER
(
"FIELDER"
,
"场地方"
,
2
),
CHECKER
(
"CHECKER"
,
"验票员"
,
1
);
CREATOR
(
"CREATOR"
,
"创建者"
,
50
),
SPONSOR
(
"SPONSOR"
,
"主办方"
,
40
),
FIELDER
(
"FIELDER"
,
"场地方"
,
30
),
CHECKER
(
"CHECKER"
,
"验票员"
,
20
),
AUDITOR
(
"AUDITOR"
,
"审核员"
,
10
);
private
final
String
role
;
private
final
String
name
;
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/merchant/service/IMerchantAuthorizationRecordsAdminService.java
View file @
f908ce0f
...
...
@@ -5,6 +5,8 @@ import com.liquidnet.service.merchant.entity.MerchantAuthorizationRecords;
public
interface
IMerchantAuthorizationRecordsAdminService
extends
IService
<
MerchantAuthorizationRecords
>
{
void
authorizationAudit
(
String
performanceId
,
String
cuid
,
String
fieldId
);
void
authorizationInit
(
String
performanceId
,
String
cuid
,
String
fieldId
,
String
sponsorId
);
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/merchant/service/impl/MerchantAuthorizationRecordsAdminServiceImpl.java
View file @
f908ce0f
...
...
@@ -54,6 +54,23 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
@Autowired
IMerchantAuthorizationPermissionsAdminService
authorizationPermissionsAdminService
;
@Override
@Transactional
public
void
authorizationAudit
(
String
performanceId
,
String
cuid
,
String
fieldId
)
{
// 创建者
List
<
String
>
updatedUids1
=
this
.
performanceCreator
(
performanceId
,
cuid
);
Set
<
String
>
updatedUids
=
new
HashSet
<>(
updatedUids1
);
// 审核员(场地方审核)
List
<
String
>
updatedUids2
=
this
.
performanceAuditor
(
performanceId
,
fieldId
);
updatedUids
.
addAll
(
updatedUids2
);
// 聚合角色及权限 vo mongo
for
(
String
uid:
updatedUids
)
{
merchantMongoUtil
.
getAndSyncAuthorizationPerformanceVo
(
performanceId
,
uid
);
}
}
@Override
@Transactional
public
void
authorizationInit
(
String
performanceId
,
String
cuid
,
String
fieldId
,
String
sponsorId
)
{
...
...
@@ -75,7 +92,7 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
}
}
// 创建者
//
授权
创建者
private
List
<
String
>
performanceCreator
(
String
performanceId
,
String
cuid
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -127,7 +144,7 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
MerchantAuthorizationConst
.
PerformancePermission
.
LINE
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
CHECK
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
SALES
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
ACCREDI
T
.
getId
()
MerchantAuthorizationConst
.
PerformancePermission
.
GRAN
T
.
getId
()
};
for
(
String
permissionId
:
fielderPermissionIds
)
{
// entity
...
...
@@ -171,6 +188,123 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
return
updatedUids
;
}
// 授权审核员(场地方审核)
private
List
<
String
>
performanceAuditor
(
String
performanceId
,
String
fieldId
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
String
>
updatedUids
=
new
ArrayList
<>();
// 查询已有权限
LambdaQueryWrapper
<
MerchantAuthorizationRecords
>
authorizationRecordsLambdaQueryWrapper
=
Wrappers
.
lambdaQuery
(
MerchantAuthorizationRecords
.
class
);
authorizationRecordsLambdaQueryWrapper
.
eq
(
MerchantAuthorizationRecords:
:
getPerformanceId
,
performanceId
);
authorizationRecordsLambdaQueryWrapper
.
eq
(
MerchantAuthorizationRecords:
:
getUidRole
,
MerchantAuthorizationConst
.
PerformanceRole
.
AUDITOR
.
getRole
());
authorizationRecordsLambdaQueryWrapper
.
eq
(
MerchantAuthorizationRecords:
:
getDeletedAt
,
null
);
MerchantAuthorizationRecords
authorizationRecords
=
getOne
(
authorizationRecordsLambdaQueryWrapper
);
// 查询审核员
LambdaQueryWrapper
<
MerchantFields
>
fieldsLambdaQueryWrapper
=
Wrappers
.
lambdaQuery
(
MerchantFields
.
class
);
fieldsLambdaQueryWrapper
.
eq
(
MerchantFields:
:
getFieldId
,
fieldId
);
MerchantFields
fields
=
fieldsAdminService
.
getOne
(
fieldsLambdaQueryWrapper
);
// 是否已存在权限
if
(
null
!=
authorizationRecords
)
{
if
(
null
!=
fields
&&
authorizationRecords
.
getUid
().
equals
(
fields
.
getUid
()))
{
// 前后 审核员一致 不处理
return
updatedUids
;
}
// 前后 审核员不一致 删除旧权限 (审核员无授权权限)
authorizationRecords
.
setUpdatedAt
(
now
);
authorizationRecords
.
setDeletedAt
(
now
);
// 查询删除 旧权限 mysql
LambdaUpdateWrapper
<
MerchantAuthorizationRecords
>
authorizationRecordsLambdaUpdateWrapper
=
Wrappers
.
lambdaUpdate
(
MerchantAuthorizationRecords
.
class
);
authorizationRecordsLambdaUpdateWrapper
.
eq
(
MerchantAuthorizationRecords:
:
getPerformanceId
,
performanceId
)
.
eq
(
MerchantAuthorizationRecords:
:
getDeletedAt
,
null
)
.
eq
(
MerchantAuthorizationRecords:
:
getAuthorizationRecordId
,
authorizationRecords
.
getAuthorizationRecordId
());
authorizationRecordsLambdaUpdateWrapper
.
set
(
MerchantAuthorizationRecords:
:
getUpdatedAt
,
authorizationRecords
.
getUpdatedAt
());
authorizationRecordsLambdaUpdateWrapper
.
set
(
MerchantAuthorizationRecords:
:
getDeletedAt
,
authorizationRecords
.
getDeletedAt
());
boolean
success
=
update
(
authorizationRecordsLambdaUpdateWrapper
);
if
(!
success
)
{
// todo error
throw
new
LiquidnetServiceException
();
}
// 查询删除 旧权限 mongo
Criteria
criteria
=
Criteria
.
where
(
"performanceId"
).
is
(
performanceId
).
and
(
"deletedAt"
).
is
(
null
).
and
(
"authorizationRecordId"
).
is
(
authorizationRecords
.
getAuthorizationRecordId
());
Query
query
=
Query
.
query
(
criteria
);
mongoTemplate
.
remove
(
query
,
MerchantAuthorizationRecordsVo
.
class
,
MerchantAuthorizationRecordsVo
.
class
.
getSimpleName
());
// updated uid
updatedUids
.
add
(
authorizationRecords
.
getUid
());
}
// 是否添加权限
if
(
null
!=
fields
&&
!
fields
.
getUid
().
isEmpty
())
{
List
<
MerchantAuthorizationRecords
>
authorizationRecordsArrayList
=
new
ArrayList
<>();
List
<
MerchantAuthorizationPermissions
>
authorizationPermissionsArrayList
=
new
ArrayList
<>();
// 授权记录 entity
// todo 用户信息
MerchantAuthorizationRecords
auditorAuthorizationRecords
=
new
MerchantAuthorizationRecords
();
auditorAuthorizationRecords
.
setAuthorizationRecordId
(
IDGenerator
.
nextSnowId
());
auditorAuthorizationRecords
.
setPerformanceId
(
performanceId
);
auditorAuthorizationRecords
.
setUidRole
(
MerchantAuthorizationConst
.
PerformanceRole
.
AUDITOR
.
getRole
());
auditorAuthorizationRecords
.
setUid
(
fields
.
getUid
());
auditorAuthorizationRecords
.
setMobile
(
""
);
auditorAuthorizationRecords
.
setName
(
""
);
auditorAuthorizationRecords
.
setCuid
(
""
);
auditorAuthorizationRecords
.
setCuidRole
(
""
);
auditorAuthorizationRecords
.
setCreatedAt
(
now
);
authorizationRecordsArrayList
.
add
(
auditorAuthorizationRecords
);
// 授权权限 entity vo
List
<
MerchantAuthorizationPermissionsVo
>
auditorAuthorizationPermissionsVos
=
new
ArrayList
<>();
String
[]
fielderPermissionIds
=
{
MerchantAuthorizationConst
.
PerformancePermission
.
READ
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
AUDIT
.
getId
()
};
for
(
String
permissionId
:
fielderPermissionIds
)
{
MerchantAuthorizationPermissions
auditorAuthorizationPermissions
=
new
MerchantAuthorizationPermissions
();
auditorAuthorizationPermissions
.
setAuthorizationPermissionId
(
IDGenerator
.
nextSnowId
());
auditorAuthorizationPermissions
.
setAuthorizationRecordId
(
auditorAuthorizationRecords
.
getAuthorizationRecordId
());
auditorAuthorizationPermissions
.
setPermissionId
(
permissionId
);
auditorAuthorizationPermissions
.
setStartTime
(
now
);
auditorAuthorizationPermissions
.
setEndTime
(
now
.
plusYears
(
10
));
auditorAuthorizationPermissions
.
setCreatedAt
(
now
);
authorizationPermissionsArrayList
.
add
(
auditorAuthorizationPermissions
);
MerchantAuthorizationPermissionsVo
sponsorAuthorizationPermissionsVo
=
MerchantAuthorizationPermissionsVo
.
getNew
();
sponsorAuthorizationPermissionsVo
.
copy
(
auditorAuthorizationPermissions
);
auditorAuthorizationPermissionsVos
.
add
(
sponsorAuthorizationPermissionsVo
);
}
// 授权记录 vo
MerchantAuthorizationRecordsVo
auditorAuthorizationRecordsVo
=
MerchantAuthorizationRecordsVo
.
getNew
();
auditorAuthorizationRecordsVo
.
copy
(
auditorAuthorizationRecords
);
auditorAuthorizationRecordsVo
.
setPermissionsVos
(
auditorAuthorizationPermissionsVos
);
// mysql
boolean
success
=
saveBatch
(
authorizationRecordsArrayList
);
if
(!
success
)
{
// todo error
throw
new
LiquidnetServiceException
();
}
success
=
authorizationPermissionsAdminService
.
saveBatch
(
authorizationPermissionsArrayList
);
if
(!
success
)
{
// todo error
throw
new
LiquidnetServiceException
();
}
// mongo
mongoTemplate
.
insert
(
auditorAuthorizationRecordsVo
,
MerchantAuthorizationRecordsVo
.
class
.
getSimpleName
());
// updated uid
updatedUids
.
add
(
auditorAuthorizationRecordsVo
.
getUid
());
}
return
updatedUids
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
// 授权主办方
private
List
<
String
>
performanceSponsor
(
String
performanceId
,
String
sponsorId
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -259,7 +393,7 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
MerchantAuthorizationConst
.
PerformancePermission
.
READ
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
CHECK
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
SALES
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
ACCREDI
T
.
getId
()
MerchantAuthorizationConst
.
PerformancePermission
.
GRAN
T
.
getId
()
};
for
(
String
permissionId
:
fielderPermissionIds
)
{
MerchantAuthorizationPermissions
sponsorAuthorizationPermissions
=
new
MerchantAuthorizationPermissions
();
...
...
@@ -391,7 +525,7 @@ public class MerchantAuthorizationRecordsAdminServiceImpl extends ServiceImpl<Me
String
[]
fielderPermissionIds
=
{
MerchantAuthorizationConst
.
PerformancePermission
.
READ
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
CHECK
.
getId
(),
MerchantAuthorizationConst
.
PerformancePermission
.
ACCREDI
T
.
getId
()
MerchantAuthorizationConst
.
PerformancePermission
.
GRAN
T
.
getId
()
};
for
(
String
permissionId
:
fielderPermissionIds
)
{
MerchantAuthorizationPermissions
fielderAuthorizationPermissions
=
new
MerchantAuthorizationPermissions
();
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/merchant/utils/MerchantMongoUtil.java
View file @
f908ce0f
...
...
@@ -45,6 +45,7 @@ public class MerchantMongoUtil {
mongoTemplate
.
upsert
(
query
,
update
,
MerchantSponsorsVo
.
class
,
MerchantSponsorsVo
.
class
.
getSimpleName
());
}
public
MerchantAuthorizationPerformanceVo
getAuthorizationPerformanceVo
(
String
performanceId
,
String
uid
)
{
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"performanceId"
).
is
(
performanceId
).
and
(
"uid"
).
is
(
uid
)),
MerchantAuthorizationPerformanceVo
.
class
,
MerchantAuthorizationPerformanceVo
.
class
.
getSimpleName
());
}
...
...
@@ -77,6 +78,7 @@ public class MerchantMongoUtil {
return
vo
;
}
public
List
<
MerchantFieldAppliesVo
>
getFieldAppliesVosByUid
(
String
uid
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"uid"
).
is
(
uid
).
and
(
"deletedAt"
).
is
(
null
));
return
mongoTemplate
.
find
(
query
,
MerchantFieldAppliesVo
.
class
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
());
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/merchant/utils/MerchantRedisUtil.java
View file @
f908ce0f
...
...
@@ -19,7 +19,7 @@ public class MerchantRedisUtil {
RedisDataSourceUtil
redisDataSourceUtil
;
@Autowired
MerchantMongoUtil
mongoUtil
;
MerchantMongoUtil
m
erchantM
ongoUtil
;
// 【场地】获取详情
public
MerchantFieldsVo
getFieldsVoByFieldId
(
String
fieldId
)
{
...
...
@@ -31,7 +31,7 @@ public class MerchantRedisUtil {
MerchantFieldsVo
vo
=
(
MerchantFieldsVo
)
redisDataSourceUtil
.
getRedisKylinUtil
().
get
(
key
);
log
.
debug
(
"#RDM耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
if
(
null
==
vo
)
{
vo
=
mongoUtil
.
getFieldsVoByFieldId
(
fieldId
);
vo
=
m
erchantM
ongoUtil
.
getFieldsVoByFieldId
(
fieldId
);
redisDataSourceUtil
.
getRedisKylinUtil
().
set
(
key
,
vo
);
}
return
vo
;
...
...
@@ -53,7 +53,7 @@ public class MerchantRedisUtil {
List
<
MerchantFieldAppliesVo
>
vos
=
(
List
<
MerchantFieldAppliesVo
>)
redisDataSourceUtil
.
getRedisKylinUtil
().
get
(
key
);
log
.
debug
(
"#RDM耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
if
(
null
==
vos
)
{
vos
=
mongoUtil
.
getFieldAppliesVosByUid
(
uid
);
vos
=
m
erchantM
ongoUtil
.
getFieldAppliesVosByUid
(
uid
);
redisDataSourceUtil
.
getRedisKylinUtil
().
set
(
key
,
vos
);
}
return
vos
;
...
...
@@ -135,7 +135,7 @@ public class MerchantRedisUtil {
MerchantSponsorsVo
vo
=
(
MerchantSponsorsVo
)
redisDataSourceUtil
.
getRedisKylinUtil
().
get
(
key
);
log
.
debug
(
"#RDM耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
if
(
null
==
vo
)
{
vo
=
mongoUtil
.
getSponsorsVoBySponsorId
(
sponsorId
);
vo
=
m
erchantM
ongoUtil
.
getSponsorsVoBySponsorId
(
sponsorId
);
redisDataSourceUtil
.
getRedisKylinUtil
().
set
(
key
,
vo
);
}
return
vo
;
...
...
@@ -156,7 +156,7 @@ public class MerchantRedisUtil {
List
<
MerchantSponsorAppliesVo
>
vos
=
(
List
<
MerchantSponsorAppliesVo
>)
redisDataSourceUtil
.
getRedisKylinUtil
().
get
(
key
);
log
.
debug
(
"#RDM耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
if
(
null
==
vos
)
{
vos
=
mongoUtil
.
getSponsorAppliesVosByUid
(
uid
);
vos
=
m
erchantM
ongoUtil
.
getSponsorAppliesVosByUid
(
uid
);
redisDataSourceUtil
.
getRedisKylinUtil
().
set
(
key
,
vos
);
}
return
vos
;
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/MerchantMongoService.java
View file @
f908ce0f
...
...
@@ -84,10 +84,29 @@ public class MerchantMongoService {
return
mongoTemplate
.
find
(
Query
.
query
(
Criteria
.
where
(
"uid"
).
is
(
uid
).
and
(
"deletedAt"
).
is
(
null
)),
MerchantFieldAppliesVo
.
class
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
());
}
public
MerchantFieldAppliesVo
addFieldAppliesVo
(
MerchantFieldAppliesVo
vo
)
{
return
mongoTemplate
.
insert
(
vo
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
());
}
public
void
delFieldAppliesVoByFieldApplyId
(
String
fieldApplyId
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"fieldApplyId"
).
is
(
fieldApplyId
));
mongoTemplate
.
remove
(
query
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
());
}
public
List
<
MerchantSponsorAppliesVo
>
getSponsorAppliesVosByUid
(
String
uid
)
{
return
mongoTemplate
.
find
(
Query
.
query
(
Criteria
.
where
(
"uid"
).
is
(
uid
).
and
(
"deletedAt"
).
is
(
null
)),
MerchantSponsorAppliesVo
.
class
,
MerchantSponsorAppliesVo
.
class
.
getSimpleName
());
}
public
MerchantSponsorAppliesVo
addSponsorAppliesVo
(
MerchantSponsorAppliesVo
vo
)
{
return
mongoTemplate
.
insert
(
vo
,
MerchantSponsorAppliesVo
.
class
.
getSimpleName
());
}
public
void
delSponsorAppliesVoBySponsorApplyId
(
String
sponsorApplyId
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"sponsorApplyId"
).
is
(
sponsorApplyId
));
mongoTemplate
.
remove
(
query
,
MerchantSponsorAppliesVo
.
class
.
getSimpleName
());
}
public
MerchantAuthorizationRecordsVo
getAuthorizationRecordsVoByAuthorizationRecordId
(
String
authorizationRecordId
)
{
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"authorizationRecordId"
).
is
(
authorizationRecordId
).
and
(
"deletedAt"
).
is
(
null
)),
MerchantAuthorizationRecordsVo
.
class
,
MerchantAuthorizationRecordsVo
.
class
.
getSimpleName
());
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/impl/MerchantAuthorizationRecordsServiceImpl.java
View file @
f908ce0f
...
...
@@ -41,7 +41,7 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
MongoTemplate
mongoTemplate
;
@Autowired
QueueUtil
queueUtil
s
;
QueueUtil
queueUtil
;
@Override
public
MerchantAuthorizationPerformanceVo
performanceAuthorization
(
String
uid
,
String
performanceId
)
{
...
...
@@ -100,13 +100,13 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
}
}
// 获取最大权限角色
MerchantAuthorizationConst
.
PerformanceRole
maxPerformanceRole
=
this
.
getMaxPerformanceRole
(
cuid
,
parameter
.
getPerformanceId
());
if
(
null
==
maxPerformanceRole
||
maxPerformanceRole
.
getLevel
()
<=
MerchantAuthorizationConst
.
PerformanceRole
.
CHECKER
.
getLevel
()
)
{
MerchantAuthorizationConst
.
PerformanceRole
maxPerformanceRole
=
this
.
getMax
Grant
PerformanceRole
(
cuid
,
parameter
.
getPerformanceId
());
if
(
null
==
maxPerformanceRole
)
{
// 无授权权限
ErrorMapping
.
ErrorMessage
errorMessage
=
ErrorMapping
.
get
(
"13301"
);
throw
new
LiquidnetServiceException
(
errorMessage
.
getCode
(),
errorMessage
.
getMessage
());
}
if
(
null
!=
salesPermissionParam
&&
maxPerformanceRole
.
getLevel
()
<=
MerchantAuthorizationConst
.
PerformanceRole
.
FIELDER
.
getLevel
(
))
{
if
(
null
!=
salesPermissionParam
&&
(!
maxPerformanceRole
.
equals
(
MerchantAuthorizationConst
.
PerformanceRole
.
CREATOR
)
&&
!
maxPerformanceRole
.
equals
(
MerchantAuthorizationConst
.
PerformanceRole
.
SPONSOR
)
))
{
// 无权限授于统计权限
ErrorMapping
.
ErrorMessage
errorMessage
=
ErrorMapping
.
get
(
"13302"
);
throw
new
LiquidnetServiceException
(
errorMessage
.
getCode
(),
errorMessage
.
getMessage
());
...
...
@@ -188,7 +188,7 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
authorizationRecordsInsertObjs
,
authorizationPermissionsInsertObjs
)
);
...
...
@@ -231,7 +231,7 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
authorizationRecordsUpdateObjs
)
);
...
...
@@ -239,8 +239,8 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
}
private
MerchantAuthorizationConst
.
PerformanceRole
getMaxPerformanceRole
(
String
uid
,
String
performanceId
)
{
// 获取最大授权角色
private
MerchantAuthorizationConst
.
PerformanceRole
getMax
Grant
PerformanceRole
(
String
uid
,
String
performanceId
)
{
MerchantAuthorizationPerformanceVo
authorizationPerformanceVo
=
merchantMongoService
.
getAuthorizationPerformanceVo
(
performanceId
,
uid
);
if
(
null
==
authorizationPerformanceVo
)
{
return
null
;
...
...
@@ -252,10 +252,12 @@ public class MerchantAuthorizationRecordsServiceImpl implements IMerchantAuthori
MerchantAuthorizationConst
.
PerformanceRole
maxRole
=
MerchantAuthorizationConst
.
PerformanceRole
.
valueOf
(
authorizationPerformanceVo
.
getUidRoles
().
get
(
0
));
for
(
String
uidRole
:
authorizationPerformanceVo
.
getUidRoles
())
{
MerchantAuthorizationConst
.
PerformanceRole
role
=
MerchantAuthorizationConst
.
PerformanceRole
.
valueOf
(
uidRole
);
if
(!
role
.
equals
(
MerchantAuthorizationConst
.
PerformanceRole
.
AUDITOR
)
&&
!
role
.
equals
(
MerchantAuthorizationConst
.
PerformanceRole
.
CHECKER
))
{
if
(
role
.
getLevel
()
>
maxRole
.
getLevel
())
{
maxRole
=
role
;
}
}
}
return
maxRole
;
}
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/impl/MerchantFieldAppliesServiceImpl.java
View file @
f908ce0f
...
...
@@ -10,6 +10,7 @@ import com.liquidnet.service.merchant.dto.param.MerchantFieldApplyParam;
import
com.liquidnet.service.merchant.dto.vo.MerchantFieldAppliesVo
;
import
com.liquidnet.service.merchant.dto.vo.MerchantFieldsVo
;
import
com.liquidnet.service.merchant.service.IMerchantFieldAppliesService
;
import
com.liquidnet.service.merchant.service.MerchantMongoService
;
import
com.liquidnet.service.merchant.service.MerchantRdmService
;
import
com.liquidnet.service.merchant.util.QueueUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -36,11 +37,14 @@ public class MerchantFieldAppliesServiceImpl implements IMerchantFieldAppliesSer
@Autowired
MerchantRdmService
merchantRdmService
;
@Autowired
MerchantMongoService
merchantMongoService
;
@Autowired
MongoTemplate
mongoTemplate
;
@Autowired
QueueUtil
queueUtil
s
;
QueueUtil
queueUtil
;
@Override
public
String
apply
(
String
uid
,
MerchantFieldApplyParam
parameter
)
{
...
...
@@ -125,7 +129,7 @@ public class MerchantFieldAppliesServiceImpl implements IMerchantFieldAppliesSer
// 申请场地 mongo
s
=
System
.
currentTimeMillis
();
m
ongoTemplate
.
insert
(
fieldAppliesVo
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
()
);
m
erchantMongoService
.
addFieldAppliesVo
(
fieldAppliesVo
);
log
.
debug
(
"#MONGO耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
if
(
null
!=
fieldsVo
)
{
...
...
@@ -149,12 +153,12 @@ public class MerchantFieldAppliesServiceImpl implements IMerchantFieldAppliesSer
// mq
s
=
System
.
currentTimeMillis
();
if
(
null
!=
fieldsVo
)
{
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldUpdateObjs
,
fieldApplyInsertObjs
)
);
}
else
{
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldApplyInsertObjs
)
);
...
...
@@ -197,9 +201,7 @@ public class MerchantFieldAppliesServiceImpl implements IMerchantFieldAppliesSer
// 申请场地 mongo
s
=
System
.
currentTimeMillis
();
Query
query
=
Query
.
query
(
Criteria
.
where
(
"fieldApplyId"
).
is
(
fieldAppliesVo
.
getFieldApplyId
()));
Update
update
=
Update
.
update
(
"updatedAt"
,
fieldAppliesVo
.
getUpdatedAt
()).
set
(
"deletedAt"
,
fieldAppliesVo
.
getDeletedAt
());
mongoTemplate
.
updateFirst
(
query
,
update
,
MerchantFieldAppliesVo
.
class
,
MerchantFieldAppliesVo
.
class
.
getSimpleName
());
merchantMongoService
.
delFieldAppliesVoByFieldApplyId
(
fieldAppliesVo
.
getFieldApplyId
());
log
.
debug
(
"#MONGO耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
// 申请场地 sql
...
...
@@ -212,7 +214,7 @@ public class MerchantFieldAppliesServiceImpl implements IMerchantFieldAppliesSer
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldAppliesUpdateObjs
)
);
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/impl/MerchantFieldsServiceImpl.java
View file @
f908ce0f
...
...
@@ -47,7 +47,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
MongoTemplate
mongoTemplate
;
@Autowired
QueueUtil
queueUtil
s
;
QueueUtil
queueUtil
;
@Override
public
PagedResult
<
MerchantFieldsVo
>
search
(
String
name
,
int
page
,
int
size
)
{
...
...
@@ -132,7 +132,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldUpdateObjs
)
);
...
...
@@ -204,7 +204,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldCheckerInsertObjs
)
);
...
...
@@ -255,7 +255,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_FIELD
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
fieldCheckerUpdateObjs
)
);
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/impl/MerchantSponsorAppliesServiceImpl.java
View file @
f908ce0f
...
...
@@ -12,15 +12,12 @@ import com.liquidnet.service.base.constant.MQConst;
import
com.liquidnet.service.merchant.dto.param.MerchantSponsorApplyParam
;
import
com.liquidnet.service.merchant.dto.vo.MerchantSponsorAppliesVo
;
import
com.liquidnet.service.merchant.service.IMerchantSponsorAppliesService
;
import
com.liquidnet.service.merchant.service.MerchantMongoService
;
import
com.liquidnet.service.merchant.service.MerchantRdmService
;
import
com.liquidnet.service.merchant.util.QueueUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -37,10 +34,10 @@ public class MerchantSponsorAppliesServiceImpl implements IMerchantSponsorApplie
MerchantRdmService
merchantRdmService
;
@Autowired
M
ongoTemplate
mongoTemplat
e
;
M
erchantMongoService
merchantMongoServic
e
;
@Autowired
QueueUtil
queueUtil
s
;
QueueUtil
queueUtil
;
@Override
public
String
apply
(
String
uid
,
MerchantSponsorApplyParam
parameter
)
{
...
...
@@ -114,7 +111,7 @@ public class MerchantSponsorAppliesServiceImpl implements IMerchantSponsorApplie
// 申请主办 mongo
s
=
System
.
currentTimeMillis
();
m
ongoTemplate
.
insert
(
sponsorAppliesVo
,
MerchantSponsorAppliesVo
.
class
.
getSimpleName
()
);
m
erchantMongoService
.
addSponsorAppliesVo
(
sponsorAppliesVo
);
log
.
debug
(
"#MONGO耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
// 申请主办 sql
...
...
@@ -129,7 +126,7 @@ public class MerchantSponsorAppliesServiceImpl implements IMerchantSponsorApplie
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_SPONSOR
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
sponsorApplyInsertObjs
)
);
...
...
@@ -171,9 +168,7 @@ public class MerchantSponsorAppliesServiceImpl implements IMerchantSponsorApplie
// 主办申请 mongo
s
=
System
.
currentTimeMillis
();
Query
query
=
Query
.
query
(
Criteria
.
where
(
"sponsorApplyId"
).
is
(
sponsorAppliesVo
.
getSponsorApplyId
()));
Update
update
=
Update
.
update
(
"updatedAt"
,
sponsorAppliesVo
.
getUpdatedAt
()).
set
(
"deletedAt"
,
sponsorAppliesVo
.
getDeletedAt
());
mongoTemplate
.
updateFirst
(
query
,
update
,
MerchantSponsorAppliesVo
.
class
,
MerchantSponsorAppliesVo
.
class
.
getSimpleName
());
merchantMongoService
.
delSponsorAppliesVoBySponsorApplyId
(
sponsorAppliesVo
.
getSponsorApplyId
());
log
.
debug
(
"#MONGO耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
// 主办申请 sql
...
...
@@ -186,7 +181,7 @@ public class MerchantSponsorAppliesServiceImpl implements IMerchantSponsorApplie
// mq
s
=
System
.
currentTimeMillis
();
queueUtil
s
.
sendMsgByRedis
(
queueUtil
.
sendMsgByRedis
(
MQConst
.
MerchantQueue
.
SQL_MERCHANT_SPONSOR
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
sponsorAppliesUpdateObjs
)
);
...
...
liquidnet-bus-service/liquidnet-service-merchant/liquidnet-service-merchant-impl/src/main/java/com/liquidnet/service/merchant/service/impl/MerchantSponsorsServiceImpl.java
View file @
f908ce0f
package
com
.
liquidnet
.
service
.
merchant
.
service
.
impl
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.PagedResult
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.merchant.dto.vo.MerchantSponsorsVo
;
import
com.liquidnet.service.merchant.service.IMerchantSponsorsService
;
import
com.liquidnet.service.merchant.service.MerchantMongoService
;
import
com.liquidnet.service.merchant.service.MerchantRdmService
;
import
com.liquidnet.service.merchant.util.ObjectUtil
;
import
com.liquidnet.service.merchant.util.QueueUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -23,8 +18,6 @@ import org.springframework.data.mongodb.core.query.Criteria;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.regex.Pattern
;
...
...
@@ -41,9 +34,6 @@ public class MerchantSponsorsServiceImpl implements IMerchantSponsorsService {
@Autowired
MongoTemplate
mongoTemplate
;
@Autowired
QueueUtil
queueUtils
;
@Override
public
PagedResult
<
MerchantSponsorsVo
>
search
(
String
name
,
int
page
,
int
size
)
{
// 查询条件
...
...
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