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
a96f6e31
Commit
a96f6e31
authored
Dec 15, 2021
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增好办小程序拦截器
parent
96f75e6e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
139 deletions
+53
-139
StaffPrivacyUseLogMapper.xml
...ce/src/main/resources/mapper/StaffPrivacyUseLogMapper.xml
+9
-9
HttpLimit.java
...c/main/java/com/gic/haoban/manage/web/anno/HttpLimit.java
+0
-21
IgnoreLogin.java
...main/java/com/gic/haoban/manage/web/anno/IgnoreLogin.java
+0
-12
AuditController.java
...com/gic/haoban/manage/web/controller/AuditController.java
+1
-1
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+16
-28
StoreController.java
...com/gic/haoban/manage/web/controller/StoreController.java
+3
-3
WxEnterpriseInfoController.java
...ban/manage/web/controller/WxEnterpriseInfoController.java
+4
-1
MyApplicationContextAware.java
...gic/haoban/manage/web/init/MyApplicationContextAware.java
+14
-15
HttpLimitInterceptor.java
...c/haoban/manage/web/interceptor/HttpLimitInterceptor.java
+1
-1
MobileWebInterceptor.java
...c/haoban/manage/web/interceptor/MobileWebInterceptor.java
+3
-6
ResponseInterceptor.java
...ic/haoban/manage/web/interceptor/ResponseInterceptor.java
+0
-41
spring-interceptor.xml
...manage3-wx/src/main/webapp/WEB-INF/spring-interceptor.xml
+2
-1
No files found.
haoban-manage3-service/src/main/resources/mapper/StaffPrivacyUseLogMapper.xml
View file @
a96f6e31
...
...
@@ -45,7 +45,7 @@
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
wx_enterprise_id,
</if>
<if
test=
"null != privacyUseFlag
and '' != privacyUseFlag
"
>
<if
test=
"null != privacyUseFlag"
>
privacy_use_flag,
</if>
<if
test=
"null != phoneNumber and '' != phoneNumber"
>
...
...
@@ -69,10 +69,10 @@
<if
test=
"null != staffIp and '' != staffIp"
>
staff_ip,
</if>
<if
test=
"null != createTime
and '' != createTime
"
>
<if
test=
"null != createTime"
>
create_time,
</if>
<if
test=
"null != updateTime
and '' != updateTime
"
>
<if
test=
"null != updateTime"
>
update_time
</if>
</trim>
...
...
@@ -83,7 +83,7 @@
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
#{wxEnterpriseId},
</if>
<if
test=
"null != privacyUseFlag
and '' != privacyUseFlag
"
>
<if
test=
"null != privacyUseFlag"
>
#{privacyUseFlag},
</if>
<if
test=
"null != phoneNumber and '' != phoneNumber"
>
...
...
@@ -107,10 +107,10 @@
<if
test=
"null != staffIp and '' != staffIp"
>
#{staffIp},
</if>
<if
test=
"null != createTime
and '' != createTime
"
>
<if
test=
"null != createTime"
>
#{createTime},
</if>
<if
test=
"null != updateTime
and '' != updateTime
"
>
<if
test=
"null != updateTime"
>
#{updateTime}
</if>
</trim>
...
...
@@ -121,7 +121,7 @@
<set>
<if
test=
"null != staffId and '' != staffId"
>
staff_id = #{staffId},
</if>
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if
test=
"null != privacyUseFlag
and '' != privacyUseFlag
"
>
privacy_use_flag = #{privacyUseFlag},
</if>
<if
test=
"null != privacyUseFlag"
>
privacy_use_flag = #{privacyUseFlag},
</if>
<if
test=
"null != phoneNumber and '' != phoneNumber"
>
phone_number = #{phoneNumber},
</if>
<if
test=
"null != welldoneVersion and '' != welldoneVersion"
>
welldone_version = #{welldoneVersion},
</if>
<if
test=
"null != weworkVersion and '' != weworkVersion"
>
wework_version = #{weworkVersion},
</if>
...
...
@@ -131,8 +131,8 @@
#{staffPhoneVersion},
</if>
<if
test=
"null != staffIp and '' != staffIp"
>
staff_ip = #{staffIp},
</if>
<if
test=
"null != createTime
and '' != createTime
"
>
create_time = #{createTime},
</if>
<if
test=
"null != updateTime
and '' != updateTime
"
>
update_time = #{updateTime}
</if>
<if
test=
"null != createTime"
>
create_time = #{createTime},
</if>
<if
test=
"null != updateTime"
>
update_time = #{updateTime}
</if>
</set>
WHERE id = #{id}
</update>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/anno/HttpLimit.java
deleted
100644 → 0
View file @
96f75e6e
package
com
.
gic
.
haoban
.
manage
.
web
.
anno
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.util.concurrent.TimeUnit
;
/**
* 访问限制
* 默认1秒
* @author hzw
*
*/
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
HttpLimit
{
long
time
()
default
1L
;
TimeUnit
unit
()
default
TimeUnit
.
SECONDS
;
int
times
()
default
2
;
}
\ No newline at end of file
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/anno/IgnoreLogin.java
deleted
100644 → 0
View file @
96f75e6e
package
com
.
gic
.
haoban
.
manage
.
web
.
anno
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
IgnoreLogin
{
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/AuditController.java
View file @
a96f6e31
...
...
@@ -9,6 +9,7 @@ import com.gic.clerk.api.service.ClerkService;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.PageResult2
;
import
com.gic.haoban.common.anno.HttpLimit
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi
;
...
...
@@ -22,7 +23,6 @@ import com.gic.haoban.manage.api.service.AuditApiService;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.web.anno.HttpLimit
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.AuditVO
;
import
com.gic.haoban.manage.web.vo.StaffClerkBindLogDetailVO
;
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
a96f6e31
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
...
...
@@ -18,6 +17,7 @@ import com.gic.enterprise.api.service.StoreService;
import
com.gic.haoban.app.customer.service.api.service.DistributeApiService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.PageResult2
;
import
com.gic.haoban.common.anno.HttpLimit
;
import
com.gic.haoban.common.utils.GooglePhoneNumberUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
...
...
@@ -25,16 +25,13 @@ import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.*
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.anno.HttpLimit
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.*
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -43,8 +40,8 @@ import java.util.*;
import
java.util.stream.Collectors
;
@RestController
public
class
ClerkController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ClerkController
.
class
);
public
class
ClerkController
extends
WebBaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ClerkController
.
class
);
@Autowired
private
ClerkService
clerkService
;
...
...
@@ -55,18 +52,12 @@ public class ClerkController extends WebBaseController{
@Autowired
private
StoreService
storeService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
BindApiService
bindApiService
;
@Autowired
private
SyncHaobanToGicServiceApi
syncHaobanToGicServiceApi
;
@Autowired
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
@Autowired
private
DistributeApiService
distributeApiService
;
@Autowired
private
MemberUnionidRelatedApiService
memberUnionidRelatedApiService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
EnterpriseService
enterpriseService
;
...
...
@@ -622,13 +613,10 @@ public class ClerkController extends WebBaseController{
public
boolean
isEnterpriseOver
(
String
eid
)
{
EnterpriseDTO
enterprise
=
enterpriseService
.
getEnterpriseByEid
(
eid
);
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
)
{
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
)
{
return
false
;
}
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()){
return
false
;
}
return
true
;
return
enterprise
.
getExpireTime
().
getTime
()
<=
System
.
currentTimeMillis
();
}
...
...
@@ -882,15 +870,15 @@ public class ClerkController extends WebBaseController{
List
<
BindClerkVO
>
unBindList
=
new
ArrayList
<>();
for
(
ClerkListDTO
clerkListDTO
:
list
)
{
BindClerkVO
vo
=
EntityUtil
.
changeEntityByJSON
(
BindClerkVO
.
class
,
clerkListDTO
);
if
(
bindCodeMap
.
keySet
().
contains
(
clerkListDTO
.
getClerkCode
()))
{
if
(
bindCodeMap
.
containsKey
(
clerkListDTO
.
getClerkCode
()))
{
String
staffId
=
bindCodeMap
.
get
(
clerkListDTO
.
getClerkCode
()).
getStaffId
();
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
staffId
);
vo
.
setStaffId
(
staffId
);
vo
.
setNationCode
(
clerkListDTO
.
getNationcode
());
vo
.
setPhoneNumber
(
clerkListDTO
.
getPhoneNumber
());
vo
.
setStaffName
(
staffDTO
==
null
?
""
:
staffDTO
.
getStaffName
());
vo
.
setStaffName
(
staffDTO
==
null
?
""
:
staffDTO
.
getStaffName
());
bindList
.
add
(
vo
);
}
else
{
}
else
{
unBindList
.
add
(
vo
);
}
}
...
...
@@ -950,32 +938,32 @@ public class ClerkController extends WebBaseController{
@RequestMapping
(
"/fresh-clerk-info"
)
public
HaobanResponse
freshClerkInfo
(
String
clerkId
,
String
wxEnterpriseId
)
{
StaffClerkRelationDTO
staffRelation
=
staffClerkRelationApiService
.
getByClerkId
(
clerkId
);
if
(
staffRelation
==
null
)
{
if
(
staffRelation
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
staffApiService
.
wxGetAdd
(
staffRelation
.
getWxUserId
(),
wxEnterpriseId
);
;
staffApiService
.
wxGetAdd
(
staffRelation
.
getWxUserId
(),
wxEnterpriseId
);
String
staffId
=
staffRelation
.
getStaffId
();
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
String
headPic
=
staff
.
getHeadImg
();
String
phoneNumber
=
staff
.
getPhoneNumber
();
String
nationCode
=
staff
.
getNationCode
();
Integer
sex
=
staff
.
getSex
();
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkId
(
clerkId
);
if
(
clerk
==
null
)
{
if
(
clerk
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
if
(
StringUtils
.
isNotBlank
(
headPic
))
{
if
(
StringUtils
.
isNotBlank
(
headPic
))
{
clerk
.
setHeadImgUrl
(
headPic
);
clerk
.
setImageUrl
(
headPic
);
}
if
(
StringUtils
.
isNotBlank
(
phoneNumber
))
{
if
(
StringUtils
.
isNotBlank
(
phoneNumber
))
{
List
<
ClerkListDTO
>
list
=
clerkService
.
getClerkByStoreId
(
clerk
.
getEnterpriseId
(),
clerk
.
getStoreId
());
for
(
ClerkListDTO
clerkListDTO
:
list
)
{
if
(
clerkListDTO
.
getPhoneNumber
().
equals
(
phoneNumber
)
&&
!
clerkListDTO
.
getClerkId
().
equals
(
clerkId
))
{
if
(
clerkListDTO
.
getPhoneNumber
().
equals
(
phoneNumber
)
&&
!
clerkListDTO
.
getClerkId
().
equals
(
clerkId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_11122
);
}
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/StoreController.java
View file @
a96f6e31
...
...
@@ -15,13 +15,13 @@ import com.gic.enterprise.api.dto.StoreDTO;
import
com.gic.enterprise.api.dto.StorePhotoDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.common.anno.IgnoreLogin
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.data.api.dto.HaobanDataDTO
;
import
com.gic.haoban.data.api.service.HaobanDataApiService
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.StoreFieldEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.StaffStoreVO
;
import
com.gic.haoban.manage.web.vo.StoreDetailVO
;
...
...
@@ -37,8 +37,8 @@ import java.util.*;
import
java.util.stream.Collectors
;
@RestController
public
class
StoreController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
StoreController
.
class
);
public
class
StoreController
extends
WebBaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
StoreController
.
class
);
@Autowired
private
ClerkService
clerkService
;
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseInfoController.java
View file @
a96f6e31
...
...
@@ -15,13 +15,13 @@ import com.gic.enterprise.api.dto.StoreDTO;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.app.customer.dto.StaffOpenRelatedDTO
;
import
com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService
;
import
com.gic.haoban.common.anno.IgnoreLogin
;
import
com.gic.haoban.common.utils.AuthRequestWellDoneUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.GetUserByMemberCodeQo
;
...
...
@@ -188,6 +188,9 @@ public class WxEnterpriseInfoController extends WebBaseController {
StaffLoginDTO
staffLoginDTO
=
new
StaffLoginDTO
();
BeanUtils
.
copyProperties
(
staffLoginQO
,
staffLoginDTO
);
staffLoginDTO
.
setStaffIp
(
IPAddressUtil
.
getIpAddress
(
request
));
staffDTO
.
setWxEnterpriseId
(
staffDTO
.
getWxEnterpriseId
());
staffDTO
.
setPhoneNumber
(
staffDTO
.
getPhoneNumber
());
staffDTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
wxEnterpriseApiService
.
wellDoneLogin
(
staffLoginDTO
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
token
);
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/init/MyApplicationContextAware.java
View file @
a96f6e31
package
com
.
gic
.
haoban
.
manage
.
web
.
init
;
import
com.gic.dict.api.dto.GlobalDictMap
;
import
com.gic.dict.api.service.ManagerDictService
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeansException
;
...
...
@@ -8,26 +10,23 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
com.gic.dict.api.dto.GlobalDictMap
;
import
com.gic.dict.api.service.ManagerDictService
;
@Component
public
class
MyApplicationContextAware
implements
ApplicationContextAware
{
private
Logger
log
=
LogManager
.
getLogger
(
MyApplicationContextAware
.
class
);
private
final
Logger
log
=
LogManager
.
getLogger
(
MyApplicationContextAware
.
class
);
@Autowired
private
ManagerDictService
managerDictService
;
private
static
ApplicationContext
applicationContext
;
@Autowired
private
ManagerDictService
managerDictService
;
@Override
public
void
setApplicationContext
(
ApplicationContext
appContext
)
throws
BeansException
{
GlobalDictMap
.
countyMap
=
managerDictService
.
getCountysMap
();
GlobalDictMap
.
cityMap
=
managerDictService
.
getCitysMap
();
GlobalDictMap
.
provinceMap
=
managerDictService
.
getProvincesMap
();
GlobalDictMap
.
dictMap
=
managerDictService
.
getDictList
();
GlobalDictMap
.
storeCategoryDictMap
=
managerDictService
.
getStoreCategoryDictList
();
log
.
info
(
"数据字典放入缓存"
);
GlobalDictMap
.
countyMap
=
managerDictService
.
getCountysMap
();
GlobalDictMap
.
cityMap
=
managerDictService
.
getCitysMap
();
GlobalDictMap
.
provinceMap
=
managerDictService
.
getProvincesMap
();
GlobalDictMap
.
dictMap
=
managerDictService
.
getDictList
();
GlobalDictMap
.
storeCategoryDictMap
=
managerDictService
.
getStoreCategoryDictList
();
log
.
info
(
"数据字典放入缓存"
);
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/interceptor/HttpLimitInterceptor.java
View file @
a96f6e31
package
com
.
gic
.
haoban
.
manage
.
web
.
interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.common.anno.HttpLimit
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.web.anno.HttpLimit
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.utils.IPAddressUtil
;
import
com.gic.redis.data.util.RedisUtil
;
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/interceptor/WebInterceptor.java
→
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/interceptor/
Mobile
WebInterceptor.java
View file @
a96f6e31
package
com
.
gic
.
haoban
.
manage
.
web
.
interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.common.anno.IgnoreLogin
;
import
com.gic.haoban.common.utils.AuthRequestWellDoneUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.WellDoneLoginDTO
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.redis.data.util.GicRateLimiter
;
import
org.slf4j.Logger
;
...
...
@@ -17,16 +17,15 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.Map
;
/**
* Created 2018/7/20.
*
* @author hua
*/
public
class
WebInterceptor
extends
HandlerInterceptorAdapter
{
public
class
Mobile
WebInterceptor
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WebInterceptor
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Mobile
WebInterceptor
.
class
);
private
static
final
String
MOUDLE
=
"haoban-manage3-wx"
;
...
...
@@ -49,8 +48,6 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
public
boolean
preHandle
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Object
o
)
throws
Exception
{
String
requestURI
=
httpServletRequest
.
getRequestURI
();
logger
.
info
(
"post-url:{}"
,
requestURI
);
Map
<
String
,
String
[]>
parameterMap
=
httpServletRequest
.
getParameterMap
();
logger
.
info
(
"post-params:{}"
,
JSONObject
.
toJSONString
(
parameterMap
));
HandlerMethod
handler
=
(
HandlerMethod
)
o
;
IgnoreLogin
ignoreLogin
=
handler
.
getMethodAnnotation
(
IgnoreLogin
.
class
);
if
(
null
!=
ignoreLogin
)
{
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/interceptor/ResponseInterceptor.java
deleted
100644 → 0
View file @
96f75e6e
package
com
.
gic
.
haoban
.
manage
.
web
.
interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.server.ServerHttpRequest
;
import
org.springframework.http.server.ServerHttpResponse
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
import
java.lang.reflect.Method
;
/**
* Created 2019/2/20.
*
* @author hua
*/
@ControllerAdvice
public
class
ResponseInterceptor
implements
ResponseBodyAdvice
<
HaobanResponse
>
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
ResponseInterceptor
.
class
);
@Override
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
<?
extends
HttpMessageConverter
<?>>
aClass
)
{
Method
method
=
methodParameter
.
getMethod
();
String
name
=
method
.
getName
();
logger
.
info
(
"method:{}"
,
name
);
return
true
;
}
@Override
public
HaobanResponse
beforeBodyWrite
(
HaobanResponse
haobanResponse
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
<?
extends
HttpMessageConverter
<?>>
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
String
response
=
JSONObject
.
toJSONString
(
haobanResponse
);
logger
.
info
(
"response:{}"
,
response
);
return
haobanResponse
;
}
}
haoban-manage3-wx/src/main/webapp/WEB-INF/spring-interceptor.xml
View file @
a96f6e31
...
...
@@ -6,6 +6,7 @@
<bean
class=
"com.gic.haoban.common.interceptor.CORSInterceptor"
/>
<bean
class=
"com.gic.commons.interceptor.HeaderTagInterceptor"
/>
<bean
class=
"com.gic.haoban.common.ext.PropertyViewClearInterceptor"
/>
<bean
class=
"com.gic.haoban.manage.web.interceptor.HttpLimitInterceptor"
/>
<mvc:interceptor>
<mvc:mapping
path=
"/**"
/>
<mvc:exclude-mapping
path=
"/login.json"
/>
...
...
@@ -19,7 +20,7 @@
<mvc:exclude-mapping
path=
"/phone-login"
/>
<mvc:exclude-mapping
path=
"/upload-file*"
/>
<mvc:exclude-mapping
path=
"/upload-file-voice"
/>
<bean
class=
"com.gic.haoban.manage.web.interceptor.WebInterceptor"
/>
<bean
class=
"com.gic.haoban.manage.web.interceptor.
Mobile
WebInterceptor"
/>
</mvc:interceptor>
</mvc:interceptors>
...
...
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