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
efd9df07
Commit
efd9df07
authored
Dec 14, 2017
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理自定义异常
parent
ac12e2d9
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
19 additions
and
25 deletions
+19
-25
BClassController.java
.../rcisoft/business/bclass/controller/BClassController.java
+1
-1
BClassServiceImpl.java
...isoft/business/bclass/service/impl/BClassServiceImpl.java
+1
-2
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+1
-1
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+1
-2
BStudentController.java
...soft/business/bstudent/controller/BStudentController.java
+1
-1
BStudentServiceImpl.java
...t/business/bstudent/service/impl/BStudentServiceImpl.java
+2
-3
BTeacherController.java
...soft/business/bteacher/controller/BTeacherController.java
+1
-1
BTeacherServiceImpl.java
...t/business/bteacher/service/impl/BTeacherServiceImpl.java
+2
-3
BTermController.java
...rg/rcisoft/business/bterm/controller/BTermController.java
+1
-1
BTermServiceImpl.java
...rcisoft/business/bterm/service/impl/BTermServiceImpl.java
+1
-2
MvcConfig.java
src/main/java/org/rcisoft/config/MvcConfig.java
+2
-3
SysUserMapper.java
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
+4
-4
application-dev.yml
src/main/resources/application-dev.yml
+1
-1
No files found.
src/main/java/org/rcisoft/business/bclass/controller/BClassController.java
View file @
efd9df07
...
...
@@ -68,7 +68,7 @@ public class BClassController extends PaginationController<BClass> {
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bClassService
.
removeBClass
(
id
);
return
Result
.
builder
(
data
,
data
.
getInfluenceReason
()
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
...
...
src/main/java/org/rcisoft/business/bclass/service/impl/BClassServiceImpl.java
View file @
efd9df07
...
...
@@ -72,8 +72,7 @@ public class BClassServiceImpl implements BClassService {
@Override
public
PersistModel
removeBClass
(
String
id
)
{
if
(
brClassStudentRepository
.
selectStuentNumByClassId
(
id
)>
0
)
{
//throw new ServiceException(ResultServiceEnums.CLASS_HAS_STUDENTS);
return
new
PersistModel
(
1
,
(
ResultServiceEnums
.
CLASS_HAS_STUDENTS
).
getMessage
());
throw
new
ServiceException
(
ResultServiceEnums
.
CLASS_HAS_STUDENTS
);
}
int
line
=
bClassRepository
.
deleteByPrimaryKey
(
id
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
...
...
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
efd9df07
...
...
@@ -74,7 +74,7 @@ public class BLessonController extends PaginationController<BLesson> {
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bLessonService
.
removeBLesson
(
id
);
return
Result
.
builder
(
data
,
data
.
getInfluenceReason
()
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
efd9df07
...
...
@@ -166,8 +166,7 @@ public class BLessonServiceImpl implements BLessonService {
@Override
public
PersistModel
removeBLesson
(
String
id
)
{
if
(
bSlRepository
.
selectslNumByLesson
(
id
)>
0
)
{
//throw new ServiceException(ResultServiceEnums.LESSON_HAS_SL);
return
new
PersistModel
(
1
,
(
ResultServiceEnums
.
LESSON_HAS_SL
).
getMessage
());
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_HAS_SL
);
}
int
line
=
bLessonRepository
.
deleteByPrimaryKey
(
id
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
...
...
src/main/java/org/rcisoft/business/bstudent/controller/BStudentController.java
View file @
efd9df07
...
...
@@ -127,7 +127,7 @@ public class BStudentController extends PaginationController<BStudent> {
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bStudentService
.
removeBBStudent
(
id
);
return
Result
.
builder
(
data
,
data
.
getInfluenceReason
()
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
...
...
src/main/java/org/rcisoft/business/bstudent/service/impl/BStudentServiceImpl.java
View file @
efd9df07
...
...
@@ -249,13 +249,12 @@ public class BStudentServiceImpl implements BStudentService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
removeBBStudent
(
String
id
)
{
if
(
brSlStudentRepository
.
selectSlNumByStuId
(
id
)>
0
)
{
return
new
PersistModel
(
1
,
(
ResultServiceEnums
.
STUDENT_HAS_SL
).
getMessage
());
//throw new ServiceException(ResultServiceEnums.STUDENT_HAS_SL);
throw
new
ServiceException
(
ResultServiceEnums
.
STUDENT_HAS_SL
);
}
BStudent
bStudent
=
new
BStudent
();
bStudent
.
setBusinessId
(
id
);
BStudent
student
=
bStudentRepository
.
selectOne
(
bStudent
);
sysUserMapper
.
deleteBy
PrimaryKey
(
student
.
getCode
());
sysUserMapper
.
deleteBy
Code
(
student
.
getCode
());
int
line
=
bStudentRepository
.
deleteByPrimaryKey
(
id
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
...
...
src/main/java/org/rcisoft/business/bteacher/controller/BTeacherController.java
View file @
efd9df07
...
...
@@ -66,7 +66,7 @@ public class BTeacherController extends PaginationController<BTeacher> {
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bTeacherService
.
removeBTeacher
(
id
);
return
Result
.
builder
(
data
,
data
.
getInfluenceReason
()
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
...
...
src/main/java/org/rcisoft/business/bteacher/service/impl/BTeacherServiceImpl.java
View file @
efd9df07
...
...
@@ -196,13 +196,12 @@ public class BTeacherServiceImpl implements BTeacherService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
removeBTeacher
(
String
id
)
{
if
(
bSlRepository
.
selectSlNumByStuent
(
id
)>
0
)
{
//throw new ServiceException(ResultServiceEnums.TEACHER_HAS_SL);
return
new
PersistModel
(
1
,
(
ResultServiceEnums
.
TEACHER_HAS_SL
).
getMessage
());
throw
new
ServiceException
(
ResultServiceEnums
.
TEACHER_HAS_SL
);
}
BTeacher
bTeacher
=
new
BTeacher
();
bTeacher
.
setBusinessId
(
id
);
BTeacher
teacher
=
bTeacherRepository
.
selectOne
(
bTeacher
);
sysUserMapper
.
deleteBy
PrimaryKey
(
teacher
.
getCode
());
sysUserMapper
.
deleteBy
Code
(
teacher
.
getCode
());
int
line
=
bTeacherRepository
.
deleteByPrimaryKey
(
id
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
...
...
src/main/java/org/rcisoft/business/bterm/controller/BTermController.java
View file @
efd9df07
...
...
@@ -116,7 +116,7 @@ public class BTermController extends PaginationController<BTerm> {
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bTermService
.
removeBTerm
(
id
);
return
Result
.
builder
(
data
,
data
.
getInfluenceReason
()
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
...
...
src/main/java/org/rcisoft/business/bterm/service/impl/BTermServiceImpl.java
View file @
efd9df07
...
...
@@ -71,8 +71,7 @@ public class BTermServiceImpl implements BTermService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
removeBTerm
(
String
id
)
{
if
(
bSlRepository
.
selectslNumByTermId
(
id
)>
0
)
{
return
new
PersistModel
(
1
,
(
ResultServiceEnums
.
TERM_HAS_SL
).
getMessage
());
//throw new ServiceException(ResultServiceEnums.TERM_HAS_SL);
throw
new
ServiceException
(
ResultServiceEnums
.
TERM_HAS_SL
);
}
int
line
=
bTermRepository
.
deleteByPrimaryKey
(
id
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
...
...
src/main/java/org/rcisoft/config/MvcConfig.java
View file @
efd9df07
...
...
@@ -81,8 +81,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
if
(
handler
instanceof
HandlerMethod
)
{
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
if
(
e
instanceof
ServiceException
)
{
//业务失败的异常,如“账号或密码错误”
result
.
setCode
(
ResultCode
.
SERVICE_ERROR
).
setMessage
(
e
.
getMessage
());
//result = ResultGenerator.genFailResult(e.getMessage());
result
=
ResultGenerator
.
genFailResult
(
e
.
getMessage
());
log
.
info
(
e
.
getMessage
());
}
else
if
(
e
instanceof
AuthenticationException
)
{
if
(
e
instanceof
BadCredentialsException
)
...
...
@@ -151,7 +150,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
private
void
responseResult
(
HttpServletResponse
response
,
Result
result
)
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"Content-type"
,
"application/json;charset=UTF-8"
);
response
.
setStatus
(
result
.
getCode
()
);
response
.
setStatus
(
200
);
try
{
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
result
));
}
catch
(
IOException
ex
)
{
...
...
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
View file @
efd9df07
package
org
.
rcisoft
.
sys
.
user
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.rcisoft.sys.user.entity.UserRole
;
...
...
@@ -43,4 +40,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select
(
"SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id}"
)
String
selectUserIdByStuOrTeaId
(
@Param
(
"id"
)
String
id
,
@Param
(
"tab"
)
String
table
);
@Delete
(
"delete from s_user where login_name = #{code}"
)
int
deleteByCode
(
String
code
);
}
src/main/resources/application-dev.yml
View file @
efd9df07
server
:
port
:
8081
context-path
:
/
#ContextPath must start with '/' and not end with '/'
context-path
:
/
edu
#ContextPath must start with '/' and not end with '/'
tomcat
:
max-threads
:
300
#uri-encoding: UTF-8
...
...
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