Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
bcf72378
Commit
bcf72378
authored
Oct 29, 2019
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
魔法值修复---第三批
parent
7bcf3b72
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
51 additions
and
47 deletions
+51
-47
Constants.java
src/main/java/cn/quantgroup/xyqb/Constants.java
+4
-0
UserController.java
...n/quantgroup/xyqb/controller/external/UserController.java
+1
-1
WeChatController.java
...quantgroup/xyqb/controller/external/WeChatController.java
+1
-1
SmsController.java
...uantgroup/xyqb/controller/external/sms/SmsController.java
+31
-25
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+1
-1
UserApiController.java
...roup/xyqb/controller/internal/user/UserApiController.java
+3
-3
UserInfo.java
src/main/java/cn/quantgroup/xyqb/model/UserInfo.java
+2
-1
UserModel.java
src/main/java/cn/quantgroup/xyqb/model/UserModel.java
+2
-1
IWeChatUserRepository.java
.../cn/quantgroup/xyqb/repository/IWeChatUserRepository.java
+1
-1
GeetestLib.java
...n/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
+1
-3
UserRegisterServiceImpl.java
...p/xyqb/service/register/impl/UserRegisterServiceImpl.java
+1
-1
SmsServiceImpl.java
...a/cn/quantgroup/xyqb/service/sms/impl/SmsServiceImpl.java
+1
-8
Jdk8Test.java
src/test/java/common/Jdk8Test.java
+2
-1
No files found.
src/main/java/cn/quantgroup/xyqb/Constants.java
View file @
bcf72378
...
@@ -25,7 +25,11 @@ public interface Constants {
...
@@ -25,7 +25,11 @@ public interface Constants {
Long
VERIFICATION_CODE_FINITE_COUNT
=
3L
;
Long
VERIFICATION_CODE_FINITE_COUNT
=
3L
;
String
X_AUTH_TOKEN
=
"x-auth-token"
;
String
X_AUTH_TOKEN
=
"x-auth-token"
;
int
VERIFICATION_LEN
=
2
;
int
SMS_CODE_LEN_4
=
4
;
int
SMS_CODE_LEN_6
=
6
;
int
TOKEN_LENGTH
=
36
;
int
TOKEN_LENGTH
=
36
;
int
MD5_LENGTH
=
32
;
int
THOUSAND_SECOND
=
1000
;
int
THOUSAND_SECOND
=
1000
;
int
MILLIS_PER_SECOND
=
1000
;
int
MILLIS_PER_SECOND
=
1000
;
int
MILLIS_OF_TEN_SECOND
=
10000
;
int
MILLIS_OF_TEN_SECOND
=
10000
;
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/UserController.java
View file @
bcf72378
...
@@ -225,7 +225,7 @@ public class UserController implements IBaseController {
...
@@ -225,7 +225,7 @@ public class UserController implements IBaseController {
byte
[]
buf
=
Base64
.
decodeBase64
(
credential
);
byte
[]
buf
=
Base64
.
decodeBase64
(
credential
);
credential
=
new
String
(
buf
,
Charset
.
forName
(
"UTF-8"
));
credential
=
new
String
(
buf
,
Charset
.
forName
(
"UTF-8"
));
String
[]
credentialArr
=
credential
.
split
(
Constants
.
SPLIT_CHAR
);
String
[]
credentialArr
=
credential
.
split
(
Constants
.
SPLIT_CHAR
);
if
(
credentialArr
.
length
!=
2
)
{
if
(
credentialArr
.
length
!=
Constants
.
VERIFICATION_LEN
)
{
result
.
put
(
Constants
.
CHECK_FAIL
,
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
));
result
.
put
(
Constants
.
CHECK_FAIL
,
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
));
return
result
;
return
result
;
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/WeChatController.java
View file @
bcf72378
...
@@ -338,7 +338,7 @@ public class WeChatController implements IBaseController {
...
@@ -338,7 +338,7 @@ public class WeChatController implements IBaseController {
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
AuthBean
authBean
=
sessionService
.
createSession
(
user
,
loginProperties
);
AuthBean
authBean
=
sessionService
.
createSession
(
user
,
loginProperties
);
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
domain
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
domain
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
Long
channelId
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
222L
:
1L
;
Long
channelId
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
Constants
.
Channel
.
BAITIAO
:
1L
;
String
target
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
"cashTarget5"
:
"cashTarget4"
;
String
target
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
"cashTarget5"
:
"cashTarget4"
;
return
domain
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
return
domain
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
+
"&isWechat=true"
;
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
+
"&isWechat=true"
;
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/sms/SmsController.java
View file @
bcf72378
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
bcf72378
...
@@ -147,7 +147,7 @@ public class InnerController implements IBaseController {
...
@@ -147,7 +147,7 @@ public class InnerController implements IBaseController {
if
(
md5Value
==
null
)
{
if
(
md5Value
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"参数错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数错误"
,
null
);
}
}
if
(
md5Value
.
length
()
!=
32
)
{
if
(
md5Value
.
length
()
!=
Constants
.
MD5_LENGTH
)
{
return
JsonResult
.
buildErrorStateResult
(
"参数长度有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数长度有误"
,
null
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserApiController.java
View file @
bcf72378
...
@@ -41,15 +41,15 @@ public class UserApiController {
...
@@ -41,15 +41,15 @@ public class UserApiController {
private
ISmsService
smsService
;
private
ISmsService
smsService
;
@RequestMapping
(
"/user/is_passwd_set"
)
@RequestMapping
(
"/user/is_passwd_set"
)
public
JsonResult
isPasswordSet
(
String
key
,
String
phoneNo
)
{
public
JsonResult
isPasswordSet
(
String
phoneNo
)
{
if
(
!
"abc1234"
.
equals
(
key
)
||
StringUtils
.
isEmpty
(
phoneNo
))
{
if
(
StringUtils
.
isEmpty
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
if
(
null
==
user
)
{
if
(
null
==
user
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
if
(
StringUtils
.
length
(
user
.
getPassword
())
==
32
)
{
if
(
StringUtils
.
length
(
user
.
getPassword
())
==
Constants
.
MD5_LENGTH
)
{
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
return
JsonResult
.
buildErrorStateResult
(
null
,
null
,
2L
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
,
2L
);
...
...
src/main/java/cn/quantgroup/xyqb/model/UserInfo.java
View file @
bcf72378
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.model;
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.model;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.util.Assert
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -25,7 +26,7 @@ public class UserInfo implements Serializable {
...
@@ -25,7 +26,7 @@ public class UserInfo implements Serializable {
private
String
IdNo
;
private
String
IdNo
;
public
UserInfo
(
User
user
,
UserDetail
userDetail
)
{
public
UserInfo
(
User
user
,
UserDetail
userDetail
)
{
assert
user
!=
null
;
Assert
.
notNull
(
user
,
"User信息无效"
)
;
this
.
id
=
user
.
getId
();
this
.
id
=
user
.
getId
();
this
.
phoneNo
=
user
.
getPhoneNo
();
this
.
phoneNo
=
user
.
getPhoneNo
();
this
.
registerFrom
=
user
.
getRegisteredFrom
();
this
.
registerFrom
=
user
.
getRegisteredFrom
();
...
...
src/main/java/cn/quantgroup/xyqb/model/UserModel.java
View file @
bcf72378
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.model;
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.model;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.util.Assert
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -35,7 +36,7 @@ public class UserModel implements Serializable {
...
@@ -35,7 +36,7 @@ public class UserModel implements Serializable {
}
}
public
UserModel
(
User
user
,
UserDetail
userDetail
)
{
public
UserModel
(
User
user
,
UserDetail
userDetail
)
{
assert
user
!=
null
;
Assert
.
notNull
(
user
,
"User信息无效"
)
;
this
.
id
=
user
.
getId
();
this
.
id
=
user
.
getId
();
this
.
phoneNo
=
user
.
getPhoneNo
();
this
.
phoneNo
=
user
.
getPhoneNo
();
this
.
registerFrom
=
user
.
getRegisteredFrom
();
this
.
registerFrom
=
user
.
getRegisteredFrom
();
...
...
src/main/java/cn/quantgroup/xyqb/repository/IWeChatUserRepository.java
View file @
bcf72378
...
@@ -54,7 +54,7 @@ public interface IWeChatUserRepository extends JpaRepository<WechatUserInfo, Lon
...
@@ -54,7 +54,7 @@ public interface IWeChatUserRepository extends JpaRepository<WechatUserInfo, Lon
* @param userId - 用户标识
* @param userId - 用户标识
* @return 记录更新行数
* @return 记录更新行数
*/
*/
@Transactional
(
propagation
=
MANDATORY
)
@Transactional
(
propagation
=
MANDATORY
,
rollbackFor
=
Exception
.
class
)
@Modifying
@Modifying
@Query
(
value
=
"update wechat_userinfo set user_id=null,phone_no='*' where open_id=?1 or user_id=?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"update wechat_userinfo set user_id=null,phone_no='*' where open_id=?1 or user_id=?2"
,
nativeQuery
=
true
)
int
dissociateUser
(
String
openId
,
Long
userId
);
int
dissociateUser
(
String
openId
,
Long
userId
);
...
...
src/main/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
View file @
bcf72378
...
@@ -23,8 +23,6 @@ import java.util.Objects;
...
@@ -23,8 +23,6 @@ import java.util.Objects;
*/
*/
@Slf4j
@Slf4j
public
class
GeetestLib
{
public
class
GeetestLib
{
protected
static
final
int
SUCCESS_CHALLENGE_LENGTH
=
32
;
protected
final
String
verName
=
"4.0"
;
protected
final
String
verName
=
"4.0"
;
private
String
apiUrl
;
private
String
apiUrl
;
...
@@ -162,7 +160,7 @@ public class GeetestLib {
...
@@ -162,7 +160,7 @@ public class GeetestLib {
gtlog
(
"return_challenge:"
+
return_challenge
);
gtlog
(
"return_challenge:"
+
return_challenge
);
if
(
return_challenge
.
length
()
==
SUCCESS_CHALLENGE
_LENGTH
)
{
if
(
return_challenge
.
length
()
==
Constants
.
MD5
_LENGTH
)
{
this
.
responseStr
=
this
.
getSuccessPreProcessRes
(
this
.
md5Encode
(
return_challenge
+
this
.
privateKey
));
this
.
responseStr
=
this
.
getSuccessPreProcessRes
(
this
.
md5Encode
(
return_challenge
+
this
.
privateKey
));
...
...
src/main/java/cn/quantgroup/xyqb/service/register/impl/UserRegisterServiceImpl.java
View file @
bcf72378
...
@@ -69,7 +69,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -69,7 +69,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
registerFrom
=
1L
;
registerFrom
=
1L
;
}
}
Long
channelId
=
userRegisterParam
.
getChannelId
();
Long
channelId
=
userRegisterParam
.
getChannelId
();
if
(
Objects
.
equals
(
channelId
,
222L
))
{
if
(
Objects
.
equals
(
channelId
,
Constants
.
Channel
.
BAITIAO
))
{
user
.
setRegisteredFrom
(
channelId
);
user
.
setRegisteredFrom
(
channelId
);
}
else
{
}
else
{
user
.
setRegisteredFrom
(
registerFrom
);
user
.
setRegisteredFrom
(
registerFrom
);
...
...
src/main/java/cn/quantgroup/xyqb/service/sms/impl/SmsServiceImpl.java
View file @
bcf72378
...
@@ -8,8 +8,6 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
...
@@ -8,8 +8,6 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
import
lombok.Synchronized
;
import
lombok.Synchronized
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -26,11 +24,6 @@ import java.util.Collections;
...
@@ -26,11 +24,6 @@ import java.util.Collections;
@Service
@Service
@Slf4j
@Slf4j
public
class
SmsServiceImpl
implements
ISmsService
{
public
class
SmsServiceImpl
implements
ISmsService
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SmsServiceImpl
.
class
);
private
static
final
int
SMS_VERIFICATION_MAXLEN
=
4
;
private
static
final
String
SMS_VERIFY_PREFIX
=
"sms:verify:"
;
private
static
SmsSender
smsSender
=
null
;
private
static
SmsSender
smsSender
=
null
;
@Value
(
"${sms.is.debug}"
)
@Value
(
"${sms.is.debug}"
)
...
@@ -98,7 +91,7 @@ public class SmsServiceImpl implements ISmsService {
...
@@ -98,7 +91,7 @@ public class SmsServiceImpl implements ISmsService {
return
false
;
return
false
;
}
}
String
[]
arr
=
randomCode
.
split
(
":"
);
String
[]
arr
=
randomCode
.
split
(
":"
);
if
(
arr
.
length
!=
2
)
{
if
(
arr
.
length
!=
Constants
.
VERIFICATION_LEN
)
{
return
false
;
return
false
;
}
}
String
uniqueId
=
arr
[
0
];
String
uniqueId
=
arr
[
0
];
...
...
src/test/java/common/Jdk8Test.java
View file @
bcf72378
...
@@ -50,7 +50,8 @@ public class Jdk8Test {
...
@@ -50,7 +50,8 @@ public class Jdk8Test {
@Test
@Test
public
void
random
()
{
public
void
random
()
{
for
(
int
i
=
0
;
i
<
10
;
i
++){
int
count
=
10
;
for
(
int
i
=
0
;
i
<
count
;
i
++){
log
.
info
(
"{}-random:{}"
,
i
,
RandomStringUtils
.
random
(
6
,
RANDOM_CHARS
));
log
.
info
(
"{}-random:{}"
,
i
,
RandomStringUtils
.
random
(
6
,
RANDOM_CHARS
));
}
}
}
}
...
...
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