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
43d3776d
authored
May 16, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev'
parents
8a66d7bc
a47d364e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 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/service/wechat/impl/PlatLoginWechatServiceImpl.java
server-common/src/main/java/com/makeit/common/vo/ExcelErrorVo.java
View file @
43d3776d
...
@@ -69,4 +69,12 @@ public class ExcelErrorVo implements Serializable {
...
@@ -69,4 +69,12 @@ public class ExcelErrorVo implements Serializable {
emailMap
.
put
(
key
,
"system"
);
emailMap
.
put
(
key
,
"system"
);
}
}
}
}
public
static
void
incorrectFormatting
(
List
<
ExcelErrorVo
>
errorVoList
,
int
i
,
String
title
,
String
msg
)
{
if
(
StringUtils
.
isBlank
(
msg
))
{
errorVoList
.
add
(
new
ExcelErrorVo
(
i
,
title
,
"格式不正确"
));
}
else
{
errorVoList
.
add
(
new
ExcelErrorVo
(
i
,
title
,
msg
));
}
}
}
}
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
View file @
43d3776d
package
com
.
makeit
.
service
.
platform
.
auth
.
impl
;
package
com
.
makeit
.
service
.
platform
.
auth
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.lang.Validator
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
@@ -1202,6 +1203,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -1202,6 +1203,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
for
(
int
i
=
0
;
i
<
platUserImportDTOS
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
platUserImportDTOS
.
size
();
i
++)
{
PlatUserImportDTO
dto
=
platUserImportDTOS
.
get
(
i
);
PlatUserImportDTO
dto
=
platUserImportDTOS
.
get
(
i
);
ExcelErrorVo
.
isNotNull
(
dto
.
getUsername
(),
errorVoList
,
start
+
i
,
"姓名*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getUsername
(),
errorVoList
,
start
+
i
,
"姓名*"
);
if
(!
Validator
.
isMobile
(
dto
.
getMobile
()))
{
ExcelErrorVo
.
incorrectFormatting
(
errorVoList
,
start
+
i
,
"手机号*"
,
null
);
}
ExcelErrorVo
.
isNotNull
(
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getRoleName
(),
errorVoList
,
start
+
i
,
"*角色"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getRoleName
(),
errorVoList
,
start
+
i
,
"*角色"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getOrgName
(),
errorVoList
,
start
+
i
,
"*所属组织"
);
ExcelErrorVo
.
isNotNull
(
dto
.
getOrgName
(),
errorVoList
,
start
+
i
,
"*所属组织"
);
...
@@ -1210,7 +1214,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
...
@@ -1210,7 +1214,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
ExcelErrorVo
.
notExists
(
roleNameMap
.
get
(
platOrg
.
getId
()+
dto
.
getRoleName
()),
errorVoList
,
start
+
i
,
"*角色"
);
ExcelErrorVo
.
notExists
(
roleNameMap
.
get
(
platOrg
.
getId
()+
dto
.
getRoleName
()),
errorVoList
,
start
+
i
,
"*角色"
);
ExcelErrorVo
.
exists
(
accountMap
,
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"账户*"
);
ExcelErrorVo
.
exists
(
accountMap
,
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"账户*"
);
ExcelErrorVo
.
exists
(
mobileMap
,
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"手机号*"
);
ExcelErrorVo
.
exists
(
mobileMap
,
dto
.
getMobile
(),
errorVoList
,
start
+
i
,
"手机号*"
);
if
(!
Validator
.
isEmail
(
dto
.
getEmail
()))
{
ExcelErrorVo
.
incorrectFormatting
(
errorVoList
,
start
+
i
,
"邮箱"
,
null
);
}
ExcelErrorVo
.
exists
(
emailMap
,
dto
.
getEmail
(),
errorVoList
,
start
+
i
,
"邮箱"
);
ExcelErrorVo
.
exists
(
emailMap
,
dto
.
getEmail
(),
errorVoList
,
start
+
i
,
"邮箱"
);
if
(
StringUtils
.
isNotBlank
(
dto
.
getRemark
())
&&
dto
.
getRemark
().
length
()
>
200
)
{
ExcelErrorVo
.
incorrectFormatting
(
errorVoList
,
start
+
i
,
"备注"
,
"长度不能超过200字符"
);
}
}
}
if
(
errorVoList
.
isEmpty
())
{
if
(
errorVoList
.
isEmpty
())
{
List
<
PlatUser
>
platUsers
=
new
ArrayList
<>();
List
<
PlatUser
>
platUsers
=
new
ArrayList
<>();
...
...
server-service/src/main/java/com/makeit/service/wechat/impl/PlatLoginWechatServiceImpl.java
View file @
43d3776d
...
@@ -3,12 +3,14 @@ package com.makeit.service.wechat.impl;
...
@@ -3,12 +3,14 @@ package com.makeit.service.wechat.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.makeit.common.dto.LoginDTO
;
import
com.makeit.common.dto.LoginDTO
;
import
com.makeit.entity.platform.auth.PlatUser
;
import
com.makeit.entity.platform.auth.PlatUser
;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.module.admin.vo.plat.PlatUserLoginVO
;
import
com.makeit.module.admin.vo.plat.PlatUserLoginVO
;
import
com.makeit.service.platform.auth.PlatUserService
;
import
com.makeit.service.platform.auth.PlatUserService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.wechat.PlatLoginWechatService
;
import
com.makeit.service.wechat.PlatLoginWechatService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.id.IdGen
;
import
com.makeit.utils.data.id.IdGen
;
...
@@ -18,6 +20,8 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -18,6 +20,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
/**
/**
* Controller
* Controller
...
@@ -29,6 +33,8 @@ import org.springframework.stereotype.Service;
...
@@ -29,6 +33,8 @@ import org.springframework.stereotype.Service;
public
class
PlatLoginWechatServiceImpl
implements
PlatLoginWechatService
{
public
class
PlatLoginWechatServiceImpl
implements
PlatLoginWechatService
{
@Autowired
@Autowired
private
PlatUserService
platUserService
;
private
PlatUserService
platUserService
;
@Autowired
private
PlatTenantService
platTenantService
;
@Override
@Override
@TenantIdIgnore
@TenantIdIgnore
...
@@ -48,6 +54,14 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
...
@@ -48,6 +54,14 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
if
(
platUser
==
null
)
{
if
(
platUser
==
null
)
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_AUTH_USER_PASSWORD
);
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_AUTH_USER_PASSWORD
);
}
}
PlatTenant
platTenant
=
platTenantService
.
getById
(
platUser
.
getTenantId
());
if
(
platTenant
==
null
||
StringUtils
.
equals
(
platTenant
.
getStatus
(),
CommonEnum
.
NO
.
getValue
())){
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_TENANT_FORBIDDEN
);
}
LocalDate
localDate
=
LocalDate
.
now
();
if
(
platTenant
.
getStartTime
().
isAfter
(
localDate
)
||
localDate
.
isAfter
(
platTenant
.
getEndTime
()))
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_TENANT_FORBIDDEN
);
}
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
platUser
.
getStatus
()))
{
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
platUser
.
getStatus
()))
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_AUTH_USER_HAS_DISABLED
);
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_AUTH_USER_HAS_DISABLED
);
}
}
...
...
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