Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
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
zhangkb
indicators
Commits
a4ea3320
Commit
a4ea3320
authored
Aug 03, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改返回值
parent
a4a4817a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
IndCatalogCtrl.java
...om/keymobile/indicators/api/hytobacco/IndCatalogCtrl.java
+3
-8
ApiException.java
...java/com/keymobile/indicators/exception/ApiException.java
+3
-0
IndCatalogService.java
...obile/indicators/service/hytobacco/IndCatalogService.java
+4
-4
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/IndCatalogCtrl.java
View file @
a4ea3320
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -33,6 +34,7 @@ public class IndCatalogCtrl {
...
@@ -33,6 +34,7 @@ public class IndCatalogCtrl {
@ApiOperation
(
value
=
"新建基础指标目录"
,
notes
=
"新建基础指标目录"
)
@ApiOperation
(
value
=
"新建基础指标目录"
,
notes
=
"新建基础指标目录"
)
@PostMapping
(
value
=
"/createBaseIndCatalog"
)
@PostMapping
(
value
=
"/createBaseIndCatalog"
)
@ResponseBody
public
Integer
createBaseIndCatalog
(
@RequestBody
IndCatalog
indCatalog
)
throws
ApiException
{
public
Integer
createBaseIndCatalog
(
@RequestBody
IndCatalog
indCatalog
)
throws
ApiException
{
String
message
=
null
;
String
message
=
null
;
if
(
indCatalog
.
getId
()==
null
)
{
if
(
indCatalog
.
getId
()==
null
)
{
...
@@ -40,14 +42,7 @@ public class IndCatalogCtrl {
...
@@ -40,14 +42,7 @@ public class IndCatalogCtrl {
}
else
{
}
else
{
message
=
"修改基础项目录:{}"
;
message
=
"修改基础项目录:{}"
;
}
}
// try {
indCatalog
=
indCatalogService
.
saveOrUpdate
(
indCatalog
);
// indCatalog = indCatalogService.saveOrUpdate(indCatalog);
// } catch (Exception e) {
if
(
1
==
1
)
{
throw
new
ApiException
();
}
// }
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_BASE_INDI_API
,
message
,
indCatalog
.
getCatalogName
());
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_BASE_INDI_API
,
message
,
indCatalog
.
getCatalogName
());
return
indCatalog
.
getId
();
return
indCatalog
.
getId
();
}
}
...
...
src/main/java/com/keymobile/indicators/exception/ApiException.java
View file @
a4ea3320
...
@@ -5,4 +5,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
...
@@ -5,4 +5,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus
(
code
=
HttpStatus
.
INTERNAL_SERVER_ERROR
,
reason
=
"server error"
)
@ResponseStatus
(
code
=
HttpStatus
.
INTERNAL_SERVER_ERROR
,
reason
=
"server error"
)
public
class
ApiException
extends
Exception
{
public
class
ApiException
extends
Exception
{
public
ApiException
(
String
msg
)
{
super
(
msg
);
}
}
}
src/main/java/com/keymobile/indicators/service/hytobacco/IndCatalogService.java
View file @
a4ea3320
...
@@ -25,11 +25,11 @@ public class IndCatalogService {
...
@@ -25,11 +25,11 @@ public class IndCatalogService {
@Autowired
@Autowired
private
BaseIndDefMapper
baseIndDefMapper
;
private
BaseIndDefMapper
baseIndDefMapper
;
public
IndCatalog
saveOrUpdate
(
IndCatalog
indCatalog
)
throws
Exception
{
public
IndCatalog
saveOrUpdate
(
IndCatalog
indCatalog
)
throws
Api
Exception
{
if
(
indCatalog
.
getId
()==
null
)
{
//新增
if
(
indCatalog
.
getId
()==
null
)
{
//新增
if
(!
indCatalogMapper
.
findIsExist
(
indCatalog
.
getCatalogName
(),
indCatalog
.
getParentId
(),
if
(!
indCatalogMapper
.
findIsExist
(
indCatalog
.
getCatalogName
(),
indCatalog
.
getParentId
(),
indCatalog
.
getCode
()).
isEmpty
())
{
indCatalog
.
getCode
()).
isEmpty
())
{
throw
new
Exception
(
"存在同名目录"
);
throw
new
Api
Exception
(
"存在同名目录"
);
}
}
//保存
//保存
indCatalogMapper
.
insert
(
indCatalog
);
indCatalogMapper
.
insert
(
indCatalog
);
...
@@ -37,7 +37,7 @@ public class IndCatalogService {
...
@@ -37,7 +37,7 @@ public class IndCatalogService {
List
<
IndCatalog
>
dbList
=
indCatalogMapper
.
findIsExist
(
indCatalog
.
getCatalogName
(),
indCatalog
.
getParentId
(),
List
<
IndCatalog
>
dbList
=
indCatalogMapper
.
findIsExist
(
indCatalog
.
getCatalogName
(),
indCatalog
.
getParentId
(),
indCatalog
.
getCode
());
indCatalog
.
getCode
());
if
(!
dbList
.
isEmpty
()
&&
!
dbList
.
get
(
0
).
getId
().
equals
(
indCatalog
.
getId
()))
{
if
(!
dbList
.
isEmpty
()
&&
!
dbList
.
get
(
0
).
getId
().
equals
(
indCatalog
.
getId
()))
{
throw
new
Exception
(
"存在同名目录"
);
throw
new
Api
Exception
(
"存在同名目录"
);
}
}
}
}
//获取parentId拼接idPath
//获取parentId拼接idPath
...
@@ -47,7 +47,7 @@ public class IndCatalogService {
...
@@ -47,7 +47,7 @@ public class IndCatalogService {
}
else
{
}
else
{
IndCatalog
parentIndCatalog
=
indCatalogMapper
.
selectByPrimaryKey
(
indCatalog
.
getParentId
());
IndCatalog
parentIndCatalog
=
indCatalogMapper
.
selectByPrimaryKey
(
indCatalog
.
getParentId
());
if
(
parentIndCatalog
==
null
)
{
if
(
parentIndCatalog
==
null
)
{
throw
new
Exception
(
"父节点不存在:parent catalog is not exist"
);
throw
new
Api
Exception
(
"父节点不存在:parent catalog is not exist"
);
}
else
{
}
else
{
indCatalog
.
setIdPath
(
parentIndCatalog
.
getIdPath
()+
indCatalog
.
getId
()+
";"
);
indCatalog
.
setIdPath
(
parentIndCatalog
.
getIdPath
()+
indCatalog
.
getId
()+
";"
);
}
}
...
...
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