Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
4ece1351
Commit
4ece1351
authored
Mar 12, 2019
by
gary
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、添加ERRORCODEMSG Enum
parent
5a5863cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
58 deletions
+74
-58
EnumErrorCodeMsg.java
...ava/pwc/taxtech/atms/constant/enums/EnumErrorCodeMsg.java
+40
-0
EbsApiController.java
...in/java/pwc/taxtech/atms/controller/EbsApiController.java
+34
-58
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/EnumErrorCodeMsg.java
0 → 100644
View file @
4ece1351
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
EnumErrorCodeMsg
{
SUCCESS
(
0
,
"成功"
),
APIERROR
(-
1
,
"接口异常"
),
APIDATAEMPTY
(-
2
,
"接口输入数据为空"
);
private
Integer
code
;
private
String
msg
;
EnumErrorCodeMsg
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
static
EnumErrorCodeMsg
fromCode
(
Integer
code
){
for
(
EnumErrorCodeMsg
error:
EnumErrorCodeMsg
.
values
()){
if
(
error
.
getCode
().
intValue
()==
code
.
intValue
())
return
error
;
}
// 超出范围值默认返回异常
return
EnumErrorCodeMsg
.
APIERROR
;
}
public
static
String
getMsg
(
Integer
code
){
for
(
EnumErrorCodeMsg
error:
EnumErrorCodeMsg
.
values
()){
if
(
error
.
getCode
().
intValue
()==
code
.
intValue
())
return
error
.
msg
;
}
// 超出范围值默认返回异常
return
EnumErrorCodeMsg
.
APIERROR
.
msg
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/EbsApiController.java
View file @
4ece1351
...
@@ -4,6 +4,8 @@ import org.slf4j.Logger;
...
@@ -4,6 +4,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.constant.CodeErrorConstant
;
import
pwc.taxtech.atms.constant.enums.EnumErrorCodeMsg
;
import
pwc.taxtech.atms.dto.ApiResultDto
;
import
pwc.taxtech.atms.dto.ApiResultDto
;
import
pwc.taxtech.atms.dto.ebsdto.*
;
import
pwc.taxtech.atms.dto.ebsdto.*
;
import
pwc.taxtech.atms.service.EbsApiService
;
import
pwc.taxtech.atms.service.EbsApiService
;
...
@@ -27,21 +29,18 @@ public class EbsApiController {
...
@@ -27,21 +29,18 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateJE return items is empty"
);
logger
.
debug
(
"the updateJE return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取日记账数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateJE
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateJE
(
id
,
items
);
logger
.
debug
(
"日记账同步更新 success"
);
logger
.
debug
(
"日记账同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"日记账同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateJE error."
,
e
);
logger
.
error
(
"updateJE error."
,
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
apiResultDto
.
setCode
(-
1
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setMessage
(
"日记账同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -52,21 +51,18 @@ public class EbsApiController {
...
@@ -52,21 +51,18 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateTB return items is empty"
);
logger
.
debug
(
"the updateTB return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取科目余额数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateTB
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateTB
(
id
,
items
);
logger
.
debug
(
"科目余额数据同步更新 success"
);
logger
.
debug
(
"科目余额数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"科目余额数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateTB error."
,
e
);
logger
.
error
(
"updateTB error."
,
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
apiResultDto
.
setCode
(-
1
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setMessage
(
"科目余额数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -77,21 +73,18 @@ public class EbsApiController {
...
@@ -77,21 +73,18 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateCF return items is empty"
);
logger
.
debug
(
"the updateCF return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取现金流量数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateCF
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateCF
(
id
,
items
);
logger
.
debug
(
"现金流量数据同步更新 success"
);
logger
.
debug
(
"现金流量数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"现金流量数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateCF error."
,
e
);
logger
.
error
(
"updateCF error."
,
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
apiResultDto
.
setCode
(-
1
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setMessage
(
"现金流量数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -102,21 +95,18 @@ public class EbsApiController {
...
@@ -102,21 +95,18 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateBS return items is empty"
);
logger
.
debug
(
"the updateBS return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取资产负债数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateBS
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateBS
(
id
,
items
);
logger
.
debug
(
"资产负债数据同步更新 success"
);
logger
.
debug
(
"资产负债数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"资产负债数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateBS error."
,
e
);
logger
.
error
(
"updateBS error."
,
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
apiResultDto
.
setCode
(-
1
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setMessage
(
"资产负债数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -127,21 +117,18 @@ public class EbsApiController {
...
@@ -127,21 +117,18 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updatePL return items is empty"
);
logger
.
debug
(
"the updatePL return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取利润数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdatePL
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdatePL
(
id
,
items
);
logger
.
debug
(
"利润数据同步更新 success"
);
logger
.
debug
(
"利润数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"利润数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updatePL error."
,
e
);
logger
.
error
(
"updatePL error."
,
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
apiResultDto
.
setCode
(-
1
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setMessage
(
"利润数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -152,21 +139,17 @@ public class EbsApiController {
...
@@ -152,21 +139,17 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateBSprc return items is empty"
);
logger
.
debug
(
"the updateBSprc return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取资产负债PRC数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateBSprc
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateBSprc
(
id
,
items
);
logger
.
debug
(
"资产负债PRC数据同步更新 success"
);
logger
.
debug
(
"资产负债PRC数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"资产负债PRC数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateBSprc error."
,
e
);
logger
.
error
(
"updateBSprc error."
,
e
);
e
.
printStackTrace
();
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setCode
(-
1
);
apiResultDto
.
setMessage
(
"资产负债PRC数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -177,21 +160,17 @@ public class EbsApiController {
...
@@ -177,21 +160,17 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updatePLprc return items is empty"
);
logger
.
debug
(
"the updatePLprc return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取利润PRC数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdatePLprc
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdatePLprc
(
id
,
items
);
logger
.
debug
(
"利润PRC数据同步更新 success"
);
logger
.
debug
(
"利润PRC数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"利润PRC数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updatePLprc error."
,
e
);
logger
.
error
(
"updatePLprc error."
,
e
);
e
.
printStackTrace
();
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setCode
(-
1
);
apiResultDto
.
setMessage
(
"利润PRC数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -202,21 +181,17 @@ public class EbsApiController {
...
@@ -202,21 +181,17 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateOAR return items is empty"
);
logger
.
debug
(
"the updateOAR return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取汇率数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateOAR
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateOAR
(
id
,
items
);
logger
.
debug
(
"汇率数据同步更新 success"
);
logger
.
debug
(
"汇率数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"汇率数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateOAR error."
,
e
);
logger
.
error
(
"updateOAR error."
,
e
);
e
.
printStackTrace
();
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setCode
(-
1
);
apiResultDto
.
setMessage
(
"汇率数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
...
@@ -226,23 +201,24 @@ public class EbsApiController {
...
@@ -226,23 +201,24 @@ public class EbsApiController {
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
ApiResultDto
apiResultDto
=
new
ApiResultDto
();
if
(
CollectionUtils
.
isEmpty
(
items
))
{
if
(
CollectionUtils
.
isEmpty
(
items
))
{
logger
.
debug
(
"the updateOrg return items is empty"
);
logger
.
debug
(
"the updateOrg return items is empty"
);
apiResultDto
.
setCode
(-
2
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIDATAEMPTY
);
apiResultDto
.
setMessage
(
"获取机构信息数据为空"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
try
{
try
{
ebsApiService
.
queryRemoteServerThenUpdateOrg
(
id
,
items
);
ebsApiService
.
queryRemoteServerThenUpdateOrg
(
id
,
items
);
logger
.
debug
(
"机构信息数据同步更新 success"
);
logger
.
debug
(
"机构信息数据同步更新 success"
);
apiResultDto
.
setCode
(
0
);
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
SUCCESS
);
apiResultDto
.
setMessage
(
"机构信息数据同步更新 success"
);
return
apiResultDto
;
return
apiResultDto
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"updateOrg error."
,
e
);
logger
.
error
(
"updateOrg error."
,
e
);
e
.
printStackTrace
();
setApiResult
(
apiResultDto
,
EnumErrorCodeMsg
.
APIERROR
);
apiResultDto
.
setCode
(-
1
);
apiResultDto
.
setMessage
(
"机构信息数据同步更新失败"
);
return
apiResultDto
;
return
apiResultDto
;
}
}
}
}
private
void
setApiResult
(
ApiResultDto
apiResultDto
,
EnumErrorCodeMsg
error
)
{
apiResultDto
.
setCode
(
error
.
getCode
());
apiResultDto
.
setMessage
(
error
.
getMsg
());
}
}
}
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