Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
李丛阳
education
Commits
2d140665
Commit
2d140665
authored
Oct 21, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
17f30a85
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
6 deletions
+20
-6
BBanner.java
...ain/java/org/rcisoft/business/bbanner/entity/BBanner.java
+1
-1
BBannerServiceImpl.java
...oft/business/bbanner/service/impl/BBannerServiceImpl.java
+12
-2
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+1
-0
ValidatedMessage.java
src/main/java/org/rcisoft/core/result/ValidatedMessage.java
+2
-1
ValidatedResult.java
src/main/java/org/rcisoft/core/validate/ValidatedResult.java
+4
-2
No files found.
src/main/java/org/rcisoft/business/bbanner/entity/BBanner.java
View file @
2d140665
...
@@ -34,7 +34,7 @@ public class BBanner extends IdEntity<BBanner> {
...
@@ -34,7 +34,7 @@ public class BBanner extends IdEntity<BBanner> {
private
String
title
;
private
String
title
;
@Length
(
min
=
1
,
max
=
128
,
message
=
"长度最小为1,最大为256"
)
@Length
(
min
=
1
,
max
=
128
,
message
=
"长度最小为1,最大为256"
)
@NotBlank
@NotBlank
(
message
=
"图片不能为空"
)
@ApiModelProperty
(
value
=
"图片地址"
)
@ApiModelProperty
(
value
=
"图片地址"
)
private
String
imageUrl
;
private
String
imageUrl
;
...
...
src/main/java/org/rcisoft/business/bbanner/service/impl/BBannerServiceImpl.java
View file @
2d140665
...
@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
/**
/**
...
@@ -48,10 +49,19 @@ public class BBannerServiceImpl implements BBannerService {
...
@@ -48,10 +49,19 @@ public class BBannerServiceImpl implements BBannerService {
int
line
=
0
;
int
line
=
0
;
//外部链接但外部URL为空或长度为0 抛异常
//外部链接但外部URL为空或长度为0 抛异常
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isEmpty
(
model
.
getExternalUrl
()))
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isEmpty
(
model
.
getExternalUrl
()))
throw
new
ServiceException
(
ResultServiceEnums
.
MUST_NOT_FILLED
);
throw
new
ServiceException
(
ResultServiceEnums
.
JUMP_ADDRESS_NULL
);
else
{
String
regex
=
"^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])"
;
// +(\?{0,1}(([A-Za-z0-9-~]+\={0,1})([A-Za-z0-9-~]*)\&{0,1})*)$
Pattern
pattern
=
Pattern
.
compile
(
regex
);
if
(!
pattern
.
matcher
(
model
.
getExternalUrl
()).
matches
())
{
// System.out.println("是正确的网址");
throw
new
ServiceException
(
"非法网址"
);
}
}
//内部链接但类型或课程ID为空或长度为0 抛异常
//内部链接但类型或课程ID为空或长度为0 抛异常
if
(
"0"
.
equals
(
model
.
getIsExternalLink
())
&&
(
StringUtils
.
isEmpty
(
model
.
getLineType
())
||
StringUtils
.
isEmpty
(
model
.
getCourseId
())))
if
(
"0"
.
equals
(
model
.
getIsExternalLink
())
&&
(
StringUtils
.
isEmpty
(
model
.
getLineType
())
||
StringUtils
.
isEmpty
(
model
.
getCourseId
())))
throw
new
ServiceException
(
ResultServiceEnums
.
MUST_NOT_FILLED
);
throw
new
ServiceException
(
ResultServiceEnums
.
JUMP_ADDRESS_NULL
);
if
(
model
.
getBusinessId
()
!=
null
)
{
if
(
model
.
getBusinessId
()
!=
null
)
{
//按ID查询Banner个数
//按ID查询Banner个数
if
(
bBannerRepository
.
selectCountById
(
model
.
getBusinessId
())
==
0
){
if
(
bBannerRepository
.
selectCountById
(
model
.
getBusinessId
())
==
0
){
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
2d140665
...
@@ -211,6 +211,7 @@ public enum ResultServiceEnums {
...
@@ -211,6 +211,7 @@ public enum ResultServiceEnums {
ZX_FAILED
(
111
,
"调用智信接口失败"
),
ZX_FAILED
(
111
,
"调用智信接口失败"
),
MUST_NOT_FILLED
(
112
,
"必填未填写"
),
MUST_NOT_FILLED
(
112
,
"必填未填写"
),
JUMP_ADDRESS_NULL
(
112
,
"跳转地址不能为空"
),
NOT_MORE_COUNT
(
113
,
"添加超过规定个数"
),
NOT_MORE_COUNT
(
113
,
"添加超过规定个数"
),
APPOINT_NOT_CLOSE
(
114
,
"必修不能退出"
),
APPOINT_NOT_CLOSE
(
114
,
"必修不能退出"
),
STATE_NOT_RELEASE
(
115
,
"该课程状态不能发布"
),
STATE_NOT_RELEASE
(
115
,
"该课程状态不能发布"
),
...
...
src/main/java/org/rcisoft/core/result/ValidatedMessage.java
View file @
2d140665
...
@@ -47,7 +47,8 @@ public class ValidatedMessage implements ResponseMessage {
...
@@ -47,7 +47,8 @@ public class ValidatedMessage implements ResponseMessage {
public
String
getResponse
(){
public
String
getResponse
(){
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
list
=
new
ArrayList
<
String
>();
for
(
Map
.
Entry
<
String
,
String
[]>
entry
:
this
.
validMap
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
String
[]>
entry
:
this
.
validMap
.
entrySet
()){
list
.
add
(
entry
.
getKey
()
+
" 异常 "
+
entry
.
getValue
()[
0
]);
list
.
add
(
entry
.
getKey
()
+
entry
.
getValue
()[
0
]);
// list.add(entry.getKey() + " 异常 " + entry.getValue()[0]);
}
}
return
StringUtils
.
join
(
list
,
";"
);
return
StringUtils
.
join
(
list
,
";"
);
}
}
...
...
src/main/java/org/rcisoft/core/validate/ValidatedResult.java
View file @
2d140665
...
@@ -61,8 +61,8 @@ public class ValidatedResult implements Serializable{
...
@@ -61,8 +61,8 @@ public class ValidatedResult implements Serializable{
while
(
var3
.
hasNext
())
{
while
(
var3
.
hasNext
())
{
FieldError
fieldError
=
(
FieldError
)
var3
.
next
();
FieldError
fieldError
=
(
FieldError
)
var3
.
next
();
this
.
errorsMap
.
put
(
" "
,
new
String
[]{
fieldError
.
getDefaultMessage
()});
this
.
errorsMap
.
put
(
" "
,
new
String
[]{
fieldError
.
getDefaultMessage
()});
// this.errorsMap.put(
fieldError
.getField(), new String[]{fieldError.getDefaultMessage(), fieldError.getCode()});
// this.errorsMap.put(
imageUrl
.getField(), new String[]{fieldError.getDefaultMessage(), fieldError.getCode()});
}
}
}
}
return
this
.
errorsMap
;
return
this
.
errorsMap
;
...
@@ -71,4 +71,6 @@ public class ValidatedResult implements Serializable{
...
@@ -71,4 +71,6 @@ public class ValidatedResult implements Serializable{
public
ResponseMessage
getValidatedMessage
()
{
public
ResponseMessage
getValidatedMessage
()
{
return
ValidatedMessage
.
builder
(
this
.
errorsMap
);
return
ValidatedMessage
.
builder
(
this
.
errorsMap
);
}
}
}
}
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