Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
Aidea
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sa_aidea
Aidea
Commits
a5b7f6df
Commit
a5b7f6df
authored
Aug 23, 2021
by
马超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(微问诊): 修复data返回结果不是json对象时,代码报错的问题
parent
2dc0b392
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
CdfortisServiceImpl.java
...com/cftech/cdfortis/service/impl/CdfortisServiceImpl.java
+16
-13
CdfortisResponseUtil.java
...n/java/com/cftech/cdfortis/util/CdfortisResponseUtil.java
+2
-2
No files found.
aidea-modules/prescription-module/src/main/java/com/cftech/cdfortis/service/impl/CdfortisServiceImpl.java
View file @
a5b7f6df
...
@@ -77,20 +77,23 @@ public class CdfortisServiceImpl implements CdfortisService {
...
@@ -77,20 +77,23 @@ public class CdfortisServiceImpl implements CdfortisService {
param
.
put
(
"drugInfo"
,
cdfortisDrugList
);
param
.
put
(
"drugInfo"
,
cdfortisDrugList
);
RequestBody
body
=
RequestBody
.
create
(
MEDIA_TYPE_JSON
,
param
.
toJSONString
());
RequestBody
body
=
RequestBody
.
create
(
MEDIA_TYPE_JSON
,
param
.
toJSONString
());
// 请求获取数据
// 请求获取数据
JSON
Object
data
=
CdfortisResponseUtil
.
request
(
uploadUrl
,
CdfortisConstant
.
METHOD_POST
,
Object
data
=
CdfortisResponseUtil
.
request
(
uploadUrl
,
CdfortisConstant
.
METHOD_POST
,
null
,
null
,
body
,
rtnJson
);
null
,
null
,
body
,
rtnJson
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
return
rtnJson
;
return
rtnJson
;
}
}
// 判断数据是否正确
boolean
isAllSuccess
=
data
.
getBooleanValue
(
"isAllSuccess"
);
if
(
data
instanceof
JSONObject
)
{
if
(!
isAllSuccess
)
{
JSONObject
dataJsonObj
=
(
JSONObject
)
data
;
JSONArray
failedDataArr
=
data
.
getJSONArray
(
"failedData"
);
boolean
isAllSuccess
=
dataJsonObj
.
getBooleanValue
(
"isAllSuccess"
);
//TODO 更新药物上传状态
if
(!
isAllSuccess
)
{
JSONArray
failedDataArr
=
dataJsonObj
.
getJSONArray
(
"failedData"
);
rtnJson
.
put
(
"errorNo"
,
"0"
);
//TODO 更新药物上传状态
rtnJson
.
put
(
"data"
,
failedDataArr
);
return
rtnJson
;
rtnJson
.
put
(
"errorNo"
,
"0"
);
rtnJson
.
put
(
"data"
,
failedDataArr
);
return
rtnJson
;
}
}
}
rtnJson
.
put
(
"errorNo"
,
"0"
);
rtnJson
.
put
(
"errorNo"
,
"0"
);
...
@@ -126,7 +129,7 @@ public class CdfortisServiceImpl implements CdfortisService {
...
@@ -126,7 +129,7 @@ public class CdfortisServiceImpl implements CdfortisService {
urlParam
.
put
(
"startTime"
,
startTime
);
urlParam
.
put
(
"startTime"
,
startTime
);
urlParam
.
put
(
"endTime"
,
endTime
);
urlParam
.
put
(
"endTime"
,
endTime
);
// 请求获取数据
// 请求获取数据
JSON
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiListUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiListUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
null
,
null
,
rtnJson
);
null
,
null
,
rtnJson
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
return
rtnJson
;
return
rtnJson
;
...
@@ -156,7 +159,7 @@ public class CdfortisServiceImpl implements CdfortisService {
...
@@ -156,7 +159,7 @@ public class CdfortisServiceImpl implements CdfortisService {
urlParam
.
put
(
"token"
,
cdfortisTokenUtil
.
getToken
());
urlParam
.
put
(
"token"
,
cdfortisTokenUtil
.
getToken
());
urlParam
.
put
(
"presId"
,
presId
);
urlParam
.
put
(
"presId"
,
presId
);
// 请求获取数据
// 请求获取数据
JSON
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiInfoUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiInfoUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
null
,
null
,
rtnJson
);
null
,
null
,
rtnJson
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
return
rtnJson
;
return
rtnJson
;
...
@@ -186,7 +189,7 @@ public class CdfortisServiceImpl implements CdfortisService {
...
@@ -186,7 +189,7 @@ public class CdfortisServiceImpl implements CdfortisService {
urlParam
.
put
(
"token"
,
cdfortisTokenUtil
.
getToken
());
urlParam
.
put
(
"token"
,
cdfortisTokenUtil
.
getToken
());
urlParam
.
put
(
"presId"
,
presId
);
urlParam
.
put
(
"presId"
,
presId
);
// 请求获取数据
// 请求获取数据
JSON
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiPicUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
Object
data
=
CdfortisResponseUtil
.
request
(
getFbusiPicUrl
,
CdfortisConstant
.
METHOD_GET
,
urlParam
,
null
,
null
,
rtnJson
);
null
,
null
,
rtnJson
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
return
rtnJson
;
return
rtnJson
;
...
...
aidea-modules/prescription-module/src/main/java/com/cftech/cdfortis/util/CdfortisResponseUtil.java
View file @
a5b7f6df
...
@@ -56,7 +56,7 @@ public class CdfortisResponseUtil {
...
@@ -56,7 +56,7 @@ public class CdfortisResponseUtil {
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
public
static
JSON
Object
request
(
String
url
,
String
method
,
Map
<
String
,
String
>
queryParams
,
Map
<
String
,
String
>
headers
,
RequestBody
body
,
JSONObject
rtnJson
)
throws
Exception
{
public
static
Object
request
(
String
url
,
String
method
,
Map
<
String
,
String
>
queryParams
,
Map
<
String
,
String
>
headers
,
RequestBody
body
,
JSONObject
rtnJson
)
throws
Exception
{
HttpUrl
.
Builder
urlBuild
=
HttpUrl
.
parse
(
url
).
newBuilder
();
HttpUrl
.
Builder
urlBuild
=
HttpUrl
.
parse
(
url
).
newBuilder
();
// 处理query参数
// 处理query参数
if
(
queryParams
!=
null
)
{
if
(
queryParams
!=
null
)
{
...
@@ -92,7 +92,7 @@ public class CdfortisResponseUtil {
...
@@ -92,7 +92,7 @@ public class CdfortisResponseUtil {
JSONObject
retObj
=
JSONObject
.
parseObject
(
retStr
);
JSONObject
retObj
=
JSONObject
.
parseObject
(
retStr
);
// 插件结果
// 插件结果
checkResponse
(
retObj
);
checkResponse
(
retObj
);
return
retObj
.
get
JSONObject
(
"data"
);
return
retObj
.
get
(
"data"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Exception
(
e
.
getMessage
());
throw
new
Exception
(
e
.
getMessage
());
}
}
...
...
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