Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
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
platform
hp-smart
Commits
849ca138
Commit
849ca138
authored
Feb 21, 2024
by
wancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报屏页面优化
parent
8af6de4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
468 additions
and
5 deletions
+468
-5
ServiceHPBI001.java
.../java/com/baosight/hpjx/hp/bi/service/ServiceHPBI001.java
+468
-5
No files found.
src/main/java/com/baosight/hpjx/hp/bi/service/ServiceHPBI001.java
View file @
849ca138
package
com
.
baosight
.
hpjx
.
hp
.
bi
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baosight.eplat.be.dz.constants.BEDZConstants
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
...
...
@@ -15,15 +19,15 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.MapUtils
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
static
com
.
baosight
.
eplat
.
be
.
dz
.
service
.
ServiceBEDZ04
.
PARAMS_KEY_STR
;
/**
* @author wancheng
...
...
@@ -83,7 +87,7 @@ public class ServiceHPBI001 extends ServiceBase {
}
/**
* 查询
操作
* 查询
CompanyCode
*
* @param inInfo
* @return
...
...
@@ -102,4 +106,463 @@ public class ServiceHPBI001 extends ServiceBase {
}
return
outInfo
;
}
/**
* 查询报屏模块show14
*
* @param inInfo
* @return
*/
public
EiInfo
queryZLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"22f02674b4b9448782b019686ce9c780"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"22f02674b4b9448782b019686ce9c780"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"DATE"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show14"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show17
*
* @param inInfo
* @return
*/
public
EiInfo
queryXMinfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"903f232398d44b8da7c5492434ce746f"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"903f232398d44b8da7c5492434ce746f"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"项目名称,计划完成时间,计划产量,实际产量,进度"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"项目名称"
));
datalist
.
add
(
obj
.
get
(
"计划完成时间"
));
datalist
.
add
(
obj
.
get
(
"计划产量"
));
datalist
.
add
(
obj
.
get
(
"实际产量"
));
datalist
.
add
(
obj
.
get
(
"进度"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show17"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show21
*
* @param inInfo
* @return
*/
public
EiInfo
queryRJCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"d5008eb93eac4d63b2fc0f1323683078"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"d5008eb93eac4d63b2fc0f1323683078"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show21"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show7
*
* @param inInfo
* @return
*/
public
EiInfo
queryYCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"05e22350db614c95b0e254aa38c81db2"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"05e22350db614c95b0e254aa38c81db2"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show7"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show6
*
* @param inInfo
* @return
*/
public
EiInfo
queryHAPlanInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"HA_PLAN_WT,HP_PLAN_WT,HA_FACT_WT,HP_FACT_WT,HA_VOLUME_UP,HP_VOLUME_UP,BFB"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"HA_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"HP_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"HP_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"HP_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"BFB"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show9
*
* @param inInfo
* @return
*/
public
EiInfo
queryMonWtInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"530ad899d9f64c4383da7c61a6fb1562"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
Map
user_params
=
new
HashMap
();
user_params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
List
<
Map
>
company_codes
=
super
.
dao
.
query
(
"HPBI001.queryCompanyCode"
,
user_params
);
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
().
trim
())){
company_code
=
company_codes
.
get
(
0
).
get
(
"COMPANY_CODE"
).
toString
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"530ad899d9f64c4383da7c61a6fb1562"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"MON_PLAN_WT,MON_FACT_WT,VOLUME_UP"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"MON_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"MON_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"VOLUME_UP"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 微服务测试方法(柱形图、折线图、饼图)
* 微服务号:S_BE_DZ_04
*
* @return
*/
public
EiInfo
queryMicroServiceBarData
(
EiInfo
eiInfo
)
{
EiInfo
returnInfo
=
new
EiInfo
();
String
paramsStr
=
eiInfo
.
getString
(
PARAMS_KEY_STR
);
if
(
StringUtils
.
isEmpty
(
paramsStr
))
{
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_FAILURE
);
returnInfo
.
setMsg
(
"获取测试数据失败,原因为:参数不能为空!"
);
return
returnInfo
;
}
String
[]
jsonStrs
=
new
String
[]{
"appEname,date,unitCover&"
+
"xdata-show,1月,50&dataworks-admin,1月,100&dataworks-market,1月,160&*"
+
"xdata-show,2月,60&dataworks-admin,2月,150&dataworks-market,2月,80&*"
+
"xdata-show,3月,80&dataworks-admin,3月,50&dataworks-market,3月,60&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,100&*"
+
"xdata-show,5月,30&dataworks-admin,5月,80&dataworks-market,5月,60&*"
+
"xdata-show,6月,20&dataworks-admin,6月,30&dataworks-market,6月,50"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,90&dataworks-admin,1月,20&dataworks-market,1月,60&*"
+
"xdata-show,2月,70&dataworks-admin,2月,50&dataworks-market,2月,70&*"
+
"xdata-show,3月,60&dataworks-admin,3月,60&dataworks-market,3月,65&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,90&*"
+
"xdata-show,5月,20&dataworks-admin,5月,80&dataworks-market,5月,80&*"
+
"xdata-show,6月,50&dataworks-admin,6月,90&dataworks-market,6月,70"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,80&dataworks-admin,1月,30&dataworks-market,1月,90&*"
+
"xdata-show,2月,10&dataworks-admin,2月,100&dataworks-market,2月,10&*"
+
"xdata-show,3月,180&dataworks-admin,3月,150&dataworks-market,3月,45&*"
+
"xdata-show,4月,100&dataworks-admin,4月,170&dataworks-market,4月,40&*"
+
"xdata-show,5月,66&dataworks-admin,5月,80&dataworks-market,5月,180&*"
+
"xdata-show,6月,80&dataworks-admin,6月,90&dataworks-market,6月,40"
,
"appEname,date,unitCover&"
,
""
};
JSONArray
jsonArr
=
JSONArray
.
parseArray
(
paramsStr
);
List
items
=
new
ArrayList
<>();
for
(
int
index
=
0
;
index
<
jsonArr
.
size
();
index
++)
{
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
index
);
JSONObject
testDataObj
=
jsonObject
.
getJSONObject
(
"params"
);
JSONObject
item
=
new
JSONObject
();
if
(
testDataObj
.
size
()
==
0
||
!
testDataObj
.
containsKey
(
"month"
))
{
item
.
put
(
"data"
,
new
JSONArray
());
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
items
.
add
(
item
);
continue
;
}
String
monthStr
=
testDataObj
.
getString
(
"month"
);
if
(
StringUtils
.
isNotEmpty
(
monthStr
))
{
int
month
=
Integer
.
parseInt
(
monthStr
);
Random
ran
=
new
Random
();
int
x
=
ran
.
nextInt
(
4
);
String
contentStr
=
jsonStrs
[
x
];
String
[]
monthDataStr
=
contentStr
.
split
(
"\\*"
);
if
(
month
>
monthDataStr
.
length
)
{
month
=
monthDataStr
.
length
;
}
StringBuilder
resultStr
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
month
;
i
++)
{
resultStr
.
append
(
monthDataStr
[
i
]);
}
JSONArray
tempArr
=
new
JSONArray
();
String
[]
contentStrArray
=
resultStr
.
toString
().
split
(
"&"
);
for
(
int
i
=
0
;
i
<
contentStrArray
.
length
;
i
++)
{
String
tempContentStr
=
contentStrArray
[
i
];
List
tempContentList
=
Arrays
.
asList
(
tempContentStr
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
}
item
.
put
(
"data"
,
tempArr
);
}
else
{
String
json
=
"appEname,date,unitCover"
;
JSONArray
tempArr
=
new
JSONArray
();
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
item
.
put
(
"data"
,
tempArr
);
}
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
item
.
put
(
"component"
,
jsonObject
.
get
(
"component"
));
items
.
add
(
item
);
}
returnInfo
.
set
(
"result"
,
items
);
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_SUCCESS
);
returnInfo
.
setMsg
(
"获取测试数据成功!"
);
return
returnInfo
;
}
}
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