Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9fd7c56b
由
LN
编写于
2024-07-17 15:10:05 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
bug修改
1 个父辈
a096d682
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
87 行增加
和
50 行删除
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
查看文件 @
9fd7c56
...
@@ -217,40 +217,41 @@ public class MicronApi {
...
@@ -217,40 +217,41 @@ public class MicronApi {
}
}
private
static
String
getDErrorMsg
(
MicronResult
result
)
throws
ApiException
{
private
static
String
getDErrorMsg
(
MicronResult
result
)
throws
ApiException
{
String
errMsg
=
""
;
return
result
.
getDErrorMsg
();
Object
errCode
=
-
1
;
// String errMsg = "";
String
detail
=
""
;
// Object errCode = -1;
try
{
// String detail = "";
// try {
// "error": <ErrCode>,
//
// "message": <ErrMessage>,
// // "error": <ErrCode>,
// "detail": <ErrDetail>
//// "message": <ErrMessage>,
//// "detail": <ErrDetail>
errMsg
=
result
.
getResult
(
"message"
,
false
);
//
if
(
ObjectUtil
.
isEmpty
(
errMsg
))
{
// errMsg = result.getResult("message", false);
errMsg
=
""
;
// if (ObjectUtil.isEmpty(errMsg)) {
}
else
{
// errMsg = "";
errMsg
=
"message:"
+
errMsg
;
// } else {
}
// errMsg = "message:" + errMsg;
errCode
=
result
.
getResult
(
"error"
,
false
);
// }
// errCode = result.getResult("error", false);
if
(
ObjectUtil
.
isEmpty
(
errCode
))
{
//
errCode
=
""
;
// if (ObjectUtil.isEmpty(errCode)) {
}
else
{
// errCode = "";
errCode
=
"error:"
+
errCode
;
// } else {
}
// errCode = "error:" + errCode;
detail
=
result
.
getResult
(
"detail"
,
false
);
// }
if
(
ObjectUtil
.
isEmpty
(
detail
))
{
// detail = result.getResult("detail", false);
detail
=
""
;
// if (ObjectUtil.isEmpty(detail)) {
}
else
{
// detail = "";
detail
=
"detail:"
+
detail
;
// } else {
}
// detail = "detail:" + detail;
// }
return
errCode
+
";"
+
errMsg
+
";"
+
detail
;
//
}
catch
(
Exception
exception
)
{
// return errCode + ";" + errMsg + ";" + detail;
log
.
error
(
"出错:"
+
exception
);
// } catch (Exception exception) {
return
errCode
+
";"
+
errMsg
+
";"
+
detail
+
":"
+
exception
.
toString
();
// log.error("出错:" + exception);
}
// return errCode + ";" + errMsg + ";" + detail + ":" + exception.toString();
// }
}
}
public
static
Map
<
String
,
String
>
API002
(
String
rfid
,
String
operationId
,
List
<
StoragePos
>
storagePos
)
{
public
static
Map
<
String
,
String
>
API002
(
String
rfid
,
String
operationId
,
List
<
StoragePos
>
storagePos
)
{
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
查看文件 @
9fd7c56
...
@@ -49,7 +49,7 @@ public class MicronResult implements Serializable {
...
@@ -49,7 +49,7 @@ public class MicronResult implements Serializable {
// }
// }
public
boolean
IsSuccess
()
throws
ApiException
{
public
boolean
IsSuccess
()
throws
ApiException
{
Boolean
status
=
getResult
(
"success"
,
false
);
Boolean
status
=
GetMapValue
(
"success"
);
if
(
ObjectUtil
.
isNotEmpty
(
status
)
&&
status
)
{
if
(
ObjectUtil
.
isNotEmpty
(
status
)
&&
status
)
{
return
true
;
return
true
;
}
}
...
@@ -76,24 +76,26 @@ public class MicronResult implements Serializable {
...
@@ -76,24 +76,26 @@ public class MicronResult implements Serializable {
resultMap
=
JsonUtil
.
toMap
(
responseData
);
resultMap
=
JsonUtil
.
toMap
(
responseData
);
}
}
if
(
needCheck
)
{
if
(
needCheck
)
{
Object
resultStatus
=
resultMap
.
get
(
"status"
);
if
(!
IsSuccess
())
{
if
(
resultStatus
==
null
||
(!
resultStatus
.
toString
().
equalsIgnoreCase
(
"SUCCESS"
)))
{
String
msg
=
getDErrorMsg
();
//失败
log
.
error
(
"getResult["
+
key
+
"] smfcore.api.error : "
+
msg
);
String
message
=
resultMap
.
get
(
"message"
).
toString
();
throw
new
ApiException
(
msg
);
message
=
(
message
==
null
?
""
:
message
);
}
Object
error
=
resultMap
.
get
(
"error"
);
error
=
(
error
==
null
)
?
""
:
error
;
String
detail
=
resultMap
.
get
(
"detail"
).
toString
();
detail
=
(
detail
==
null
?
""
:
detail
);
log
.
error
(
" smfcore.api.error : error="
+
error
+
""
+
",message="
+
message
+
",detial="
+
detail
);
throw
new
ApiException
(
"smfcore.api.error"
,
"api.error: error={0},message={1},detial={2}"
,
new
String
[]{
error
.
toString
(),
message
,
detail
});
}
}
else
if
(
resultMap
==
null
){
}
else
if
(
resultMap
==
null
){
return
null
;
return
null
;
}
}
return
GetMapValue
(
key
);
}
private
<
T
>
T
GetMapValue
(
String
key
)
{
if
(
ObjectUtil
.
isEmpty
(
responseData
)
)
{
return
null
;
}
if
(
resultMap
==
null
)
{
resultMap
=
JsonUtil
.
toMap
(
responseData
);
}
if
(
resultMap
==
null
){
return
null
;
}
if
(
key
!=
null
&&
!
key
.
isEmpty
())
{
if
(
key
!=
null
&&
!
key
.
isEmpty
())
{
Object
value
=
resultMap
.
get
(
key
);
Object
value
=
resultMap
.
get
(
key
);
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
...
@@ -127,8 +129,42 @@ public class MicronResult implements Serializable {
...
@@ -127,8 +129,42 @@ public class MicronResult implements Serializable {
}
}
return
null
;
return
null
;
}
}
public
String
getDErrorMsg
(
)
throws
ApiException
{
String
errMsg
=
""
;
Object
errCode
=
-
1
;
String
detail
=
""
;
try
{
// "error": <ErrCode>,
// "message": <ErrMessage>,
// "detail": <ErrDetail>
errMsg
=
GetMapValue
(
"message"
);
if
(
ObjectUtil
.
isEmpty
(
errMsg
))
{
errMsg
=
""
;
}
else
{
errMsg
=
"message:"
+
errMsg
;
}
errCode
=
GetMapValue
(
"error"
);
if
(
ObjectUtil
.
isEmpty
(
errCode
))
{
errCode
=
""
;
}
else
{
errCode
=
"error:"
+
errCode
;
}
detail
=
GetMapValue
(
"detail"
);
if
(
ObjectUtil
.
isEmpty
(
detail
))
{
detail
=
""
;
}
else
{
detail
=
"detail:"
+
detail
;
}
return
errCode
+
";"
+
errMsg
+
";"
+
detail
;
}
catch
(
Exception
exception
)
{
log
.
error
(
"出错:"
+
exception
);
return
errCode
+
";"
+
errMsg
+
";"
+
detail
+
":"
+
exception
.
toString
();
}
}
public
<
T
>
T
getErrorValue
(
String
key
)
{
public
<
T
>
T
getErrorValue
(
String
key
)
{
if
(
resultMap
==
null
)
{
if
(
resultMap
==
null
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论