Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
a2b41886
Commit
a2b41886
authored
Jun 06, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.账号绑定校验bug,编辑时会把自己算上导致不能编辑
parent
16c2909a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
15 deletions
+95
-15
ResubmitCheck.java
...eejoin/amos/boot/biz/common/annotation/ResubmitCheck.java
+24
-0
ResubmitCheckAspect.java
...yeejoin/amos/boot/biz/common/aop/ResubmitCheckAspect.java
+53
-0
OrgUsrMapper.java
...join/amos/boot/module/common/api/mapper/OrgUsrMapper.java
+1
-1
OrgUsrMapper.xml
...ule-common-api/src/main/resources/mapper/OrgUsrMapper.xml
+10
-6
OrgUsrController.java
...s/boot/module/common/biz/controller/OrgUsrController.java
+3
-2
OrgUsrServiceImpl.java
...oot/module/common/biz/service/impl/OrgUsrServiceImpl.java
+4
-6
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/annotation/ResubmitCheck.java
0 → 100644
View file @
a2b41886
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author DELL
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
ResubmitCheck
{
/**
* 失效时间,即可以第二次提交间隔时长,单位秒
*/
long
expireTime
()
default
3
;
/**
* 提示消息
*/
String
message
()
default
"您的操作过于频繁,请稍后重试"
;
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ResubmitCheckAspect.java
0 → 100644
View file @
a2b41886
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
aop
;
import
com.yeejoin.amos.boot.biz.common.annotation.ResubmitCheck
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.DigestUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @author DELL
*/
@Aspect
@Component
@Slf4j
public
class
ResubmitCheckAspect
{
@Resource
HttpServletRequest
request
;
@Autowired
RedisUtils
redisUtils
;
@Pointcut
(
value
=
"@annotation(com.yeejoin.amos.boot.biz.common.annotation.ResubmitCheck)"
)
public
void
submit
()
{
}
@Before
(
"submit()&&@annotation(resubmitCheck)"
)
public
void
doBefore
(
JoinPoint
joinPoint
,
ResubmitCheck
resubmitCheck
)
{
String
token
=
!
StringUtils
.
isEmpty
(
request
.
getHeader
(
"token"
))
?
request
.
getHeader
(
"token"
)
:
RequestContext
.
getToken
();
StringBuilder
md5Builder
=
new
StringBuilder
(
StringUtils
.
isEmpty
(
token
)
?
"unknown"
:
token
);
if
(
joinPoint
.
getArgs
()
!=
null
)
{
for
(
Object
obj
:
joinPoint
.
getArgs
())
{
md5Builder
.
append
(
obj
.
toString
());
}
}
String
md5String
=
DigestUtils
.
md5DigestAsHex
(
md5Builder
.
toString
().
getBytes
());
Object
cache
=
redisUtils
.
get
(
md5String
);
if
(
cache
!=
null
)
{
throw
new
RuntimeException
(
resubmitCheck
.
message
());
}
redisUtils
.
set
(
md5String
,
1
,
resubmitCheck
.
expireTime
());
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/OrgUsrMapper.java
View file @
a2b41886
...
@@ -86,7 +86,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
...
@@ -86,7 +86,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
*/
*/
List
<
OrgUsrExcelDto
>
exportPersonToExcelByParentId
(
Long
parentId
);
List
<
OrgUsrExcelDto
>
exportPersonToExcelByParentId
(
Long
parentId
);
int
amosIdExist
(
String
amos
Id
);
int
amosIdExist
(
@Param
(
"amosId"
)
String
amosId
,
@Param
(
"orgUsrId"
)
String
orgUsr
Id
);
int
amosIdExistTeam
(
String
amosId
);
int
amosIdExistTeam
(
String
amosId
);
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/OrgUsrMapper.xml
View file @
a2b41886
...
@@ -671,14 +671,18 @@ GROUP BY
...
@@ -671,14 +671,18 @@ GROUP BY
</select>
</select>
<select
id=
"amosIdExist"
resultType=
"int"
>
<select
id=
"amosIdExist"
resultType=
"int"
>
SELECT
count(*) AS num
FROM cb_org_usr
SELECT count(*) AS num FROM cb_org_usr WHERE amos_org_id = #{amosId} and is_delete = 0;
WHERE
amos_org_id = #{amosId}
<if
test=
"orgUsrId != null "
>
and sequence_nbr != #{orgUsrId}
</if>
and is_delete = 0
</select>
</select>
<select
id=
"amosIdExistTeam"
resultType=
"int"
>
<select
id=
"amosIdExistTeam"
resultType=
"int"
>
SELECT count(*) AS num FROM cb_firefighters WHERE amos_user_id = #{amosId} and is_delete = 0;
SELECT count(*) AS num FROM cb_firefighters WHERE amos_user_id = #{amosId} and is_delete = 0;
</select>
</select>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/OrgUsrController.java
View file @
a2b41886
...
@@ -625,8 +625,9 @@ public class OrgUsrController extends BaseController {
...
@@ -625,8 +625,9 @@ public class OrgUsrController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getAmosId/{amosId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getAmosId/{amosId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"判断关联账户是否已关联"
,
notes
=
"判断关联账户是否已关联"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"判断关联账户是否已关联"
,
notes
=
"判断关联账户是否已关联"
)
public
ResponseModel
<
Object
>
getAmosId
(
@PathVariable
String
amosId
)
{
public
ResponseModel
<
Object
>
getAmosId
(
@PathVariable
String
amosId
,
return
ResponseHelper
.
buildResponse
(
iOrgUsrService
.
amosIdExist
(
amosId
));
@RequestParam
(
required
=
false
)
String
orgUsrId
)
{
return
ResponseHelper
.
buildResponse
(
iOrgUsrService
.
amosIdExist
(
amosId
,
orgUsrId
));
}
}
/**
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java
View file @
a2b41886
...
@@ -2067,12 +2067,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
...
@@ -2067,12 +2067,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return
orgUser
;
return
orgUser
;
}
}
public
Object
amosIdExist
(
String
amosId
)
{
public
Object
amosIdExist
(
String
amosId
,
String
orgUsrId
)
{
int
num
=
orgUsrMapper
.
amosIdExist
(
amosId
);
// 增加逻辑:orgUsrId不为空时(编辑逻辑),进行筛选,解决自己页面编辑成自己,导致校验不通过
if
(
num
>
0
)
{
int
num
=
orgUsrMapper
.
amosIdExist
(
amosId
,
orgUsrId
);
return
false
;
return
num
<=
0
;
}
return
true
;
}
}
public
Object
amosIdExistTeam
(
String
amosId
)
{
public
Object
amosIdExistTeam
(
String
amosId
)
{
...
...
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