Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
808529e9
authored
Sep 19, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixbug:用户导入
parent
b49aee2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
server-common/src/main/java/com/makeit/common/vo/ExcelErrorVo.java
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
server-service/src/main/java/com/makeit/task/IotSyncTask.java
server-common/src/main/java/com/makeit/common/vo/ExcelErrorVo.java
View file @
808529e9
...
...
@@ -58,11 +58,15 @@ public class ExcelErrorVo implements Serializable {
}
}
public
static
void
exists
(
Map
<
String
,
String
>
emailMap
,
String
value
,
List
<
ExcelErrorVo
>
errorVoList
,
int
i
,
String
title
){
public
static
void
exists
(
Map
<
String
,
String
>
emailMap
,
String
key
,
List
<
ExcelErrorVo
>
errorVoList
,
int
i
,
String
title
){
if
(
StringUtils
.
isBlank
(
key
)){
return
;
}
String
value
=
emailMap
.
get
(
key
);
if
(
StringUtils
.
isNotBlank
(
value
)){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
,
title
,
"数据重复"
));
}
else
{
emailMap
.
put
(
value
,
"system"
);
emailMap
.
put
(
key
,
"system"
);
}
}
}
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
View file @
808529e9
...
...
@@ -1090,7 +1090,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
userLambdaQueryWrapper
.
select
(
PlatUser:
:
getMobile
,
PlatUser:
:
getEmail
,
BaseEntity:
:
getId
);
List
<
PlatUser
>
userList
=
this
.
list
(
userLambdaQueryWrapper
);
Map
<
String
,
String
>
mobileMap
=
userList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatUser:
:
getMobile
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
Map
<
String
,
String
>
emailMap
=
userList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatUser:
:
getEmail
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
Map
<
String
,
String
>
emailMap
=
userList
.
stream
().
filter
(
vo
->
StringUtils
.
isNotBlank
(
vo
.
getEmail
())).
collect
(
Collectors
.
toMap
(
PlatUser:
:
getEmail
,
BaseEntity:
:
getId
,
(
a
,
b
)
->
a
));
return
ExcelValidatorUtil
.
validateMain
(
3
,
platUserImportDTOS
,
list
->
{
List
<
ExcelErrorVo
>
errorVoList
=
new
ArrayList
<>();
...
...
@@ -1104,8 +1104,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
PlatOrg
platOrg
=
Optional
.
ofNullable
(
orgNameMap
.
get
(
dto
.
getOrgName
())).
orElse
(
new
PlatOrg
());
ExcelErrorVo
.
notExists
(
platOrg
.
getId
(),
errorVoList
,
start
+
i
,
"*所属组织"
);
ExcelErrorVo
.
notExists
(
roleNameMap
.
get
(
dto
.
getRoleName
()),
errorVoList
,
start
+
i
,
"*角色"
);
ExcelErrorVo
.
exists
(
mobileMap
,
mobileMap
.
get
(
dto
.
getMobile
()
),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
exists
(
emailMap
,
emailMap
.
get
(
dto
.
getEmail
()
),
errorVoList
,
start
+
i
,
"邮箱"
);
ExcelErrorVo
.
exists
(
mobileMap
,
dto
.
getMobile
(
),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
exists
(
emailMap
,
dto
.
getEmail
(
),
errorVoList
,
start
+
i
,
"邮箱"
);
}
if
(
errorVoList
.
isEmpty
())
{
List
<
PlatUser
>
platUsers
=
new
ArrayList
<>();
...
...
server-service/src/main/java/com/makeit/task/IotSyncTask.java
View file @
808529e9
...
...
@@ -16,7 +16,6 @@ import com.makeit.service.platform.device.PlatDeviceService;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.utils.DeviceCacheUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -67,13 +66,11 @@ public class IotSyncTask {
}
//查询iot设备
List
<
DeviceInstanceEntity
>
iotDeviceList
=
iotOrgService
.
getOrgDevice
(
iotOrgId
);
if
(
CollectionUtils
.
isEmpty
(
iotDeviceList
))
{
continue
;
}
//查询平台设备
Set
<
String
>
iotDeviceIdSet
=
iotDeviceList
.
stream
().
map
(
DeviceInstanceEntity:
:
getId
).
collect
(
Collectors
.
toSet
());
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<
PlatDevice
>().
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
())
.
in
(
PlatDevice:
:
getOriDeviceId
,
iotDeviceIdSet
);
iotDeviceIdSet
.
add
(
"-1"
);
//删除设备
LambdaQueryWrapper
<
PlatDevice
>
removeQw
=
new
LambdaQueryWrapper
<
PlatDevice
>().
notIn
(
PlatDevice:
:
getOriDeviceId
,
iotDeviceIdSet
)
.
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
());
...
...
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