更新
1.统计接口返回折线和柱状图的总和
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -50,9 +51,9 @@ public class DrugHandingOverStatisticServiceImpl implements DrugHandingOverStati
|
||||
*/
|
||||
@Override
|
||||
public DrugStatisticVO statistic(DrugStatisticQuery query) {
|
||||
List<List<Object>> lineChartData = buildLineChartData(query);
|
||||
List<List<Object>> barChartData = buildBarChartData(query);
|
||||
DrugStatisticVO drugStatisticVO = new DrugStatisticVO();
|
||||
List<List<Object>> lineChartData = buildLineChartData(query, drugStatisticVO);
|
||||
List<List<Object>> barChartData = buildBarChartData(query, drugStatisticVO);
|
||||
drugStatisticVO.setBarChartDataList(barChartData);
|
||||
drugStatisticVO.setLineChartDataList(lineChartData);
|
||||
return drugStatisticVO;
|
||||
@@ -60,10 +61,12 @@ public class DrugHandingOverStatisticServiceImpl implements DrugHandingOverStati
|
||||
|
||||
/**
|
||||
* 构建柱状图的数据
|
||||
*
|
||||
* @param query
|
||||
* @param drugStatisticVO
|
||||
* @return
|
||||
*/
|
||||
private List<List<Object>> buildBarChartData(DrugStatisticQuery query) {
|
||||
private void buildBarChartData(DrugStatisticQuery query, DrugStatisticVO drugStatisticVO) {
|
||||
List<List<Object>> barChartData = new ArrayList<>();
|
||||
List<Object> orgNameList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
@@ -95,21 +98,26 @@ public class DrugHandingOverStatisticServiceImpl implements DrugHandingOverStati
|
||||
List<DrugMaterialInfoVO> voList = groupByHandingOverOrgMap.get(orgId);
|
||||
if (CollUtil.isNotEmpty(voList)) {
|
||||
orgNameList.add(sysOrg.getAlias());
|
||||
dataList.add(voList.size());
|
||||
int size = voList.size();
|
||||
dataList.add(size);
|
||||
}
|
||||
});
|
||||
|
||||
barChartData.add(orgNameList);
|
||||
barChartData.add(dataList);
|
||||
return barChartData;
|
||||
drugStatisticVO.setBarChartDataSum(dataList.stream().mapToInt(obj -> (Integer) obj).sum());
|
||||
drugStatisticVO.setBarChartDataList(barChartData);
|
||||
// return barChartData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建折线图的数据
|
||||
*
|
||||
* @param query
|
||||
* @param drugStatisticVO
|
||||
* @return
|
||||
*/
|
||||
private List<List<Object>> buildLineChartData(DrugStatisticQuery query) {
|
||||
private void buildLineChartData(DrugStatisticQuery query, DrugStatisticVO drugStatisticVO) {
|
||||
List<List<Object>> lineChartData = new ArrayList<>(); // 存储结果值
|
||||
List<Object> monthsList = new ArrayList<>(); // 存储月份
|
||||
List<Object> dataList = new ArrayList<>(); // 对应月份送缴的数量
|
||||
@@ -143,7 +151,8 @@ public class DrugHandingOverStatisticServiceImpl implements DrugHandingOverStati
|
||||
}
|
||||
lineChartData.add(monthsList);
|
||||
lineChartData.add(dataList);
|
||||
return lineChartData;
|
||||
drugStatisticVO.setLineChartDataSum(dataList.stream().mapToInt(obj -> (Integer) obj).sum());
|
||||
drugStatisticVO.setLineChartDataList(lineChartData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,12 +13,22 @@ public class DrugStatisticVO {
|
||||
@ApiModelProperty(value = "折线图数据")
|
||||
private List<List<Object>> lineChartDataList;
|
||||
|
||||
@ApiModelProperty(value = "折线图数据的总和")
|
||||
private Integer lineChartDataSum;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "柱状图数据")
|
||||
private List<List<Object>> barChartDataList;
|
||||
|
||||
@ApiModelProperty(value = "柱状图数据的总和")
|
||||
private Integer barChartDataSum;
|
||||
|
||||
@ApiModelProperty(value = "饼图数据")
|
||||
private List<List<Object>> pieChartDataList;
|
||||
|
||||
@ApiModelProperty(value = "饼图数据的总和")
|
||||
private Integer pieChartDataSum;
|
||||
|
||||
@ApiModelProperty(value = "树状图数据")
|
||||
private String treeChartDateList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user