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
ef475f9d
Commit
ef475f9d
authored
Oct 21, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/meiteng' into meiteng
parents
a1b3409d
709fe615
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
9 deletions
+25
-9
BBanner.java
...ain/java/org/rcisoft/business/bbanner/entity/BBanner.java
+1
-1
BBannerServiceImpl.java
...oft/business/bbanner/service/impl/BBannerServiceImpl.java
+12
-2
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+2
-1
MvcConfig.java
src/main/java/org/rcisoft/config/MvcConfig.java
+3
-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 @
ef475f9d
...
...
@@ -34,7 +34,7 @@ public class BBanner extends IdEntity<BBanner> {
private
String
title
;
@Length
(
min
=
1
,
max
=
128
,
message
=
"长度最小为1,最大为256"
)
@NotBlank
@NotBlank
(
message
=
"图片不能为空"
)
@ApiModelProperty
(
value
=
"图片地址"
)
private
String
imageUrl
;
...
...
src/main/java/org/rcisoft/business/bbanner/service/impl/BBannerServiceImpl.java
View file @
ef475f9d
...
...
@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
/**
...
...
@@ -48,10 +49,19 @@ public class BBannerServiceImpl implements BBannerService {
int
line
=
0
;
//外部链接但外部URL为空或长度为0 抛异常
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 抛异常
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
)
{
//按ID查询Banner个数
if
(
bBannerRepository
.
selectCountById
(
model
.
getBusinessId
())
==
0
){
...
...
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
ef475f9d
...
...
@@ -409,12 +409,13 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
// int insertBChapter(BChapter model);
@Select
(
"<script>"
+
"SELECT bc.*, brc.current_location as currentLocation "
+
"SELECT bc.*, brc.current_location as currentLocation
, bf.video_url as videoUrl
"
+
"FROM "
+
" b_lesson_person bp "
+
" LEFT JOIN b_lesson b ON bp.lesson_id = b.business_id "
+
" LEFT JOIN b_chapter bc ON bc.business_id = bp.chapter_id "
+
"left join b_r_student_chapter brc on brc.chapter_id = bc.business_id "
+
"left join b_file bf on bf.chapter_id = bc.business_id "
+
"WHERE "
+
" bp.chapter_id IS NOT NULL "
+
" AND bp.chapter_id != '' "
+
...
...
src/main/java/org/rcisoft/config/MvcConfig.java
View file @
ef475f9d
...
...
@@ -73,6 +73,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
public
void
configureHandlerExceptionResolvers
(
List
<
HandlerExceptionResolver
>
exceptionResolvers
)
{
exceptionResolvers
.
add
((
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
e
)
->
{
Result
result
=
new
Result
();
String
message
=
e
.
getMessage
();
if
(
handler
instanceof
HandlerMethod
)
{
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
if
(
e
instanceof
SystemException
){
...
...
@@ -87,7 +88,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
if
(
e
instanceof
ServiceException
)
{
//业务失败的异常,如“账号或密码错误”
result
.
setCode
(
ResultCode
.
FAIL
).
setMessage
(
e
.
getMessage
());
}
else
{
String
message
=
String
.
format
(
"接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s"
,
message
=
String
.
format
(
"接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s"
,
request
.
getRequestURI
(),
handlerMethod
.
getBean
().
getClass
().
getName
(),
handlerMethod
.
getMethod
().
getName
(),
...
...
@@ -101,7 +102,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
result
.
setCode
(
ResultCode
.
ERROR
).
setMessage
(
e
.
getMessage
());
}
}
log
.
error
(
e
.
getMessage
()
);
log
.
error
(
message
);
ResponseUtil
.
responseResult
(
response
,
result
);
return
new
ModelAndView
();
}
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
ef475f9d
...
...
@@ -211,6 +211,7 @@ public enum ResultServiceEnums {
ZX_FAILED
(
111
,
"调用智信接口失败"
),
MUST_NOT_FILLED
(
112
,
"必填未填写"
),
JUMP_ADDRESS_NULL
(
112
,
"跳转地址不能为空"
),
NOT_MORE_COUNT
(
113
,
"添加超过规定个数"
),
APPOINT_NOT_CLOSE
(
114
,
"必修不能退出"
),
STATE_NOT_RELEASE
(
115
,
"该课程状态不能发布"
),
...
...
src/main/java/org/rcisoft/core/result/ValidatedMessage.java
View file @
ef475f9d
...
...
@@ -47,7 +47,8 @@ public class ValidatedMessage implements ResponseMessage {
public
String
getResponse
(){
List
<
String
>
list
=
new
ArrayList
<
String
>();
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
,
";"
);
}
...
...
src/main/java/org/rcisoft/core/validate/ValidatedResult.java
View file @
ef475f9d
...
...
@@ -61,8 +61,8 @@ public class ValidatedResult implements Serializable{
while
(
var3
.
hasNext
())
{
FieldError
fieldError
=
(
FieldError
)
var3
.
next
();
this
.
errorsMap
.
put
(
" "
,
new
String
[]{
fieldError
.
getDefaultMessage
()});
// this.errorsMap.put(
fieldError
.getField(), new String[]{fieldError.getDefaultMessage(), fieldError.getCode()});
this
.
errorsMap
.
put
(
" "
,
new
String
[]{
fieldError
.
getDefaultMessage
()});
// this.errorsMap.put(
imageUrl
.getField(), new String[]{fieldError.getDefaultMessage(), fieldError.getCode()});
}
}
return
this
.
errorsMap
;
...
...
@@ -71,4 +71,6 @@ public class ValidatedResult implements Serializable{
public
ResponseMessage
getValidatedMessage
()
{
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