Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
haoban3.0
haoban-manage3.0
Commits
44e4c51b
Commit
44e4c51b
authored
Aug 24, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
fe004cd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
182 deletions
+0
-182
SendCodeController.java
.../gic/haoban/manage/web/controller/SendCodeController.java
+0
-118
HbLogRecordController.java
...anage/web/controller/logrecord/HbLogRecordController.java
+0
-64
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/SendCodeController.java
deleted
100644 → 0
View file @
fe004cd3
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.common.utils.CheckSmsCodeUtil
;
import
com.gic.haoban.common.utils.GooglePhoneNumberUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.response.SendSmsResponse
;
import
com.gic.haoban.manage.api.service.ValidationCodeApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@Deprecated
public
class
SendCodeController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SendCodeController
.
class
);
@Autowired
private
ValidationCodeApiService
validationCodeService
;
/**
* 验证码发送
*
* @param phoneNumber
* @return
*/
@RequestMapping
(
"/send-code"
)
public
HaobanResponse
sendCode
(
String
phoneNumber
,
@RequestParam
(
defaultValue
=
"86"
)
String
nationcode
,
Integer
type
,
@RequestParam
(
defaultValue
=
"0"
)
int
isTest
,
String
enterpriseId
)
{
if
(
StringUtils
.
isBlank
(
phoneNumber
)
||
null
==
type
)
{
logger
.
info
(
"没有phoneNumber!"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_5
);
}
if
(!
GooglePhoneNumberUtil
.
checkPhoneNumber
(
phoneNumber
,
nationcode
))
{
logger
.
info
(
"区号或者手机号码不合法:{}-{}"
,
nationcode
,
phoneNumber
);
return
resultResponse
(
HaoBanErrCode
.
ERR_20
);
}
String
cacheKey
=
nationcode
+
phoneNumber
+
type
;
Object
value
=
RedisUtil
.
getCache
(
cacheKey
);
if
(
value
!=
null
&&
(
boolean
)
value
){
logger
.
info
(
"手机号码:{}-{} 验证码只能一分钟请求一次"
,
nationcode
,
phoneNumber
);
return
resultResponse
(
HaoBanErrCode
.
ERR_22
);
}
else
{
RedisUtil
.
setCache
(
cacheKey
,
true
,
60L
);
}
//绑定
if
(
type
==
1
)
{
// StaffDTO staffDTO = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
// if (staffDTO == null) {
// logger.info("用户不存在:{}-{}", nationcode,phoneNumber);
// return resultResponse(HaoBanErrCode.ERR_8);
// }
}
String
smsCode
=
""
;
if
(
CheckSmsCodeUtil
.
getCacheSmsCode
(
nationcode
+
"-"
+
phoneNumber
,
type
)
!=
null
){
smsCode
=
(
String
)
CheckSmsCodeUtil
.
getCacheSmsCode
(
nationcode
+
"-"
+
phoneNumber
,
type
);
}
else
{
smsCode
=
CheckSmsCodeUtil
.
createSMSCode
();
CheckSmsCodeUtil
.
cacheSmsCode
(
nationcode
+
"-"
+
phoneNumber
,
smsCode
,
type
);
}
logger
.
info
(
"{}-{} 的 验证码:{}"
,
nationcode
,
phoneNumber
,
smsCode
);
//非测试
if
(
isTest
!=
1
)
{
SendSmsResponse
smsResponse
=
validationCodeService
.
sendValidationCodeHb3
(
nationcode
,
phoneNumber
,
smsCode
,
enterpriseId
,
null
,
null
,
false
);
logger
.
info
(
"{}-{} 的 验证码 发送结果回执:{}"
,
nationcode
,
phoneNumber
,
JSON
.
toJSONString
(
smsResponse
));
if
(!
smsResponse
.
isSuccess
())
{
HaobanResponse
response
=
new
HaobanResponse
();
response
.
setMessage
(
smsResponse
.
getMessage
());
response
.
setErrorCode
(
HaoBanErrCode
.
ERR_11
.
getCode
());
return
response
;
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
smsCode
);
}
}
/**
* 验证码校验
*
* @param phoneNumber
* @return
*/
@RequestMapping
(
"/validate-code"
)
public
HaobanResponse
validateCode
(
String
phoneNumber
,
@RequestParam
(
defaultValue
=
"86"
)
String
nationcode
,
String
code
,
int
type
)
{
if
(
StringUtils
.
isBlank
(
phoneNumber
)
||
StringUtils
.
isBlank
(
code
))
{
logger
.
info
(
"没有phoneNumber!"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_5
);
}
if
(
code
.
equals
(
"7654321"
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
boolean
b
=
CheckSmsCodeUtil
.
checkSmsCode
(
nationcode
+
"-"
+
phoneNumber
,
code
,
type
);
boolean
c
=
CheckSmsCodeUtil
.
checkSmsCodeIsDelay
(
nationcode
+
"-"
+
phoneNumber
,
code
,
type
);
if
(!
c
){
logger
.
info
(
"phoneNumber:{},code:{} 验证失败,验证码失效"
,
nationcode
+
"-"
+
phoneNumber
,
code
);
return
resultResponse
(
HaoBanErrCode
.
ERR_21
);
}
else
if
(!
b
){
logger
.
info
(
"phoneNumber:{},code:{} 验证失败,验证码失败"
,
nationcode
+
"-"
+
phoneNumber
,
code
);
return
resultResponse
(
HaoBanErrCode
.
ERR_21
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/logrecord/HbLogRecordController.java
View file @
44e4c51b
...
...
@@ -49,70 +49,6 @@ public class HbLogRecordController {
*/
private
static
Integer
systemType
=
1
;
@RequestMapping
(
"/list-old"
)
@ResponseBody
public
RestResponse
pageLogOld
(
LogRecordQo
qo
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
){
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
eid
=
qo
.
getEnterpriseId
()
;
if
(
null
!=
loginUser
&&
StringUtils
.
isEmpty
(
eid
))
{
eid
=
loginUser
.
getEnterpriseId
()
;
}
QueryDocDTO
doc
=
new
QueryDocDTO
();
doc
.
setSkip
((
pageNum
-
1
)*
pageSize
);
doc
.
setLimit
(
pageSize
);
String
mongoName
=
LogCommenUtil
.
getMongoName
();
doc
.
setDatabaseName
(
mongoName
);
doc
.
setCountFlag
(
true
);
BasicDBObject
filter
=
new
BasicDBObject
().
append
(
"enterpriseId"
,
eid
);
filter
.
append
(
"statusFlag"
,
1
);
//
filter
.
append
(
"systemType"
,
systemType
);
filter
.
append
(
"wxEnterpriseId"
,
loginUser
.
getWxEnterpriseId
());
if
(
StringUtils
.
isNotBlank
(
qo
.
getBusinessType
()))
{
filter
.
append
(
"businessType"
,
qo
.
getBusinessType
());
}
if
(
StringUtils
.
isNotBlank
(
qo
.
getOptType
()))
{
filter
.
append
(
"optType"
,
qo
.
getOptType
());
}
if
(
StringUtils
.
isNoneBlank
(
qo
.
getStartDate
(),
qo
.
getEndDate
()))
{
String
endDate
=
qo
.
getEndDate
()
+
" 23:59:59"
;
String
startDate
=
qo
.
getStartDate
()
+
" 00:00:00"
;
try
{
Date
startDateD
=
DateUtils
.
parseDate
(
startDate
,
"yyyy-MM-dd HH:mm:ss"
);
Date
endDateD
=
DateUtils
.
parseDate
(
endDate
,
"yyyy-MM-dd HH:mm:ss"
);
filter
.
append
(
"createTime"
,
new
BasicDBObject
(
"$gte"
,
startDateD
).
append
(
"$lte"
,
endDateD
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
null
==
loginUser
||
StringUtils
.
isBlank
(
loginUser
.
getOperationUserName
()))
{
filter
.
append
(
"ywFlag"
,
new
BasicDBObject
(
"$ne"
,
1
))
;
}
LOGGER
.
info
(
JSON
.
toJSONString
(
filter
));
doc
.
setFilter
(
filter
);
Bson
sort
=
new
BasicDBObject
().
append
(
"createTime"
,
-
1
);
doc
.
setSort
(
sort
);
doc
.
setSingleObject
(
new
GicLogRecordBean
());
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
if
(
StringUtils
.
isNotBlank
(
qo
.
getSearch
()))
{
filter
.
append
(
"content"
,
new
BasicDBObject
(
"$regex"
,
qo
.
getSearch
()));
}
if
(
StringUtils
.
isNotBlank
(
qo
.
getOptUser
()))
{
filter
.
append
(
"userId"
,
qo
.
getOptUser
());
}
DocumentResultDTO
documentResultDTO
=
mongoOperationService
.
queryManyDocumentForMongo
(
doc
);
Page
<
Object
>
retPage
=
new
Page
<>();
retPage
.
setResult
(
documentResultDTO
.
getDocList
());
retPage
.
setTotalCount
(
Long
.
valueOf
(
documentResultDTO
.
getTotalCount
()).
intValue
());
retPage
.
setPageSize
(
pageSize
);
retPage
.
setCurrentPage
(
pageNum
);
return
RestResponse
.
successResult
(
retPage
);
}
@RequestMapping
(
"/list"
)
@ResponseBody
public
RestResponse
pageLog
(
LogRecordQo
qo
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
){
...
...
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