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
fd55454e
Commit
fd55454e
authored
May 10, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录调整
parent
d6097a4e
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
462 additions
and
544 deletions
+462
-544
LoginDTO.java
...src/main/java/com/gic/haoban/manage/api/dto/LoginDTO.java
+0
-48
TabHaobanAuditMapper.java
...aoban/manage/service/dao/mapper/TabHaobanAuditMapper.java
+3
-0
TabHaobanAuditMapper.xml
...ervice/src/main/resources/mapper/TabHaobanAuditMapper.xml
+5
-0
AuthRequestUtil.java
.../java/com/gic/haoban/manage/web/auth/AuthRequestUtil.java
+0
-152
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+3
-3
AuditController.java
...com/gic/haoban/manage/web/controller/AuditController.java
+6
-12
GicDepartmentController.java
...haoban/manage/web/controller/GicDepartmentController.java
+15
-13
LoginController.java
...com/gic/haoban/manage/web/controller/LoginController.java
+142
-224
MaterialController.java
.../gic/haoban/manage/web/controller/MaterialController.java
+6
-10
RightController.java
...com/gic/haoban/manage/web/controller/RightController.java
+2
-2
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+3
-16
SyncDealContoller.java
...m/gic/haoban/manage/web/controller/SyncDealContoller.java
+1
-5
WebBaseController.java
...m/gic/haoban/manage/web/controller/WebBaseController.java
+6
-10
WelcomeController.java
...m/gic/haoban/manage/web/controller/WelcomeController.java
+6
-6
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+15
-41
StaffVO.java
...b/src/main/java/com/gic/haoban/manage/web/vo/StaffVO.java
+249
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/LoginDTO.java
deleted
100644 → 0
View file @
d6097a4e
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
public
class
LoginDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
StaffDTO
staffDTO
;
private
String
wxEnterpriseId
;
private
String
enterpriseId
;
private
Integer
wxEnterpriseType
;
public
Integer
getWxEnterpriseType
()
{
return
wxEnterpriseType
;
}
public
void
setWxEnterpriseType
(
Integer
wxEnterpriseType
)
{
this
.
wxEnterpriseType
=
wxEnterpriseType
;
}
public
StaffDTO
getStaffDTO
()
{
return
staffDTO
;
}
public
void
setStaffDTO
(
StaffDTO
staffDTO
)
{
this
.
staffDTO
=
staffDTO
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanAuditMapper.java
View file @
fd55454e
...
...
@@ -36,4 +36,6 @@ public interface TabHaobanAuditMapper {
TabHaobanAudit
findByBindRelatedIdAndAuditType
(
@Param
(
"relatedId"
)
String
relatedId
,
@Param
(
"auditType"
)
int
auditType
);
List
<
TabHaobanAudit
>
judgeHavePhoneNumberOrCode
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"clerkCode"
)
String
clerkCode
,
@Param
(
"phoneNumber"
)
String
phoneNumber
);
int
getAuditCount
(
String
enterpriseId
,
@Param
(
"storeIds"
)
List
<
String
>
storeIds
)
;
}
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanAuditMapper.xml
View file @
fd55454e
...
...
@@ -444,4 +444,8 @@
)
</select>
<select
id=
"getAuditCount"
>
</select>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/auth/AuthRequestUtil.java
deleted
100644 → 0
View file @
d6097a4e
package
com
.
gic
.
haoban
.
manage
.
web
.
auth
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.manage.api.dto.LoginDTO
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
/**
* Created 2018/7/26.
* 新方法 AuthWebRequestUtil
* @author hua
*/
@Deprecated
public
class
AuthRequestUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AuthRequestUtil
.
class
);
public
static
final
String
REDIS_LOGIN_USER_TOKEN_PREFIX
=
"GIC:HAOBAN:HAOBAN_MOBILE_APP:LOGIN_USER:"
;
public
static
final
String
REDIS_FAKE_LOGIN_FLAG_PREFIX
=
"GIC:HAOBAN:HAOBAN_MOBILE_APP:FAKE_LOGIN_TOKEN:"
;
public
static
String
LOGIN_SESSION_KEY
=
"HAOBAN:LOGINUSER"
;
public
static
void
setSessionUser
(
Object
obj
)
{
String
userJson
=
JSON
.
toJSONString
(
obj
);
getSession
().
setAttribute
(
LOGIN_SESSION_KEY
,
userJson
);
}
public
static
void
delSessionUser
()
{
getSession
().
removeAttribute
(
LOGIN_SESSION_KEY
);
}
public
static
LoginDTO
getAppLoginUser
(
String
token
)
{
logger
.
info
(
"token-web="
+
token
);
if
(
StringUtils
.
isBlank
(
token
))
{
return
null
;
}
return
EntityUtil
.
changeEntityByJSON
(
LoginDTO
.
class
,
RedisUtil
.
getCache
(
token
));
}
private
static
void
setLoginUserLastToken
(
String
token
,
Object
obj
)
{
try
{
String
userId
=
BeanUtils
.
getProperty
(
obj
,
"user.userId"
);
if
(
StringUtils
.
isNotBlank
(
userId
)
&&
StringUtils
.
isNotBlank
(
token
))
{
RedisUtil
.
setCache
(
REDIS_LOGIN_USER_TOKEN_PREFIX
+
userId
,
token
,
31L
,
TimeUnit
.
DAYS
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
}
/**
* 是否为用户最后一次登录token
*
* @param token
* @param userId
* @return
*/
public
static
boolean
isLoginUserLastToken
(
String
token
,
String
userId
)
{
Object
lastUserLoginToken
=
RedisUtil
.
getCache
(
REDIS_LOGIN_USER_TOKEN_PREFIX
+
userId
);
// 如果用户最后一次登录token不符则返回false
return
!(
lastUserLoginToken
instanceof
CharSequence
)
||
StringUtils
.
equals
(
token
,
(
CharSequence
)
lastUserLoginToken
);
}
private
static
void
setFakeLoginFlag
(
String
token
)
{
if
(
StringUtils
.
isNotBlank
(
token
))
{
RedisUtil
.
setCache
(
REDIS_FAKE_LOGIN_FLAG_PREFIX
+
token
,
new
Date
(),
30L
,
TimeUnit
.
DAYS
);
}
}
/**
* 是否为伪登录token
*
* @param token
* @return
*/
public
static
boolean
isFakeLoginToken
(
String
token
)
{
return
StringUtils
.
isNotBlank
(
token
)
&&
RedisUtil
.
getCache
(
REDIS_FAKE_LOGIN_FLAG_PREFIX
+
token
)
!=
null
;
}
public
static
void
setAppLoginUser
(
String
token
,
Object
obj
)
{
RedisUtil
.
setCache
(
token
,
obj
,
30L
,
TimeUnit
.
DAYS
);
getResponse
().
setHeader
(
"token"
,
token
);
}
public
static
void
setAppFakeLoginUser
(
String
token
,
Object
obj
)
{
RedisUtil
.
setCache
(
token
,
obj
,
30L
,
TimeUnit
.
DAYS
);
getResponse
().
setHeader
(
"token"
,
token
);
setFakeLoginFlag
(
token
);
}
public
static
void
delToken
()
{
String
token
=
getRequest
().
getHeader
(
"token"
);
RedisUtil
.
delCache
(
token
);
}
public
static
void
setAppLoginUser
(
Object
obj
,
String
token
)
{
RedisUtil
.
setCache
(
token
,
obj
,
30L
,
TimeUnit
.
DAYS
);
getResponse
().
setHeader
(
"token"
,
token
);
}
public
static
void
setAppFakeLoginUser
(
Object
obj
)
{
String
token
=
getRequest
().
getHeader
(
"token"
);
RedisUtil
.
setCache
(
token
,
obj
,
30L
,
TimeUnit
.
DAYS
);
getResponse
().
setHeader
(
"token"
,
token
);
}
public
static
HttpSession
getSession
()
{
HttpSession
session
=
null
;
try
{
session
=
getRequest
().
getSession
();
}
catch
(
Exception
e
)
{
}
return
session
;
}
public
static
HttpServletRequest
getRequest
()
{
ServletRequestAttributes
attrs
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
return
attrs
.
getRequest
();
}
public
static
HttpServletResponse
getResponse
()
{
ServletRequestAttributes
attrs
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
return
attrs
.
getResponse
();
}
public
static
LoginDTO
getLoginUser
()
{
Cookie
[]
cookies
=
getRequest
().
getCookies
();
String
token
=
""
;
if
(
cookies
!=
null
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
"token"
))
{
token
=
cookie
.
getValue
();
}
}
}
return
getAppLoginUser
(
token
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
fd55454e
...
...
@@ -131,7 +131,7 @@ public class ApplicationController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
if
(
enterpriseDTO
.
getContactFlag
()
!=
null
&&
enterpriseDTO
.
getContactFlag
()
==
0
)
{
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"同步企业微信架构"
,
login
.
getStaff
DTO
().
getStaffId
(),
"首次同步企业微信架构"
);
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"同步企业微信架构"
,
login
.
getStaff
Id
(),
"首次同步企业微信架构"
);
if
(
StringUtils
.
isBlank
(
taskId
))
{
log
.
info
(
"【是否绑定】taskId={}"
,
taskId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
...
...
@@ -164,7 +164,7 @@ public class ApplicationController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
if
(
StringUtils
.
isNotBlank
(
secretSetting
.
getSecretVal
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
)
{
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"后门同步企业微信架构"
,
login
.
getStaff
DTO
().
getStaffId
(),
"后门同步企业微信架构"
);
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"后门同步企业微信架构"
,
login
.
getStaff
Id
(),
"后门同步企业微信架构"
);
if
(
StringUtils
.
isBlank
(
taskId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
...
...
@@ -261,7 +261,7 @@ public class ApplicationController extends WebBaseController {
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
)
{
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"后门同步企业微信架构"
,
login
.
getStaff
DTO
().
getStaffId
(),
"后门同步企业微信架构"
);
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"后门同步企业微信架构"
,
login
.
getStaff
Id
(),
"后门同步企业微信架构"
);
if
(
StringUtils
.
isBlank
(
taskId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_0
,
false
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/AuditController.java
View file @
fd55454e
...
...
@@ -6,7 +6,6 @@ import com.gic.enterprise.api.dto.StoreDTO;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebStaffDTO
;
import
com.gic.haoban.common.anno.HttpLimit
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
...
...
@@ -165,8 +164,8 @@ public class AuditController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
staffId
=
login
.
getStaff
DTO
().
getStaffId
();
String
staffName
=
login
.
getStaff
DTO
().
getStaffName
();
String
staffId
=
login
.
getStaff
Id
();
String
staffName
=
login
.
getStaff
Name
();
String
[]
s
=
auditIds
.
split
(
","
);
int
successCount
=
0
;
int
failCount
=
0
;
...
...
@@ -194,8 +193,8 @@ public class AuditController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
staffId
=
login
.
getStaff
DTO
().
getStaffId
();
String
staffName
=
login
.
getStaff
DTO
().
getStaffName
();
String
staffId
=
login
.
getStaff
Id
();
String
staffName
=
login
.
getStaff
Name
();
auditApiService
.
refuse
(
auditId
,
auditReason
,
staffId
,
staffName
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
...
...
@@ -204,13 +203,8 @@ public class AuditController extends WebBaseController{
@RequestMapping
(
"audit"
)
public
HaobanResponse
audit
(
String
auditId
,
String
auditName
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebStaffDTO
loginStaffDTO
=
login
.
getStaffDTO
();
if
(
null
==
loginStaffDTO
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
String
staffId
=
login
.
getStaffDTO
().
getStaffId
();
String
staffName
=
login
.
getStaffDTO
().
getStaffName
();
String
staffId
=
login
.
getStaffId
();
String
staffName
=
login
.
getStaffName
();
if
(
StringUtils
.
isAnyBlank
(
auditId
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/GicDepartmentController.java
View file @
fd55454e
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
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.RestController
;
import
com.gic.enterprise.api.dto.PowerStoreGroupDTO
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.LoginDTO
;
import
com.gic.haoban.manage.api.dto.StoreRangeInfoDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.StoreGroupVo
;
import
org.apache.commons.collections.CollectionUtils
;
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.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@RestController
public
class
GicDepartmentController
extends
WebBaseController
{
...
...
@@ -42,7 +44,7 @@ public class GicDepartmentController extends WebBaseController{
@RequestMapping
(
"gic-store-group-list"
)
public
HaobanResponse
storeGroupList
(
String
enterpriseId
,
String
keyWord
)
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
List
<
PowerStoreGroupDTO
>
departmentList
=
storeGroupService
.
getStoreGroupList
(
enterpriseId
,
keyWord
);
List
<
StoreRangeInfoDTO
>
rangeInfoDTOList
=
wxEnterpriseRelatedApiService
.
listAllBindStoreOrGroup
(
enterpriseId
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/LoginController.java
View file @
fd55454e
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.crypto.SecureUtil
;
import
cn.hutool.crypto.symmetric.AES
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.collections.CollectionUtils
;
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.RestController
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.view.RedirectView
;
import
com.alibaba.dubbo.common.URL
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.PowerClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.UserService
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.anno.IgnoreLogin
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.LoginDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
...
...
@@ -27,31 +46,14 @@ import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.haoban.manage.web.vo.WebLoginVO
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
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.RestController
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.view.RedirectView
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
cn.hutool.crypto.SecureUtil
;
import
cn.hutool.crypto.symmetric.AES
;
@RestController
public
class
LoginController
extends
WebBaseController
{
...
...
@@ -69,8 +71,6 @@ public class LoginController extends WebBaseController {
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
private
UserService
userService
;
...
...
@@ -78,6 +78,8 @@ public class LoginController extends WebBaseController {
private
Config
config
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
EnterpriseService
enterpriseService
;
/**
* 企微后台登录
...
...
@@ -88,50 +90,44 @@ public class LoginController extends WebBaseController {
public
void
login
(
String
auth_code
,
HttpServletResponse
response
)
{
String
userJson
=
qywxCorpApiService
.
getLoginUserInfo
(
config
.
getCorpid
(),
auth_code
);
if
(
StringUtils
.
isBlank
(
userJson
))
{
logger
.
info
(
"未查询到用户:auth_code:{}"
,
auth_code
);
logger
.
info
(
"未查询到用户:auth_code:{}"
,
auth_code
);
return
;
}
UserDTO
user
=
JSON
.
parseObject
(
userJson
,
UserDTO
.
class
);
String
corpId
=
user
.
getCorpid
();
logger
.
info
(
"【企业微信登录】userId={},auth_code={},corpId={}"
,
user
.
getUserid
(),
auth_code
,
corpId
);
WxEnterpriseDTO
e
nterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
logger
.
info
(
"【企业微信】enterprise={}"
,
JSON
.
toJSONString
(
e
nterprise
));
WxEnterpriseDTO
wxE
nterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
logger
.
info
(
"【企业微信】enterprise={}"
,
JSON
.
toJSONString
(
wxE
nterprise
));
StaffDTO
loginStaff
=
null
;
if
(
enterprise
!=
null
)
{
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
wxEnterprise
!=
null
)
{
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
wxEnterprise
.
getWxEnterpriseId
());
}
if
(
loginStaff
==
null
)
{
if
(
enterprise
!=
null
)
{
staffApiService
.
wxFristAdd
(
JSON
.
toJSONString
(
user
),
enterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
wxEnterprise
!=
null
)
{
staffApiService
.
wxFristAdd
(
JSON
.
toJSONString
(
user
),
wxEnterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
wxEnterprise
.
getWxEnterpriseId
());
}
}
LoginDTO
loginVO
=
new
LoginDTO
();
logger
.
info
(
"【好办web登录】staff={}"
,
JSON
.
toJSONString
(
loginStaff
));
if
(
loginStaff
==
null
)
{
return
;
}
loginVO
.
setWxEnterpriseId
(
loginStaff
.
getWxEnterpriseId
());
loginVO
.
setStaffDTO
(
loginStaff
);
WebLoginDTO
webLoginDTO
=
EntityUtil
.
changeEntityByOrika
(
WebLoginDTO
.
class
,
loginVO
);
AuthWebRequestUtil
.
setSessionUser
(
webLoginDTO
);
String
redirectUri
=
config
.
getHost
()
+
"index"
;
redirectUri
=
redirectUri
.
replace
(
"haoban-manage3-web"
,
"haoban-3/#"
);
String
token
=
ToolUtil
.
randomUUID
()
+
"-"
+
ToolUtil
.
randomStringByTime
();
AuthWebRequestUtil
.
setAppLoginUser
(
token
,
webLoginDTO
);
try
{
Cookie
cookie
=
new
Cookie
(
"token"
,
token
);
cookie
.
setPath
(
"/"
);
response
.
addCookie
(
cookie
);
response
.
sendRedirect
(
redirectUri
);
response
.
setHeader
(
"token"
,
token
);
}
catch
(
IOException
e
)
{
logger
.
warn
(
"异常"
,
e
);
String
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
();
List
<
EnterpriseDetailDTO
>
list
=
this
.
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"企微下无关联GIC商户"
);
return
;
}
String
gicEnterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
String
loginPhoneNumber
=
loginStaff
.
getPhoneNumber
();
if
(
StringUtils
.
isBlank
(
loginPhoneNumber
))
{
logger
.
info
(
"未配置手机号,staffId ={}"
,
loginStaff
.
getStaffId
());
return
;
}
this
.
doLogin
(
wxEnterpriseId
,
gicEnterpriseId
,
loginPhoneNumber
,
"gic"
,
response
);
}
/**
...
...
@@ -144,26 +140,28 @@ public class LoginController extends WebBaseController {
*/
@IgnoreLogin
@RequestMapping
(
"yw-login"
)
public
HaobanResponse
ywLogin
(
String
enterpriseId
,
String
wxEnterpriseId
,
String
random
,
HttpServletResponse
response
)
{
//判断是否存在random
public
HaobanResponse
ywLogin
(
String
enterpriseId
,
String
wxEnterpriseId
,
String
random
,
HttpServletResponse
response
)
{
// 判断是否存在random
Object
o
=
RedisUtil
.
getCache
(
random
);
if
(
o
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
List
<
EnterpriseDetailDTO
>
list
=
this
.
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
List
<
EnterpriseDetailDTO
>
list
=
this
.
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
enterpriseId
=
list
.
get
(
0
).
getEnterpriseId
()
;
enterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
}
String
gicSuperPhone
=
clerkService
.
getSuperAdminPhoneNumber
(
enterpriseId
)
;
logger
.
info
(
"登录商户id={},超管手机={}"
,
enterpriseId
,
gicSuperPhone
);
String
result
=
this
.
doLogin
(
wxEnterpriseId
,
enterpriseId
,
gicSuperPhone
,
response
)
;
if
(
StringUtils
.
isNotBlank
(
result
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
String
gicSuperPhone
=
clerkService
.
getSuperAdminPhoneNumber
(
enterpriseId
);
logger
.
info
(
"登录商户id={},超管手机={}"
,
enterpriseId
,
gicSuperPhone
);
String
result
=
this
.
doLogin
(
wxEnterpriseId
,
enterpriseId
,
gicSuperPhone
,
"yw"
,
response
)
;
if
(
StringUtils
.
isNotBlank
(
result
))
{
return
this
.
fail
(
result
);
}
return
null
;
return
null
;
}
/**
...
...
@@ -177,7 +175,7 @@ public class LoginController extends WebBaseController {
@IgnoreLogin
@RequestMapping
(
"gic-login"
)
public
ModelAndView
gicLogin
(
String
random
,
String
wxEnterpriseId
,
HttpServletResponse
response
)
{
//判断是否存在random
//
判断是否存在random
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
o
=
aes
.
decryptStr
(
random
);
if
(
o
==
null
||
StringUtils
.
isBlank
(
wxEnterpriseId
))
{
...
...
@@ -195,149 +193,58 @@ public class LoginController extends WebBaseController {
return
model
;
}
WxEnterpriseDTO
detailDTO
=
enterpriseDTOList
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
findFirst
().
orElse
(
null
);
WxEnterpriseDTO
detailDTO
=
enterpriseDTOList
.
stream
()
.
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
findFirst
().
orElse
(
null
);
if
(
null
==
detailDTO
)
{
logger
.
info
(
"登录失败,不存在对应企业:gicEnterpriseId:{}"
,
gicEnterpriseId
);
logger
.
info
(
"登录失败,不存在对应企业:gicEnterpriseId:{}"
,
gicEnterpriseId
);
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/gic-error"
,
false
,
false
));
return
model
;
}
String
result
=
this
.
doLogin
(
wxEnterpriseId
,
gicEnterpriseId
,
loginPhoneNumber
,
response
)
;
if
(
StringUtils
.
isNotBlank
(
result
))
{
String
result
=
this
.
doLogin
(
wxEnterpriseId
,
gicEnterpriseId
,
loginPhoneNumber
,
"gic"
,
response
)
;
if
(
StringUtils
.
isNotBlank
(
result
))
{
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/gic-error"
,
false
,
false
));
return
model
;
}
/* StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(detailDTO.getWxEnterpriseId(), "86", loginPhoneNumber);
if (null == staff) {
logger.info("登录用户手机号不存在!gicEnterpriseId:{}", gicEnterpriseId);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
return model;
}
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
if (null == application) {
logger.info("登录企业应用 没授权!gicEnterpriseId:{}",gicEnterpriseId);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
return model;
}
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (null == enterprise) {
logger.info("登录失败,不存在对应企业:wxEnterpriseId{}", wxEnterpriseId);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
return model;
}
//获取管理员列表
String corpid = enterprise.getCorpid();
String adminList = qywxSuiteApiService.getAdminList(corpid, application.getSiteId(), Integer.parseInt(application.getAgentId()));
List<String> userIds = new ArrayList<String>();
if (StringUtils.isNotBlank(adminList)) {
JSONArray jsonArr = JSON.parseArray(adminList);
for (Object object : jsonArr) {
JSONObject json = JSON.parseObject(JSON.toJSONString(object));
userIds.add(json.getString("userid"));
}
}
//兼容
if (corpid.length() > 20) {
if (!userIds.contains(staff.getWxOpenUseId())) {
logger.info("登录失败,当前用户不是管理员:{}", JSON.toJSONString(userIds));
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
return model;
}
} else {
if (!userIds.contains(staff.getWxUserId())) {
logger.info("登录失败,当前用户不是管理员:{}", JSON.toJSONString(userIds));
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
return model;
}
}
LoginDTO loginDTO = new LoginDTO();
loginDTO.setWxEnterpriseId(detailDTO.getWxEnterpriseId());
loginDTO.setEnterpriseId(gicEnterpriseId);
//导购id
ClerkDTO clerk = clerkService.getClerkByPhoneNumber(loginPhoneNumber, gicEnterpriseId);
if (clerk != null) {
staff.setClerkId(clerk.getClerkId());
staff.setClerkName(clerk.getClerkName());
staff.setClerkCode(clerk.getClerkCode());
}
loginDTO.setStaffDTO(staff);
String redirectUri = config.getHost() + "index";
redirectUri = redirectUri.replace("haoban-manage3-web", "haoban-3/#");
String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime();
WebLoginDTO webLoginDTO = EntityUtil.changeEntityByOrika(WebLoginDTO.class, loginDTO);
AuthWebRequestUtil.setSessionUser(webLoginDTO);
AuthWebRequestUtil.setAppLoginUser(token, webLoginDTO);
try {
Cookie cookie = new Cookie("token", token);
cookie.setPath("/");
response.addCookie(cookie);
response.sendRedirect(redirectUri);
response.setHeader("token", token);
} catch (IOException e) {
e.printStackTrace();
}*/
return
null
;
}
private
String
doLogin
(
String
wxEnterpriseId
,
String
gicEnterpriseId
,
String
loginPhoneNumber
,
HttpServletResponse
response
)
{
private
String
doLogin
(
String
wxEnterpriseId
,
String
gicEnterpriseId
,
String
loginPhoneNumber
,
String
loginChannel
,
HttpServletResponse
response
)
{
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
"86"
,
loginPhoneNumber
);
if
(
null
==
staff
)
{
logger
.
info
(
"登录用户手机号不存在!gicEnterpriseId:{}"
,
gicEnterpriseId
);
return
"登录
用户手机号不存在
"
;
return
"登录
失败,好办用户手机号不存在("
+
loginPhoneNumber
+
")
"
;
}
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
if
(
null
==
application
)
{
logger
.
info
(
"登录企业应用 没授权!gicEnterpriseId:{}"
,
gicEnterpriseId
);
return
"登录
企业应用
没授权"
;
logger
.
info
(
"登录企业应用 没授权!gicEnterpriseId:{}"
,
gicEnterpriseId
);
return
"登录
失败,企业应用
没授权"
;
}
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
null
==
enterprise
)
{
logger
.
info
(
"登录失败,不存在对应企业:wxEnterpriseId{}"
,
wxEnterpriseId
);
return
"登录失败,不存在对应企业"
;
}
//获取管理员列表
String
corpid
=
enterprise
.
getCorpid
();
String
adminList
=
qywxSuiteApiService
.
getAdminList
(
corpid
,
application
.
getSiteId
(),
Integer
.
parseInt
(
application
.
getAgentId
()));
List
<
String
>
userIds
=
new
ArrayList
<
String
>();
if
(
StringUtils
.
isNotBlank
(
adminList
))
{
JSONArray
jsonArr
=
JSON
.
parseArray
(
adminList
);
for
(
Object
object
:
jsonArr
)
{
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
object
));
userIds
.
add
(
json
.
getString
(
"userid"
));
}
}
//兼容
if
(
corpid
.
length
()
>
20
)
{
if
(!
userIds
.
contains
(
staff
.
getWxOpenUseId
()))
{
logger
.
info
(
"登录失败,当前用户不是管理员:{}"
,
JSON
.
toJSONString
(
userIds
));
return
"登录失败,当前用户不是管理员"
;
}
}
else
{
if
(!
userIds
.
contains
(
staff
.
getWxUserId
()))
{
logger
.
info
(
"登录失败,当前用户不是管理员:{}"
,
JSON
.
toJSONString
(
userIds
));
return
"登录失败,当前用户不是管理员"
;
}
}
LoginDTO
loginDTO
=
new
LoginDTO
();
loginDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
loginDTO
.
setEnterpriseId
(
gicEnterpriseId
);
//导购id
ClerkDTO
clerk
=
clerkService
.
getClerkByPhoneNumber
(
loginPhoneNumber
,
gicEnterpriseId
);
if
(
clerk
!=
null
)
{
staff
.
setClerkId
(
clerk
.
getClerkId
());
staff
.
setClerkName
(
clerk
.
getClerkName
());
staff
.
setClerkCode
(
clerk
.
getClerkCode
());
return
"登录失败,不存在对应企业"
;
}
loginDTO
.
setStaffDTO
(
staff
);
WebLoginDTO
webLoginDTO
=
EntityUtil
.
changeEntityByJSON
(
WebLoginDTO
.
class
,
staff
);
webLoginDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
webLoginDTO
.
setEnterpriseId
(
gicEnterpriseId
);
// 导购id
ClerkDTO
clerk
=
clerkService
.
getClerkByPhoneNumber
(
loginPhoneNumber
,
gicEnterpriseId
);
if
(
clerk
==
null
)
{
logger
.
info
(
"gic账号不存在,eid={},phone={}"
,
gicEnterpriseId
,
loginPhoneNumber
);
return
"登录失败,gic账号不存在"
;
}
EnterpriseDTO
en
=
this
.
enterpriseService
.
getEnterpriseById
(
gicEnterpriseId
)
;
webLoginDTO
.
setLoginChannel
(
loginChannel
);
webLoginDTO
.
setClerkId
(
clerk
.
getClerkId
());
webLoginDTO
.
setClerkName
(
clerk
.
getClerkName
());
webLoginDTO
.
setBrandName
(
en
.
getBrandName
());
String
redirectUri
=
config
.
getHost
()
+
"index"
;
redirectUri
=
redirectUri
.
replace
(
"haoban-manage3-web"
,
"haoban-3/#"
);
String
token
=
ToolUtil
.
randomUUID
()
+
"-"
+
ToolUtil
.
randomStringByTime
();
WebLoginDTO
webLoginDTO
=
EntityUtil
.
changeEntityByOrika
(
WebLoginDTO
.
class
,
loginDTO
);
AuthWebRequestUtil
.
setSessionUser
(
webLoginDTO
);
AuthWebRequestUtil
.
setAppLoginUser
(
token
,
webLoginDTO
);
try
{
...
...
@@ -350,48 +257,57 @@ public class LoginController extends WebBaseController {
e
.
printStackTrace
();
}
return
null
;
}
@RequestMapping
(
"login_local"
)
@Deprecated
public
HaobanResponse
login
()
{
LoginDTO
loginVO
=
new
LoginDTO
();
StaffDTO
staff
=
staffApiService
.
selectById
(
"2205f92cdb5f468cb996e91dded414c2"
);
String
token
=
ToolUtil
.
randomUUID
()
+
"-"
+
ToolUtil
.
randomStringByTime
();
logger
.
info
(
"【好办登录】staff={}"
,
JSON
.
toJSONString
(
staff
));
loginVO
.
setWxEnterpriseId
(
staff
.
getWxEnterpriseId
());
loginVO
.
setStaffDTO
(
staff
);
AuthWebRequestUtil
.
setAppLoginUser
(
token
,
EntityUtil
.
changeEntityByOrika
(
WebLoginDTO
.
class
,
loginVO
));
Cookie
cookie
=
new
Cookie
(
"token"
,
token
);
cookie
.
setPath
(
"/"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
loginVO
);
}
/**
* 获取登录信息
*
* @return res
*/
@RequestMapping
(
"get-login-info"
)
public
HaobanResponse
getLoginInfo
()
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
phoneNumber
=
loginUser
.
getStaffDTO
().
getPhoneNumber
();
if
(
StringUtils
.
isNotBlank
(
phoneNumber
)){
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByPhoneNumber
(
phoneNumber
);
String
enterpriseId
=
loginUser
.
getEnterpriseId
();
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
loginUser
.
setEnterpriseId
(
clerkDTO
.
getEnterpriseId
());
WebLoginVO
vo
=
EntityUtil
.
changeEntityByOrika
(
WebLoginVO
.
class
,
loginUser
)
;
String
staffId
=
loginUser
.
getStaffId
()
;
StaffDTO
dto
=
this
.
staffApiService
.
selectById
(
staffId
)
;
StaffVO
staffVO
=
EntityUtil
.
changeEntityByOrika
(
StaffVO
.
class
,
dto
)
;
vo
.
setStaffDTO
(
staffVO
);
return
this
.
success
(
vo
)
;
}
/**
* 切换GIC商户
* @param enterpriseId
* @return
*/
@RequestMapping
(
"enterprise-is-over"
)
public
HaobanResponse
enterpriseIsOver
(
String
enterpriseId
)
{
if
(
StringUtils
.
isEmpty
(
enterpriseId
))
{
return
this
.
fail
(
"企业ID空"
)
;
}
EnterpriseDTO
enterprise
=
this
.
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
null
==
enterprise
)
{
return
this
.
fail
(
"gic商户查询不到"
)
;
}
Integer
superAdmin
=
clerkDTO
.
getSuperAdmin
();
if
(
superAdmin
!=
null
&&
superAdmin
==
1
)
{
loginUser
.
getStaffDTO
().
setSuperManagerFlag
(
1
);
String
token
=
AuthWebRequestUtil
.
getToken
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
null
==
loginUser
)
{
return
this
.
fail
(
"用户未登录"
)
;
}
logger
.
info
(
"切换商户,登录信息={},enterpriseId"
,
JSON
.
toJSONString
(
loginUser
),
enterpriseId
);
String
phoneNumber
=
loginUser
.
getPhoneNumber
()
;
ClerkDTO
clerk
=
clerkService
.
getClerkByPhoneNumber
(
phoneNumber
,
enterpriseId
);
if
(
clerk
==
null
)
{
logger
.
info
(
"切换商户失败,gic账号不存在,eid={},phone={}"
,
enterpriseId
,
phoneNumber
);
this
.
fail
(
"切换商户失败,gic账号不存在"
)
;
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
loginUser
);
loginUser
.
setEnterpriseId
(
enterpriseId
);
loginUser
.
setClerkId
(
clerk
.
getClerkId
());
loginUser
.
setClerkName
(
clerk
.
getClerkName
());
loginUser
.
setBrandName
(
enterprise
.
getBrandName
());
AuthWebRequestUtil
.
setSessionUser
(
loginUser
);
AuthWebRequestUtil
.
setAppLoginUser
(
token
,
loginUser
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
/**
...
...
@@ -403,7 +319,8 @@ public class LoginController extends WebBaseController {
public
HaobanResponse
getLoginQrcode
()
throws
UnsupportedEncodingException
{
String
corpid
=
config
.
getCorpid
();
String
redirectUri
=
config
.
getHost
()
+
"login"
;
String
url
=
"https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid="
+
corpid
+
"&redirect_uri="
+
URLEncoder
.
encode
(
redirectUri
,
"UTF-8"
)
+
"&state=web_login@gyoss9&usertype=admin"
;
String
url
=
"https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid="
+
corpid
+
"&redirect_uri="
+
URLEncoder
.
encode
(
redirectUri
,
"UTF-8"
)
+
"&state=web_login@gyoss9&usertype=admin"
;
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
URL
.
decode
(
url
));
}
...
...
@@ -414,7 +331,7 @@ public class LoginController extends WebBaseController {
*/
@RequestMapping
(
"login-wx-enterprise-list"
)
public
HaobanResponse
loginWxEnterpriseList
(
String
random
)
{
//判断是否存在random
//
判断是否存在random
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
o
=
aes
.
decryptStr
(
random
);
if
(
o
==
null
)
{
...
...
@@ -431,7 +348,8 @@ public class LoginController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
if
(
StringUtils
.
isNotBlank
(
wxEnterpriseId
))
{
List
<
WxEnterpriseDTO
>
collect
=
enterpriseDTOList
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
collect
(
Collectors
.
toList
());
List
<
WxEnterpriseDTO
>
collect
=
enterpriseDTOList
.
stream
()
.
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
collect
(
Collectors
.
toList
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
collect
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
enterpriseDTOList
);
...
...
@@ -457,19 +375,18 @@ public class LoginController extends WebBaseController {
RedisUtil
.
delCache
(
token
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"/gic-login-check"
)
public
ModelAndView
gicLogin
(
String
code
,
String
hbEnt
)
{
logger
.
info
(
"gic登录code={},hbEnt={}"
,
code
,
hbEnt
);
logger
.
info
(
"gic登录code={},hbEnt={}"
,
code
,
hbEnt
);
PowerClerkDTO
clerkDTO
=
this
.
userService
.
haobanLoginBack
(
code
);
if
(
clerkDTO
==
null
)
{
logger
.
info
(
"登录失败,code失效:{}"
,
code
);
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-web/#/gic-error"
,
false
));
return
model
;
}
//获取code信息
//
获取code信息
String
gicEnterpriseId
=
clerkDTO
.
getEnterpriseId
();
String
loginPhoneNumber
=
clerkDTO
.
getPhoneNumber
();
boolean
b
=
wxEnterpriseRelatedApiService
.
enterpriseUseNew
(
gicEnterpriseId
);
...
...
@@ -482,7 +399,8 @@ public class LoginController extends WebBaseController {
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
random
=
aes
.
encryptHex
(
ret
);
logger
.
info
(
"使用新好办3:{}"
,
random
);
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/loginMore?random="
+
random
,
false
,
false
));
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/loginMore?random="
+
random
,
false
,
false
));
return
model
;
}
logger
.
info
(
"登录失败,code失效:{}"
,
code
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/MaterialController.java
View file @
fd55454e
...
...
@@ -125,9 +125,8 @@ public class MaterialController extends WebBaseController {
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
materialDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
WebStaffDTO
staff
=
login
.
getStaffDTO
();
materialDTO
.
setStaffId
(
staff
.
getStaffId
());
materialDTO
.
setStaffName
(
staff
.
getStaffName
());
materialDTO
.
setStaffId
(
login
.
getStaffId
());
materialDTO
.
setStaffName
(
login
.
getStaffName
());
String
materialTitle
=
materialDTO
.
getMaterialTitle
();
String
categoryId
=
materialDTO
.
getCategoryId
();
Integer
categoryType
=
materialDTO
.
getMaterialType
();
...
...
@@ -155,9 +154,8 @@ public class MaterialController extends WebBaseController {
BatchAddMaterialDTO
.
Material
material
=
dto
.
getMaterial
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
material
.
setWxEnterpriseId
(
login
.
getWxEnterpriseId
());
WebStaffDTO
staff
=
login
.
getStaffDTO
();
material
.
setStaffId
(
staff
.
getStaffId
());
material
.
setStaffName
(
staff
.
getStaffName
());
material
.
setStaffId
(
login
.
getStaffId
());
material
.
setStaffName
(
login
.
getStaffName
());
if
(
StringUtils
.
isAnyBlank
(
material
.
getCategoryId
(),
material
.
getMaterialTitle
())
||
Objects
.
isNull
(
material
.
getMaterialType
()))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
...
...
@@ -185,10 +183,8 @@ public class MaterialController extends WebBaseController {
@RequestMapping
(
"/material-edit"
)
public
HaobanResponse
materialEdit
(
MaterialDTO
materialDTO
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebStaffDTO
staff
=
login
.
getStaffDTO
();
materialDTO
.
setStaffId
(
staff
.
getStaffId
());
materialDTO
.
setStaffName
(
staff
.
getStaffName
());
materialDTO
.
setStaffId
(
login
.
getStaffId
());
materialDTO
.
setStaffName
(
login
.
getStaffName
());
String
materialId
=
materialDTO
.
getMaterialId
();
MaterialDTO
dto
=
materialApiService
.
selectMaterialById
(
materialId
);
if
(
dto
==
null
)
{
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/RightController.java
View file @
fd55454e
...
...
@@ -40,7 +40,7 @@ public class RightController extends WebBaseController {
@RequestMapping
(
"get-haoban-menu"
)
public
HaobanResponse
getHaobanMenu
(
HttpServletRequest
request
,
String
enterpriseId
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
phoneNumber
=
login
.
get
StaffDTO
().
get
PhoneNumber
();
String
phoneNumber
=
login
.
getPhoneNumber
();
Enumeration
<
String
>
e
=
request
.
getHeaderNames
()
;
while
(
e
.
hasMoreElements
())
{
String
name
=
e
.
nextElement
()
;
...
...
@@ -67,7 +67,7 @@ public class RightController extends WebBaseController {
@RequestMapping
(
"get-haoban-right"
)
public
HaobanResponse
listHaobanAllMenu
(
HttpServletRequest
request
,
String
enterpriseId
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
phoneNumber
=
login
.
get
StaffDTO
().
get
PhoneNumber
();
String
phoneNumber
=
login
.
getPhoneNumber
();
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
enterpriseId
=
request
.
getHeader
(
"enterpriseid"
)
;
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
fd55454e
...
...
@@ -324,16 +324,11 @@ public class StaffController extends WebBaseController {
@RequestMapping
(
"del-clerk-relation"
)
public
HaobanResponse
delStaffClerkList
(
String
staffId
,
String
clerkId
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebStaffDTO
staffDTO
=
login
.
getStaffDTO
();
if
(
staffDTO
==
null
)
{
logger
.
info
(
"登录异常"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10007
);
}
boolean
b
=
staffClerkRelationApiService
.
unbindByStaffAndClerkId
(
staffDTO
.
getStaffId
(),
clerkId
);
boolean
b
=
staffClerkRelationApiService
.
unbindByStaffAndClerkId
(
login
.
getStaffId
(),
clerkId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
b
);
}
...
...
@@ -400,10 +395,6 @@ public class StaffController extends WebBaseController {
@RequestMapping
(
"add-clerk-relation"
)
public
HaobanResponse
staffClerkSearch
(
String
staffId
,
String
clerkId
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebStaffDTO
loginStaffDTO
=
login
.
getStaffDTO
();
if
(
null
==
loginStaffDTO
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
if
(
StringUtils
.
isAnyBlank
(
staffId
,
clerkId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
...
...
@@ -425,7 +416,7 @@ public class StaffController extends WebBaseController {
relationDTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
ServiceResponse
response
=
staffClerkRelationApiService
.
bindStaffClerk
(
relationDTO
,
login
StaffDTO
.
getStaffId
(),
ChannelCodeEnum
.
ADMIN_BIND
.
getCode
());
ServiceResponse
response
=
staffClerkRelationApiService
.
bindStaffClerk
(
relationDTO
,
login
.
getStaffId
(),
ChannelCodeEnum
.
ADMIN_BIND
.
getCode
());
logger
.
info
(
"返回信息:{}"
,
JSONObject
.
toJSONString
(
response
));
if
(
response
.
getCode
()
==
1
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
@@ -444,11 +435,7 @@ public class StaffController extends WebBaseController {
@RequestMapping
(
"staff-clerk-bind-log"
)
public
HaobanResponse
bindLogs
(
String
search
,
String
enterpriseId
,
@RequestParam
(
defaultValue
=
"-1"
)
Integer
optType
,
BasePageInfo
qo
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebStaffDTO
loginStaffDTO
=
login
.
getStaffDTO
();
if
(
null
==
loginStaffDTO
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
Page
<
StaffClerkBindLogDetailDTO
>
page
=
staffClerkRelationApiService
.
pageStaffClerkBindLog
(
loginStaffDTO
.
getWxEnterpriseId
(),
search
,
enterpriseId
,
optType
,
qo
);
Page
<
StaffClerkBindLogDetailDTO
>
page
=
staffClerkRelationApiService
.
pageStaffClerkBindLog
(
login
.
getWxEnterpriseId
(),
search
,
enterpriseId
,
optType
,
qo
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
page
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/SyncDealContoller.java
View file @
fd55454e
...
...
@@ -49,7 +49,7 @@ public class SyncDealContoller extends WebBaseController {
if
(
RedisUtil
.
getCache
(
key
)
!=
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
}
task
=
dealSyncOperationApiService
.
createTask
(
wxEnterpriseId
,
"门店同步"
,
login
.
getStaff
DTO
().
getStaffId
(),
"部门同步"
);
task
=
dealSyncOperationApiService
.
createTask
(
wxEnterpriseId
,
"门店同步"
,
login
.
getStaff
Id
(),
"部门同步"
);
dealSyncOperationApiService
.
dealDepartment
(
task
,
login
.
getWxEnterpriseId
(),
qo
.
getAddDepartment
(),
qo
.
getEditDepartment
());
}
...
...
@@ -72,11 +72,7 @@ public class SyncDealContoller extends WebBaseController {
if
(
null
!=
taskLock
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
}
WebStaffDTO
staffDTO
=
login
.
getStaffDTO
();
String
staffId
=
"admin"
;
if
(
null
!=
staffDTO
)
{
staffId
=
staffDTO
.
getStaffId
();
}
String
format
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
task
=
dealSyncOperationApiService
.
createTask
(
wxEnterpriseId
,
"门店同步-"
+
format
,
staffId
,
"部门同步"
);
if
(
task
==
null
)
{
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WebBaseController.java
View file @
fd55454e
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.LoginDTO
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
/**
...
...
@@ -40,13 +37,12 @@ public class WebBaseController {
return
response
;
}
/**
* 获取登陆信息
*
* @return
*/
protected
LoginDTO
getLoginUser
()
{
return
EntityUtil
.
changeEntityByJSON
(
LoginDTO
.
class
,
AuthWebRequestUtil
.
getLoginUser
());
public
HaobanResponse
success
(
Object
obj
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
obj
,
null
);
}
public
HaobanResponse
fail
(
String
message
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_OTHER
,
null
,
message
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WelcomeController.java
View file @
fd55454e
...
...
@@ -67,15 +67,15 @@ public class WelcomeController extends WebBaseController {
qdto
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
qdto
.
setTitle
(
qo
.
getTitle
());
qdto
.
setWelcomeContent
(
qo
.
getWelcomeContent
());
qdto
.
setOperatorId
(
login
.
getStaff
DTO
().
getStaff
Id
());
qdto
.
setOperatorName
(
login
.
getStaff
DTO
().
getStaff
Name
());
qdto
.
setOperatorId
(
login
.
getStaffId
());
qdto
.
setOperatorName
(
login
.
getStaffName
());
qdto
.
setDefaultWelcomeFlag
(
qo
.
getDefaultWelcomeFlag
());
qdto
.
setWelcomeMediaList
(
EntityUtil
.
changeEntityListNew
(
SaveWelcomeMediaQDTO
.
class
,
qo
.
getWelcomeMediaList
()));
qdto
.
setSuitDepartmentAddList
(
qo
.
getSuitDepartmentAddList
());
qdto
.
setSuitDepartmentDeleteList
(
qo
.
getSuitDepartmentDeleteList
());
// 员工暂时不传
qdto
.
setCreatorId
(
login
.
getStaff
DTO
().
getStaff
Id
());
qdto
.
setCreatorName
(
login
.
getStaff
DTO
().
getStaff
Name
());
qdto
.
setCreatorId
(
login
.
getStaffId
());
qdto
.
setCreatorName
(
login
.
getStaffName
());
ServiceResponse
<
Boolean
>
response
=
welcomeApiService
.
saveWelcome
(
qdto
);
return
RestResponse
.
successResult
(
response
.
getResult
());
}
...
...
@@ -142,8 +142,8 @@ public class WelcomeController extends WebBaseController {
public
RestResponse
<
Boolean
>
saveFriendSetting
(
@RequestBody
@Valid
SaveFriendSettingQO
qo
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
SaveFriendSettingQDTO
qdto
=
EntityUtil
.
changeEntityNew
(
SaveFriendSettingQDTO
.
class
,
qo
);
qdto
.
setUpdateId
(
login
.
getStaff
DTO
().
getStaff
Id
());
qdto
.
setUpdateName
(
login
.
getStaff
DTO
().
getStaff
Name
());
qdto
.
setUpdateId
(
login
.
getStaffId
());
qdto
.
setUpdateName
(
login
.
getStaffName
());
ServiceResponse
<
Boolean
>
response
=
welcomeApiService
.
saveFriendSetting
(
qdto
);
return
RestResponse
.
successResult
(
response
.
getResult
());
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
fd55454e
...
...
@@ -201,9 +201,8 @@ public class WxEnterpriseController extends WebBaseController {
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WebStaffDTO
staff
=
login
.
getStaffDTO
();
String
staffId
=
staff
.
getStaffId
();
String
staffName
=
staff
.
getStaffName
();
String
staffId
=
login
.
getStaffId
();
String
staffName
=
login
.
getStaffName
();
WxEnterpriseRelationDetailDTO
detailDTO
=
new
WxEnterpriseRelationDetailDTO
();
detailDTO
.
setWxEnterpriseRelatedId
(
bindQo
.
getWxEnterpriseRelatedId
());
...
...
@@ -316,7 +315,7 @@ public class WxEnterpriseController extends WebBaseController {
}
contactSecret
=
contactSecret
.
trim
();
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
getWxUserId
(
wxEnterpriseId
,
login
.
getStaffDTO
()
));
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
getWxUserId
(
wxEnterpriseId
,
login
));
logger
.
info
(
"【保存联系人key】user={}"
,
JSON
.
toJSONString
(
user
));
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
...
...
@@ -356,7 +355,7 @@ public class WxEnterpriseController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
wxSecretKey
=
wxSecretKey
.
trim
();
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
wxEnterprise
.
getCorpid
(),
wxSecretKey
,
getWxUserId
(
wxEnterpriseId
,
login
.
getStaffDTO
()
));
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
wxEnterprise
.
getCorpid
(),
wxSecretKey
,
getWxUserId
(
wxEnterpriseId
,
login
));
logger
.
info
(
"【保存联系人key】res={}"
,
res
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
...
...
@@ -403,7 +402,7 @@ public class WxEnterpriseController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_100017
);
}
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
memberSecret
,
getWxUserId
(
wxEnterpriseId
,
login
.
getStaffDTO
()
));
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
memberSecret
,
getWxUserId
(
wxEnterpriseId
,
login
));
secretSetting
.
setSecretType
(
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
());
secretSetting
.
setSecretName
(
secretName
);
secretSetting
.
setEnterpriseId
(
enterpriseId
);
...
...
@@ -421,7 +420,7 @@ public class WxEnterpriseController extends WebBaseController {
}
}
private
String
getWxUserId
(
String
wxEnterpriseId
,
Web
Staff
DTO
loginStaffDTO
)
{
private
String
getWxUserId
(
String
wxEnterpriseId
,
Web
Login
DTO
loginStaffDTO
)
{
if
(
loginStaffDTO
!=
null
&&
(!
StringUtils
.
isEmpty
(
loginStaffDTO
.
getWxUserId
())))
{
return
loginStaffDTO
.
getWxUserId
();
}
...
...
@@ -453,7 +452,7 @@ public class WxEnterpriseController extends WebBaseController {
}
contactSecret
=
contactSecret
.
trim
();
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
getWxUserId
(
wxEnterpriseId
,
login
.
getStaffDTO
()
));
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
getWxUserId
(
wxEnterpriseId
,
login
));
logger
.
info
(
"【保存联系人key】user={}"
,
JSON
.
toJSONString
(
user
));
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
...
...
@@ -516,31 +515,6 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 判断企业是否过期
*
* @param enterpriseId
* @return
*/
@RequestMapping
(
"enterprise-is-over"
)
public
HaobanResponse
enterpriseIsOver
(
String
enterpriseId
)
{
if
(
StringUtils
.
isEmpty
(
enterpriseId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
boolean
flag
=
wxEnterpriseApiService
.
enterpriseIsOver
(
enterpriseId
);
//切换企业 更新token中的企业id
if
(!
flag
)
{
String
token
=
AuthWebRequestUtil
.
getToken
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
!=
null
)
{
loginUser
.
setEnterpriseId
(
enterpriseId
);
AuthWebRequestUtil
.
setSessionUser
(
loginUser
);
AuthWebRequestUtil
.
setAppLoginUser
(
token
,
loginUser
);
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
flag
);
}
/**
* 刷新企业微信好友
*
* @return
...
...
@@ -560,7 +534,7 @@ public class WxEnterpriseController extends WebBaseController {
if
(
monthCount
>=
3
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_100020
);
}
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTask
(
wxEnterpriseId
,
"刷新企微好友"
,
login
.
getStaff
DTO
().
getStaff
Id
(),
"刷新企微好友"
);
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTask
(
wxEnterpriseId
,
"刷新企微好友"
,
login
.
getStaffId
(),
"刷新企微好友"
);
if
(
StringUtils
.
isEmpty
(
taskId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_100021
);
}
...
...
@@ -627,7 +601,7 @@ public class WxEnterpriseController extends WebBaseController {
public
HaobanResponse
flushBindStoreList
(
String
enterpriseId
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
ServiceResponse
response
=
wxEnterpriseRelatedApiService
.
flushBindStoreByEnterpriseId
(
enterpriseId
,
wxEnterpriseId
,
login
.
getStaff
DTO
().
getStaff
Id
(),
ChannelCodeEnum
.
SYNC_UNBIND
.
getCode
());
ServiceResponse
response
=
wxEnterpriseRelatedApiService
.
flushBindStoreByEnterpriseId
(
enterpriseId
,
wxEnterpriseId
,
login
.
getStaffId
(),
ChannelCodeEnum
.
SYNC_UNBIND
.
getCode
());
logger
.
info
(
"返回信息:{}"
,
JSONObject
.
toJSONString
(
response
));
if
(
response
.
getCode
()
!=
1
)
{
HaoBanErrCode
.
ERR_DEFINE
.
setMsg
(
response
.
getMessage
());
...
...
@@ -709,7 +683,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"/agent-wx-enterprise-list"
)
public
HaobanResponse
materialShare
(
String
materialId
)
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
List
<
EnterpriseDetailDTO
>
detailDTOS
=
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
List
<
String
>
enterpriseIds
=
detailDTOS
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseType
()
==
0
).
map
(
dto
->
dto
.
getEnterpriseId
()).
collect
(
Collectors
.
toList
());
...
...
@@ -748,7 +722,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"save-welcome"
)
public
HaobanResponse
savewelcome
(
String
title
,
String
welcomeContent
,
String
welcomeImg
)
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
if
(
StringUtils
.
isAnyBlank
(
title
,
welcomeContent
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
...
...
@@ -771,7 +745,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"get-welcome"
)
public
HaobanResponse
getWelcome
()
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
WelcomeDTO
welcome
=
wxEnterpriseApiService
.
getWelcome
(
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
welcome
);
...
...
@@ -784,7 +758,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"del-welcome"
)
public
HaobanResponse
delWelcome
()
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
wxEnterpriseApiService
.
delWelcome
(
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
@@ -797,7 +771,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"set-welcome"
)
public
HaobanResponse
setWelcome
(
int
openFlag
)
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
wxEnterpriseApiService
.
setWelcome
(
wxEnterpriseId
,
openFlag
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
@@ -831,7 +805,7 @@ public class WxEnterpriseController extends WebBaseController {
*/
@RequestMapping
(
"agree_external_userid_flag"
)
public
HaobanResponse
agreeExternalUseridFlag
(
Integer
openFlag
)
{
LoginDTO
loginUser
=
this
.
getLoginUser
();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
loginUser
.
getWxEnterpriseId
();
wxEnterpriseApiService
.
agreeExternalUseridFlag
(
wxEnterpriseId
,
openFlag
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/StaffVO.java
View file @
fd55454e
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
;
import
java.io.Serializable
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
java.util.Date
;
public
class
StaffVO
implements
Serializable
{
...
...
@@ -23,6 +22,254 @@ public class StaffVO implements Serializable{
private
String
headImg
;
/**
* 员工id
*/
private
String
staffId
;
/**
* 企业微信id
*/
private
String
wxEnterpriseId
;
/**
* 微信用户id
*/
private
String
wxUserId
;
/**
* 昵称
*/
private
String
nickName
;
/**
* 性别
*/
private
Integer
sex
;
/**
* 职位
*/
private
String
postion
;
/**
* 激活状态
*/
private
Integer
activeFlag
;
/**
* 对外职务
*/
private
String
extendPostion
;
private
Date
updateTime
;
private
int
bindFlag
;
private
String
clerkCode
;
private
String
staffDepartmentRelatedId
;
private
int
clerkType
;
private
Integer
syncPostionFlag
;
private
Integer
superManagerFlag
;
private
Boolean
weixinPush
;
private
Integer
memberCount
;
private
String
clerkId
;
/**
* 关联状态 1 已关联 0 未关联
* 关联状态为 员工是否关联某门店导购
*/
private
Integer
relationFlag
;
private
String
wxOpenUseId
;
private
String
wxOpenId
;
private
String
qrCode
;
private
String
clerkName
;
public
String
getStaffId
()
{
return
staffId
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
String
getWxUserId
()
{
return
wxUserId
;
}
public
String
getNickName
()
{
return
nickName
;
}
public
Integer
getSex
()
{
return
sex
;
}
public
String
getPostion
()
{
return
postion
;
}
public
Integer
getActiveFlag
()
{
return
activeFlag
;
}
public
String
getExtendPostion
()
{
return
extendPostion
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
int
getBindFlag
()
{
return
bindFlag
;
}
public
String
getClerkCode
()
{
return
clerkCode
;
}
public
String
getStaffDepartmentRelatedId
()
{
return
staffDepartmentRelatedId
;
}
public
int
getClerkType
()
{
return
clerkType
;
}
public
Integer
getSyncPostionFlag
()
{
return
syncPostionFlag
;
}
public
Integer
getSuperManagerFlag
()
{
return
superManagerFlag
;
}
public
Boolean
getWeixinPush
()
{
return
weixinPush
;
}
public
Integer
getMemberCount
()
{
return
memberCount
;
}
public
String
getClerkId
()
{
return
clerkId
;
}
public
Integer
getRelationFlag
()
{
return
relationFlag
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
String
getWxOpenId
()
{
return
wxOpenId
;
}
public
String
getQrCode
()
{
return
qrCode
;
}
public
String
getClerkName
()
{
return
clerkName
;
}
public
void
setStaffId
(
String
staffId
)
{
this
.
staffId
=
staffId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
;
}
public
void
setNickName
(
String
nickName
)
{
this
.
nickName
=
nickName
;
}
public
void
setSex
(
Integer
sex
)
{
this
.
sex
=
sex
;
}
public
void
setPostion
(
String
postion
)
{
this
.
postion
=
postion
;
}
public
void
setActiveFlag
(
Integer
activeFlag
)
{
this
.
activeFlag
=
activeFlag
;
}
public
void
setExtendPostion
(
String
extendPostion
)
{
this
.
extendPostion
=
extendPostion
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
void
setBindFlag
(
int
bindFlag
)
{
this
.
bindFlag
=
bindFlag
;
}
public
void
setClerkCode
(
String
clerkCode
)
{
this
.
clerkCode
=
clerkCode
;
}
public
void
setStaffDepartmentRelatedId
(
String
staffDepartmentRelatedId
)
{
this
.
staffDepartmentRelatedId
=
staffDepartmentRelatedId
;
}
public
void
setClerkType
(
int
clerkType
)
{
this
.
clerkType
=
clerkType
;
}
public
void
setSyncPostionFlag
(
Integer
syncPostionFlag
)
{
this
.
syncPostionFlag
=
syncPostionFlag
;
}
public
void
setSuperManagerFlag
(
Integer
superManagerFlag
)
{
this
.
superManagerFlag
=
superManagerFlag
;
}
public
void
setWeixinPush
(
Boolean
weixinPush
)
{
this
.
weixinPush
=
weixinPush
;
}
public
void
setMemberCount
(
Integer
memberCount
)
{
this
.
memberCount
=
memberCount
;
}
public
void
setClerkId
(
String
clerkId
)
{
this
.
clerkId
=
clerkId
;
}
public
void
setRelationFlag
(
Integer
relationFlag
)
{
this
.
relationFlag
=
relationFlag
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
public
void
setWxOpenId
(
String
wxOpenId
)
{
this
.
wxOpenId
=
wxOpenId
;
}
public
void
setQrCode
(
String
qrCode
)
{
this
.
qrCode
=
qrCode
;
}
public
void
setClerkName
(
String
clerkName
)
{
this
.
clerkName
=
clerkName
;
}
public
String
getHeadImg
()
{
return
headImg
;
}
...
...
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