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
aad4a845
Commit
aad4a845
authored
Feb 24, 2020
by
huangZW
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/haoban3.0/haoban-manage3.0.git
into developer
parents
d2973927
ddc366a4
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
178 additions
and
7 deletions
+178
-7
WxApplicationApiService.java
...ic/haoban/manage/api/service/WxApplicationApiService.java
+11
-0
WxApplicationMapper.java
...haoban/manage/service/dao/mapper/WxApplicationMapper.java
+3
-0
WxApplicationService.java
...c/haoban/manage/service/service/WxApplicationService.java
+1
-0
WxApplicationServiceImpl.java
...manage/service/service/impl/WxApplicationServiceImpl.java
+5
-0
DepartmentApiServiceImpl.java
...ge/service/service/out/impl/DepartmentApiServiceImpl.java
+1
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+7
-4
WxApplicationApiServiceImpl.java
...service/service/out/impl/WxApplicationApiServiceImpl.java
+14
-0
WxApplicationMapper.xml
...service/src/main/resources/mapper/WxApplicationMapper.xml
+7
-0
SendCodeController.java
.../gic/haoban/manage/web/controller/SendCodeController.java
+120
-0
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+2
-2
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+6
-0
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+1
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/WxApplicationApiService.java
View file @
aad4a845
...
...
@@ -6,5 +6,16 @@ import com.gic.haoban.manage.api.dto.WxApplicationDTO;
* Created by tgs on 2020/2/22.
*/
public
interface
WxApplicationApiService
{
/**
* 绑定通讯录应用
* @param dto
*/
void
addSuite
(
WxApplicationDTO
dto
);
/**
* 取消应用授权,暂时只是删除wxapplication应用绑定
* @param corpId
* @param suiteId
*/
void
cancelSuite
(
String
corpId
,
String
suiteId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/WxApplicationMapper.java
View file @
aad4a845
...
...
@@ -20,4 +20,6 @@ public interface WxApplicationMapper {
TabHaobanWxApplication
selectBySiteIdAndWxEnterpriseId
(
@Param
(
"siteId"
)
String
siteId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
TabHaobanWxApplication
selectByWxEnterpriseIdAndApplicationType
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"applicationType"
)
int
applicationType
);
int
cancelWxApplication
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"suiteId"
)
String
suiteId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxApplicationService.java
View file @
aad4a845
...
...
@@ -12,4 +12,5 @@ public interface WxApplicationService {
TabHaobanWxApplication
selectByWxEnterpriseIdAndApplicationType
(
String
wxEnterpriseId
,
int
applicationType
);
int
cancalWxApplication
(
String
wxEnterpriseId
,
String
suiteId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxApplicationServiceImpl.java
View file @
aad4a845
...
...
@@ -45,5 +45,10 @@ public class WxApplicationServiceImpl implements WxApplicationService {
return
mapper
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
applicationType
);
}
@Override
public
int
cancalWxApplication
(
String
wxEnterpriseId
,
String
suiteId
)
{
return
this
.
mapper
.
cancelWxApplication
(
wxEnterpriseId
,
suiteId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
View file @
aad4a845
...
...
@@ -341,6 +341,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
for
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
departmentDTO
:
list
){
if
(
parentId
==
departmentDTO
.
getParentid
()){
TabHaobanDepartment
exist
=
this
.
departmentService
.
getByWxId
(
departmentDTO
.
getId
()
+
""
,
wxEnterpriseId
);
logger
.
info
(
"分组是否存在:{}"
,
JSON
.
toJSONString
(
exist
));
if
(
exist
==
null
){
com
.
gic
.
haoban
.
manage
.
api
.
dto
.
DepartmentDTO
dto
=
new
com
.
gic
.
haoban
.
manage
.
api
.
dto
.
DepartmentDTO
();
dto
.
setDepartmentName
(
departmentDTO
.
getName
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
aad4a845
...
...
@@ -97,7 +97,7 @@ public class StaffApiServiceImpl implements StaffApiService {
int
index
=
0
;
for
(
String
string
:
departmentIdArr
)
{
TabHaobanDepartment
tabs
=
departmentService
.
selectById
(
string
);
wxDepartmentIdArrIntegers
[
0
]
=
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
());
wxDepartmentIdArrIntegers
[
index
]
=
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
());
index
++;
}
userDTO
.
setDepartment
(
wxDepartmentIdArrIntegers
);
...
...
@@ -328,13 +328,16 @@ public class StaffApiServiceImpl implements StaffApiService {
if
(
application
!=
null
)
{
UserDTO
userDTO
=
new
UserDTO
();
userDTO
.
setCorpid
(
enterpriseDTO
.
getCorpid
());
List
<
Integer
>
wxDepartmentIdArrIntegers
=
new
ArrayList
<
Integer
>();
String
[]
departmentIdArr
=
departmentIds
.
split
(
","
);
Integer
[]
wxDepartmentIdArrIntegers
=
new
Integer
[
departmentIdArr
.
length
];
int
index
=
0
;
for
(
String
string
:
departmentIdArr
)
{
TabHaobanDepartment
tabs
=
departmentService
.
selectById
(
string
);
wxDepartmentIdArrIntegers
.
add
(
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
()));
wxDepartmentIdArrIntegers
[
index
]
=
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
());
index
++;
}
userDTO
.
setDepartment
(
(
Integer
[])
wxDepartmentIdArrIntegers
.
toArray
()
);
userDTO
.
setDepartment
(
wxDepartmentIdArrIntegers
);
userDTO
.
setGender
(
"女"
);
userDTO
.
setMobile
(
staffDTO
.
getPhoneNumber
());
userDTO
.
setName
(
staffDTO
.
getStaffName
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxApplicationApiServiceImpl.java
View file @
aad4a845
...
...
@@ -2,7 +2,9 @@ package com.gic.haoban.manage.service.service.out.impl;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.service.WxApplicationService
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -19,10 +21,22 @@ public class WxApplicationApiServiceImpl implements WxApplicationApiService{
@Autowired
private
WxApplicationService
wxApplicationService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Override
public
void
addSuite
(
WxApplicationDTO
dto
)
{
TabHaobanWxApplication
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanWxApplication
.
class
,
dto
);
this
.
wxApplicationService
.
insert
(
tab
);
}
@Override
public
void
cancelSuite
(
String
corpId
,
String
suiteId
)
{
WxEnterpriseDTO
enterprise
=
this
.
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
if
(
enterprise
!=
null
){
int
i
=
this
.
wxApplicationService
.
cancalWxApplication
(
enterprise
.
getWxEnterpriseId
(),
suiteId
);
log
.
info
(
"取消授权结果:{}"
,
i
);
}
log
.
info
(
"企业未绑定过,{}"
,
corpId
);
}
}
haoban-manage3-service/src/main/resources/mapper/WxApplicationMapper.xml
View file @
aad4a845
...
...
@@ -179,4 +179,10 @@
and status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId}
</select>
<update
id=
"cancelWxApplication"
>
update tab_haoban_wx_application
set status_flag = 0
where wx_enterprise_id = #{wxEnterpriseId} and suite_id = #{suiteId} and status_flag = 1
</update>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/SendCodeController.java
0 → 100644
View file @
aad4a845
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_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
);
}
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-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
aad4a845
...
...
@@ -75,8 +75,8 @@ public class StaffController extends WebBaseController{
}
@RequestMapping
(
"staff-list"
)
public
HaobanResponse
staffList
(
String
departmentId
,
Integer
activeFlag
,
String
key
w
ord
,
BasePageInfo
pageInfo
){
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentId
,
activeFlag
,
key
w
ord
,
pageInfo
);
public
HaobanResponse
staffList
(
String
departmentId
,
Integer
activeFlag
,
String
key
W
ord
,
BasePageInfo
pageInfo
){
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentId
,
activeFlag
,
key
W
ord
,
pageInfo
);
List
<
StaffDTO
>
list
=
page
.
getResult
();
if
(
list
!=
null
)
{
for
(
StaffDTO
staffDTO
:
list
)
{
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
aad4a845
...
...
@@ -60,6 +60,12 @@ public enum HaoBanErrCode {
* 验证码校验失败
*/
ERR_12
(
12
,
"验证码校验失败"
),
ERR_20
(
20
,
"区号或者手机号码不合法"
),
ERR_21
(
21
,
"验证码已过期或者错误"
),
ERR_22
(
22
,
"验证码一分钟只能请求一次"
),
ERR_10001
(
10001
,
"父部门不存在"
),
ERR_10002
(
10002
,
"门店类型部门不能新增子节点"
),
...
...
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
aad4a845
...
...
@@ -42,6 +42,6 @@
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxSuiteApiService"
id=
"qywxSuiteApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxApplicationApiService"
id=
"wxApplicationApiService"
/>
<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