Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 814659b8
authored
Jul 24, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add]
1.添加钉钉用户同步 Redis 接口 2.添加项目经理负责项目报表接口
1 parent
40ad5f18
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
5 deletions
src/main/java/vion/controller/StoreController.java
src/main/java/vion/controller/UserController.java
src/main/java/vion/service/IStoreService.java
src/main/java/vion/service/IUserService.java
src/main/java/vion/service/impl/StoreServiceImpl.java
src/main/java/vion/service/impl/UserServiceImpl.java
src/main/java/vion/controller/StoreController.java
View file @
814659b
...
...
@@ -244,15 +244,23 @@ public class StoreController {
@PostMapping
(
"/store/file/table"
)
@SaCheckPermission
(
value
=
"store:file:table"
,
orRole
=
"admin"
)
public
Map
<
String
,
Map
<
String
,
Map
<
String
,
Long
>>>
storeFileTable
(
StoreDTO
data
,
@RequestBody
(
required
=
false
)
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
)
{
@RequestBody
(
required
=
false
)
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
)
{
return
storeService
.
storeFileTable
(
data
,
orderItemList
,
response
);
}
@PostMapping
(
"/store/file/export"
)
@SaCheckPermission
(
value
=
"store:file:export"
,
orRole
=
"admin"
)
public
void
storeFileExport
(
StoreDTO
data
,
@RequestBody
(
required
=
false
)
List
<
OrderItem
>
orderItemList
,
public
void
storeFileExport
(
StoreDTO
data
,
@RequestBody
(
required
=
false
)
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
)
{
storeService
.
storeFileExport
(
data
,
orderItemList
,
response
);
}
@GetMapping
(
"/store/mainUser/table"
)
@SaCheckPermission
(
value
=
"store:mainUser:table"
,
orRole
=
"admin"
)
public
Map
<
String
,
Map
<
String
,
Long
>>
storeTableByMainUser
()
{
return
storeService
.
storeTableByMainUser
();
}
}
src/main/java/vion/controller/UserController.java
View file @
814659b
...
...
@@ -152,4 +152,17 @@ public class UserController {
return
wechatMod
.
getFollowingOpenid
(
id
,
flag
,
code
);
}
/**
* 同步用户到 Redis
*
* @return java.lang.String
*/
@GetMapping
(
"/user/sync"
)
@SaCheckPermission
(
value
=
"user:sync"
,
orRole
=
"admin"
)
// todo 未加权限
public
String
syncDict
()
{
userService
.
syncUser
();
return
"同步成功"
;
}
}
src/main/java/vion/service/IStoreService.java
View file @
814659b
...
...
@@ -43,6 +43,5 @@ public interface IStoreService extends MPJBaseService<Store> {
void
storeFileExport
(
StoreDTO
data
,
List
<
OrderItem
>
orderItemList
,
HttpServletResponse
response
);
Map
<
String
,
Map
<
String
,
Long
>>
storeTableByMainUser
();
}
src/main/java/vion/service/IUserService.java
View file @
814659b
...
...
@@ -15,4 +15,5 @@ public interface IUserService extends MPJBaseService<User> {
List
<
MapTree
<
String
>>
getOrgTree
(
String
deptId
);
void
syncUser
();
}
src/main/java/vion/service/impl/StoreServiceImpl.java
View file @
814659b
...
...
@@ -658,6 +658,31 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
}
}
@Override
public
Map
<
String
,
Map
<
String
,
Long
>>
storeTableByMainUser
()
{
var
projectStateMap
=
redissonClient
.<
Integer
,
String
>
getMap
(
RedisKeyEnum
.
DICT_PREFIX
.
getVal
()
+
RedisKeyEnum
.
PROJECT_STATE
.
getVal
());
var
wrapper
=
new
MPJLambdaWrapper
<
Store
>()
.
select
(
Store:
:
getId
,
Store:
:
getName
,
Store:
:
getProjectState
)
.
selectAs
(
RStoreUser:
:
getUserId
,
StoreVO:
:
getMainUser
)
.
leftJoin
(
RStoreUser
.
class
,
on
->
on
.
eq
(
RStoreUser:
:
getStoreId
,
Store:
:
getId
).
eq
(
RStoreUser:
:
getIsMain
,
1
));
var
storeVOList
=
this
.
selectJoinList
(
StoreVO
.
class
,
wrapper
);
var
useridArr
=
storeVOList
.
stream
()
.
map
(
StoreVO:
:
getMainUser
)
.
map
(
mainUser
->
RedisKeyEnum
.
DING_PREFIX
.
getVal
()
+
RedisKeyEnum
.
USER_ID
.
getVal
()
+
mainUser
)
.
toArray
(
String
[]::
new
);
var
id2UserMap
=
redissonClient
.
getBuckets
().
get
(
useridArr
);
// 项目经理 -> (项目状态 -> 数量)
return
storeVOList
.
stream
()
.
filter
(
val
->
ObjUtil
.
isNotNull
(
val
.
getMainUser
()))
.
collect
(
Collectors
.
groupingBy
(
vo
->
((
User
)
id2UserMap
.
get
(
RedisKeyEnum
.
DING_PREFIX
.
getVal
()
+
RedisKeyEnum
.
USER_ID
.
getVal
()
+
vo
.
getMainUser
())).
getUsername
(),
Collectors
.
groupingBy
(
vo
->
projectStateMap
.
getOrDefault
(
vo
.
getProjectState
(),
"未知"
),
Collectors
.
counting
())));
}
JSONObject
buildMsg
(
String
storeName
,
String
userid
)
{
var
jsonObj
=
JSONUtil
.
ofObj
()
.
set
(
"agent_id"
,
2358374016L
)
...
...
src/main/java/vion/service/impl/UserServiceImpl.java
View file @
814659b
...
...
@@ -12,7 +12,9 @@ import org.dromara.hutool.core.tree.MapTree;
import
org.dromara.hutool.core.tree.TreeNode
;
import
org.dromara.hutool.core.tree.TreeUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Service
;
import
vion.constant.RedisKeyEnum
;
import
vion.dto.UserDTO
;
import
vion.mapper.UserMapper
;
import
vion.model.Dept
;
...
...
@@ -39,6 +41,7 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
private
final
IDeptService
deptService
;
private
final
IRoleService
roleService
;
private
final
IRUserRoleService
userRoleService
;
private
final
RedissonClient
redissonClient
;
private
final
Converter
converter
;
@Override
...
...
@@ -97,4 +100,13 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
return
resTree
;
}).
orElse
(
wholeTree
);
}
@Override
public
void
syncUser
()
{
Opt
.
ofEmptyAble
(
this
.
list
())
.
ifPresent
(
l
->
l
.
forEach
(
user
->
{
redissonClient
.
getBucket
(
RedisKeyEnum
.
DING_PREFIX
.
getVal
()
+
RedisKeyEnum
.
USER_ID
.
getVal
()
+
user
.
getId
()).
set
(
user
);
redissonClient
.
getBucket
(
RedisKeyEnum
.
DING_PREFIX
.
getVal
()
+
RedisKeyEnum
.
USER_NAME
.
getVal
()
+
user
.
getUsername
()).
set
(
user
);
}));
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment