Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
9c602b84
...
9c602b8449f2dedfc88e075bd9ebb00c00b971cf
authored
2022-07-25 19:56:41 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.app历史数据判断昵称是否base64加密过
1 parent
830a29cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
16 deletions
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
member-service-impl/src/main/java/com/topdraw/util/Base64Util.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
View file @
9c602b8
...
...
@@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Base64Utils
;
import
java.sql.Timestamp
;
import
java.util.Objects
;
...
...
@@ -217,11 +218,18 @@ public class UserAppServiceImpl implements UserAppService {
// vis 手机号
String
cellphone
=
visUserDTO
.
getCellphone
();
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
username
:
cellphone
);
userAppIdManual
.
setCellphone
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
String
nickname
=
visUserDTO
.
getNickname
();
userAppIdManual
.
setNickname
(
StringUtils
.
isBlank
(
nickname
)
?
resources
.
getNickname
()
:
nickname
);
if
(
StringUtils
.
isBlank
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
resources
.
getNickname
());
}
else
{
if
(!
Base64Util
.
isBase64
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
Base64Utils
.
encodeToString
(
visUserDTO
.
getNickname
().
getBytes
()));
}
else
{
userAppIdManual
.
setNickname
(
visUserDTO
.
getNickname
());
}
}
Integer
gender
=
visUserDTO
.
getGender
();
userAppIdManual
.
setGender
(
Objects
.
isNull
(
gender
)
?
-
1
:
gender
);
...
...
@@ -300,11 +308,18 @@ public class UserAppServiceImpl implements UserAppService {
userAppIdManual
.
setId
(
id
);
String
cellphone
=
visUserDTO
.
getCellphone
();
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
username1
:
cellphone
);
userAppIdManual
.
setCellphone
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
String
nickname
=
visUserDTO
.
getNickname
();
userAppIdManual
.
setNickname
(
StringUtils
.
isBlank
(
nickname
)
?
resources
.
getNickname
()
:
nickname
);
if
(
StringUtils
.
isBlank
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
resources
.
getNickname
());
}
else
{
if
(!
Base64Util
.
isBase64
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
Base64Utils
.
encodeToString
(
visUserDTO
.
getNickname
().
getBytes
()));
}
else
{
userAppIdManual
.
setNickname
(
visUserDTO
.
getNickname
());
}
}
Integer
gender
=
visUserDTO
.
getGender
();
userAppIdManual
.
setGender
(
Objects
.
isNull
(
gender
)
?
-
1
:
gender
);
...
...
@@ -329,7 +344,6 @@ public class UserAppServiceImpl implements UserAppService {
this
.
userAppRepository
.
saveByIdManual
(
userAppIdManual
);
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
findFirstByAccountAndAccountType
(
resources
.
getUserId
(),
5
);
if
(
Objects
.
isNull
(
userAppBindDTO
.
getId
()))
{
...
...
@@ -385,11 +399,18 @@ public class UserAppServiceImpl implements UserAppService {
userAppIdManual
.
setId
(
id
);
String
cellphone
=
visUserDTO
.
getCellphone
();
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
username1
:
cellphone
);
userAppIdManual
.
setCellphone
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
String
nickname
=
visUserDTO
.
getNickname
();
userAppIdManual
.
setNickname
(
StringUtils
.
isBlank
(
nickname
)
?
resources
.
getNickname
()
:
nickname
);
if
(
StringUtils
.
isBlank
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
resources
.
getNickname
());
}
else
{
if
(!
Base64Util
.
isBase64
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
Base64Utils
.
encodeToString
(
visUserDTO
.
getNickname
().
getBytes
()));
}
else
{
userAppIdManual
.
setNickname
(
visUserDTO
.
getNickname
());
}
}
Integer
gender
=
visUserDTO
.
getGender
();
userAppIdManual
.
setGender
(
Objects
.
isNull
(
gender
)
?
-
1
:
gender
);
...
...
@@ -470,11 +491,18 @@ public class UserAppServiceImpl implements UserAppService {
userAppIdManual
.
setId
(
id
);
String
cellphone
=
visUserDTO
.
getCellphone
();
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
userAppIdManual
.
setUsername
(
StringUtils
.
isBlank
(
cellphone
)
?
username1
:
cellphone
);
userAppIdManual
.
setCellphone
(
StringUtils
.
isBlank
(
cellphone
)
?
null
:
cellphone
);
String
nickname
=
visUserDTO
.
getNickname
();
userAppIdManual
.
setNickname
(
StringUtils
.
isBlank
(
nickname
)
?
resources
.
getNickname
()
:
nickname
);
if
(
StringUtils
.
isBlank
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
resources
.
getNickname
());
}
else
{
if
(!
Base64Util
.
isBase64
(
visUserDTO
.
getNickname
()))
{
userAppIdManual
.
setNickname
(
Base64Utils
.
encodeToString
(
visUserDTO
.
getNickname
().
getBytes
()));
}
else
{
userAppIdManual
.
setNickname
(
visUserDTO
.
getNickname
());
}
}
Integer
gender
=
visUserDTO
.
getGender
();
userAppIdManual
.
setGender
(
Objects
.
isNull
(
gender
)
?
-
1
:
gender
);
...
...
member-service-impl/src/main/java/com/topdraw/util/Base64Util.java
View file @
9c602b8
package
com
.
topdraw
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.Base64Utils
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Base64
;
import
java.util.regex.Pattern
;
public
class
Base64Util
{
...
...
@@ -10,10 +14,32 @@ public class Base64Util {
return
name1
;
}
public
static
boolean
isBase64
(
String
str
)
{
if
(
StringUtils
.
isBlank
(
str
))
{
return
false
;
}
String
base64Pattern
=
"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"
;
boolean
matches
=
Pattern
.
matches
(
base64Pattern
,
str
);
if
(
matches
)
{
String
decodeBase64Str
=
new
String
(
Base64Utils
.
decode
(
str
.
getBytes
()));
String
encodeBase64Str
=
Base64Utils
.
encodeToString
(
decodeBase64Str
.
getBytes
());
if
(
str
.
equals
(
encodeBase64Str
))
{
return
true
;
}
}
return
false
;
}
public
static
void
main
(
String
[]
args
)
{
// String name = "test005@itv";
String
name
=
"18580619168a@iptv"
;
String
encode
=
encode
(
name
);
System
.
out
.
println
(
encode
);
// String name = "18580619168a@iptv";
// String encode = encode(name);
// System.out.println(encode);
boolean
a
=
isBase64
(
"fdsfdsf"
);
System
.
out
.
println
(
a
);
}
}
...
...
Please
register
or
sign in
to post a comment