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
44f8e201
Commit
44f8e201
authored
Feb 21, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/haoban3.0/haoban-manage3.0
into developer
parents
7b6e4701
cf9e6db4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
4 deletions
+127
-4
EnterpriseController.java
...ic/haoban/manage/web/controller/EnterpriseController.java
+1
-1
StaffMapper.java
...com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
+1
-1
LoginController.java
...com/gic/haoban/manage/web/controller/LoginController.java
+2
-2
SendCodeController.java
.../gic/haoban/manage/web/controller/SendCodeController.java
+113
-0
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+8
-0
dubbo-haoban-manage-wx.xml
...ge3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
+2
-0
No files found.
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/controller/EnterpriseController.java
View file @
44f8e201
...
...
@@ -17,7 +17,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
public
class
EnterpriseController
extends
WebBaseController
{
private
static
final
String
LOGIN_URL
=
"haoban-manage3-web/yw-login"
;
private
static
final
String
LOGIN_URL
=
"
/
haoban-manage3-web/yw-login"
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
View file @
44f8e201
...
...
@@ -21,7 +21,7 @@ public interface StaffMapper {
int
updateByPrimaryKey
(
TabHaobanStaff
record
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"nationCode"
)
String
nationcode
,
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabHaobanStaff
>
listByIds
(
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/LoginController.java
View file @
44f8e201
...
...
@@ -9,11 +9,10 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
import
com.gic.haoban.manage.web.auth.AuthRequestUtil
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
...
...
@@ -54,6 +53,7 @@ public class LoginController extends WebBaseController{
}
//运维登录
@IgnoreLogin
@RequestMapping
(
"yw-login"
)
public
HaobanResponse
ywLogin
(
String
wxEnterpriseId
)
{
//TODO 获取超级管理员账号接口
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/SendCodeController.java
View file @
44f8e201
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
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
;
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.communicate.api.service.valid.ValidationCodeService
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.reponse.SendSmsResponse
;
@RestController
public
class
SendCodeController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SendCodeController
.
class
);
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
ValidationCodeService
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
wxEnterpriseId
)
{
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
.
sendValidationCode
(
nationcode
,
phoneNumber
,
smsCode
);
logger
.
info
(
"{}-{} 的 验证码 发送结果回执:{}"
,
nationcode
,
phoneNumber
,
JSON
.
toJSONString
(
smsResponse
));
if
(!
smsResponse
.
isSuccess
())
{
HaobanResponse
response
=
new
HaobanResponse
();
response
.
setMessage
(
smsResponse
.
getMessage
());
response
.
setErrorCode
(
HaoBanErrCode
.
ERR_13
.
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
);
}
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_9
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
44f8e201
...
...
@@ -60,6 +60,14 @@ public enum HaoBanErrCode {
* 验证码校验失败
*/
ERR_12
(
12
,
"验证码校验失败"
),
ERR_13
(
13
,
"验证码发送失败"
),
ERR_20
(
20
,
"区号或者手机号码不合法"
),
ERR_21
(
21
,
"验证码已过期或者错误"
),
ERR_22
(
22
,
"验证码一分钟只能请求一次"
),
/**
* 员工档案模块
...
...
haoban-manage3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
View file @
44f8e201
...
...
@@ -28,6 +28,8 @@
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseApiService"
id=
"wxEnterpriseApiService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreService"
id=
"storeService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxCorpApiService"
id=
"qywxCorpApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.communicate.api.service.valid.ValidationCodeService"
id=
"validationCodeService"
/>
</beans>
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