Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3540c3e4
authored
Mar 26, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
调整异常处理方法
1 parent
b90aa0ca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
src/main/java/com/glsx/smart/controller/SysCodeController.java
src/main/java/com/glsx/smart/controller/SysFileController.java
src/main/java/com/glsx/smart/controller/SysCodeController.java
View file @
3540c3e
...
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.service.SmartSysCodeService
;
import
com.glsx.smart.service.SmartSysCodeService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -26,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -26,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RestController
@RequestMapping
(
"/sysCode"
)
@RequestMapping
(
"/sysCode"
)
public
class
SysCodeController
{
public
class
SysCodeController
{
@Autowired
@Autowired
private
SmartSysCodeService
sysCodeService
;
private
SmartSysCodeService
sysCodeService
;
...
@@ -35,9 +33,15 @@ public class SysCodeController {
...
@@ -35,9 +33,15 @@ public class SysCodeController {
log
.
info
(
"/sysCode/getList param: {}"
,
JSON
.
toJSONString
(
code
));
log
.
info
(
"/sysCode/getList param: {}"
,
JSON
.
toJSONString
(
code
));
if
(
StringUtils
.
isEmpty
(
code
.
getDictType
())
if
(
StringUtils
.
isEmpty
(
code
.
getDictType
())
||
StringUtils
.
isEmpty
(
code
.
getParentKey
())){
||
StringUtils
.
isEmpty
(
code
.
getParentKey
())){
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_ERROR
);
return
R
.
error
(
ResultEnum
.
PARAM_ERROR
.
getCode
(),
ResultEnum
.
PARAM_ERROR
.
getMessage
());
}
try
{
List
<
SmartSysCode
>
sysCodeList
=
sysCodeService
.
getList
(
code
);
return
R
.
ok
().
data
(
sysCodeList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"!!!! /sysCode/getList ERROR"
,
e
);
return
R
.
error
();
}
}
return
R
.
ok
().
data
(
sysCodeService
.
getList
(
code
));
}
}
@RequestMapping
(
value
=
"/getListByCondition"
,
method
=
{
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/getListByCondition"
,
method
=
{
RequestMethod
.
POST
})
...
...
src/main/java/com/glsx/smart/controller/SysFileController.java
View file @
3540c3e
package
com
.
glsx
.
smart
.
controller
;
package
com
.
glsx
.
smart
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Map
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.pojo.FileDTO
;
import
com.glsx.smart.pojo.FileDTO
;
import
com.glsx.smart.service.SmartSysFileService
;
import
com.glsx.smart.service.SmartSysFileService
;
...
@@ -9,10 +9,11 @@ import io.swagger.annotations.Api;
...
@@ -9,10 +9,11 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.List
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
java.util.Map
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* <p>Description:
* <p>Description:
...
@@ -43,6 +44,7 @@ public class SysFileController {
...
@@ -43,6 +44,7 @@ public class SysFileController {
try
{
try
{
mapList
=
sysFileService
.
saveFile
(
files
);
mapList
=
sysFileService
.
saveFile
(
files
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"批量保存图片失败:"
,
e
);
return
R
.
error
();
return
R
.
error
();
}
}
return
R
.
ok
().
data
(
mapList
);
return
R
.
ok
().
data
(
mapList
);
...
@@ -54,7 +56,7 @@ public class SysFileController {
...
@@ -54,7 +56,7 @@ public class SysFileController {
try
{
try
{
return
R
.
ok
().
data
(
sysFileService
.
updateFile
(
fileDTO
));
return
R
.
ok
().
data
(
sysFileService
.
updateFile
(
fileDTO
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"保存
图片失败:{}
"
,
e
);
log
.
error
(
"保存
更新图片失败:
"
,
e
);
return
R
.
error
();
return
R
.
error
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment