Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
easy-affair-show
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
easy-affair-show
Commits
24ab5575
Commit
24ab5575
authored
Aug 15, 2022
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
未登录用户可以提建议
parent
53b14dc0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
16 deletions
+98
-16
eas-manager/doc/api.md
eas-manager/doc/api.md
+2
-0
eas-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
...s/xhx/base/framework/interceptor/AuthUserInterceptor.java
+15
-0
eas-manager/src/main/java/com/mortals/xhx/module/proposal/service/impl/ProposalServiceImpl.java
...xhx/module/proposal/service/impl/ProposalServiceImpl.java
+11
-9
eas-manager/src/main/java/com/mortals/xhx/module/proposal/web/ProposalController.java
...m/mortals/xhx/module/proposal/web/ProposalController.java
+70
-7
No files found.
eas-manager/doc/api.md
View file @
24ab5575
...
...
@@ -5376,6 +5376,8 @@ msg|String|消息|-
:---|:---|:---|:-------
content|String|是|建议内容
screenshot|String|是|截图地址
custName|String|否|客户名称(登录用户不用填写)
contactTelphone|String|否|联系电话(登录用户不用填写)
**请求样例:**
```
...
...
eas-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
View file @
24ab5575
package
com.mortals.xhx.base.framework.interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.AESUtil
;
...
...
@@ -11,9 +12,12 @@ import com.mortals.xhx.common.key.Constant;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.resource.ResourceHttpRequestHandler
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
/**
* 用户权限验证,基于token
...
...
@@ -36,6 +40,17 @@ public class AuthUserInterceptor extends BaseInterceptor {
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
if
(
handler
instanceof
HandlerMethod
)
{
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
UnAuth
annotation
=
method
.
getAnnotation
(
UnAuth
.
class
);
if
(
annotation
!=
null
)
{
//取消校验
return
true
;
}
}
else
if
(
handler
instanceof
ResourceHttpRequestHandler
)
{
return
true
;
}
JSONObject
ret
=
new
JSONObject
();
try
{
String
uri
=
request
.
getServletPath
();
...
...
eas-manager/src/main/java/com/mortals/xhx/module/proposal/service/impl/ProposalServiceImpl.java
View file @
24ab5575
...
...
@@ -55,6 +55,7 @@ public class ProposalServiceImpl extends AbstractCRUDServiceImpl<ProposalDao, Pr
@Override
protected
void
updateAfter
(
ProposalEntity
entity
,
Context
context
)
throws
AppException
{
if
(
StringUtils
.
isNotEmpty
(
entity
.
getReplyContent
())
&&
entity
.
getSendMode
()!=
SendModeEnum
.
ON_SMS
.
getValue
()){
if
(
entity
.
getCustomerId
()!=
null
)
{
ProposalEntity
proposalEntity
=
this
.
get
(
entity
.
getId
());
NewsEntity
newsEntity
=
new
NewsEntity
();
newsEntity
.
setMessageId
(
proposalEntity
.
getId
());
...
...
@@ -63,7 +64,8 @@ public class ProposalServiceImpl extends AbstractCRUDServiceImpl<ProposalDao, Pr
newsEntity
.
setMessageType
(
0
);
newsEntity
.
setReadStatus
(
ReadStatusEnum
.
UN_READ
.
getValue
());
newsEntity
.
setReceiveTime
(
new
Date
());
newsService
.
save
(
newsEntity
,
context
);
newsService
.
save
(
newsEntity
,
context
);
}
}
}
}
\ No newline at end of file
eas-manager/src/main/java/com/mortals/xhx/module/proposal/web/ProposalController.java
View file @
24ab5575
...
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.module.proposal.web;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.RepeatSubmit
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -53,17 +54,15 @@ public class ProposalController extends BaseCRUDJsonBodyMappingController<Propos
@Override
protected
void
saveBefore
(
ProposalEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(
this
.
getCurUser
()==
null
||
this
.
getCurUser
().
getUserType
()!=
Constant
.
CUSTOMER_USER
){
throw
new
AppException
(
"非法用户,不可访问"
);
}
if
(
this
.
getCurUser
()!=
null
&&
this
.
getCurUser
().
getUserType
()==
Constant
.
CUSTOMER_USER
){
CustomerEntity
customerEntity
=
customerService
.
get
(
this
.
getCurUser
().
getId
());
entity
.
setCustomerId
(
this
.
getCurUser
().
getId
());
entity
.
setCustName
(
customerEntity
.
getCustName
());
entity
.
setContactTelphone
(
customerEntity
.
getContactTelphone
());
}
if
(
entity
.
newEntity
()){
entity
.
setReplyStatus
(
ReplyStatusEnum
.
UN_REPLY
.
getValue
());
}
}
@Override
...
...
@@ -121,4 +120,68 @@ public class ProposalController extends BaseCRUDJsonBodyMappingController<Propos
return
ret
.
toJSONString
();
}
@PostMapping
({
"save"
})
@UnAuth
public
String
save
(
@RequestBody
ProposalEntity
entity
)
{
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"保存"
+
this
.
getModuleDesc
();
int
code
=
1
;
try
{
this
.
saveBefore
(
entity
,
model
,
context
);
IUser
user
;
if
(
entity
.
newEntity
())
{
busiDesc
=
"新增"
+
this
.
getModuleDesc
();
entity
.
setCreateTime
(
new
Date
());
entity
.
setUpdateTime
(
entity
.
getCreateTime
());
user
=
this
.
getCurUser
();
if
(
user
!=
null
)
{
entity
.
setCreateUserId
(
user
.
getId
());
entity
.
setCreateUser
(
user
.
getLoginName
());
entity
.
setCreateUserName
(
user
.
getRealName
());
entity
.
setCreateUserDeptId
(
user
.
getDeptId
());
entity
.
setCreateUserDeptName
(
user
.
getDeptName
());
entity
.
setUpdateUserId
(
user
.
getId
());
entity
.
setUpdateUser
(
user
.
getLoginName
());
entity
.
setUpdateUserName
(
user
.
getRealName
());
entity
.
setUpdateUserDeptId
(
user
.
getDeptId
());
entity
.
setUpdateUserDeptName
(
user
.
getDeptName
());
}
this
.
service
.
save
(
entity
,
context
);
}
else
{
busiDesc
=
"修改"
+
this
.
getModuleDesc
();
entity
.
setUpdateTime
(
new
Date
());
user
=
this
.
getCurUser
();
if
(
user
!=
null
)
{
entity
.
setUpdateUserId
(
user
.
getId
());
entity
.
setUpdateUser
(
user
.
getLoginName
());
entity
.
setUpdateUserName
(
user
.
getRealName
());
entity
.
setUpdateUserDeptId
(
user
.
getDeptId
());
entity
.
setUpdateUserDeptName
(
user
.
getDeptName
());
}
this
.
service
.
update
(
entity
,
context
);
}
model
.
put
(
"id"
,
entity
.
getId
());
code
=
this
.
saveAfter
(
entity
,
model
,
context
);
model
.
put
(
"entity"
,
entity
);
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】 [id:"
+
entity
.
getId
()
+
"]"
);
}
catch
(
Exception
var7
)
{
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var7
);
model
.
put
(
"entity"
,
entity
);
this
.
init
(
model
,
context
);
code
=
this
.
saveException
(
entity
,
model
,
context
,
var7
);
}
this
.
init
(
model
,
context
);
JSONObject
ret
=
new
JSONObject
();
ret
.
put
(
"code"
,
code
);
ret
.
put
(
"msg"
,
model
.
remove
(
"message_info"
));
ret
.
put
(
"data"
,
model
);
return
ret
.
toJSONString
();
}
}
\ No newline at end of file
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