1.java后台
/** 出库入库饼状图
*/
@Override
public Map data1(WResInfo info) {
Map map = new HashMap<>();
List wResInfoList = wResInfoMapper.selectWResInfoList(info);
//入库
List collect = wResInfoList.stream().filter(s -> s.getCtState().equals("1")).collect(Collectors.toList());
map.put(String.valueOf(collect.size()), "入库");
map.put(String.valueOf(wResInfoList.size() - collect.size()), "出库");
return map;
}
/***
* 入库柱状图
* @return
*/
@Override
public Map<String, Object> data2(WResInfo info) {
Map<String, Object> map = new HashMap<>();
List<WResInfo> wResInfoList = wResInfoMapper.data2(info);
//物证名称
List<String> ctWzName = wResInfoList.stream().map(e -> e.getDictLabel()).collect(Collectors.toList());
//数量
List<String> num = wResInfoList.stream().map(e -> e.getCtOther1()).collect(Collectors.toList());
map.put("name",ctWzName );
map.put("num",num );
return map;
}
/***
* 出库柱状图
* @return
*/
@Override
public Map<String, Object> data3(WResInfo info) {
Map<String, Object> map = new HashMap<>();
List<WResInfo> wResInfoList = wResInfoMapper.data3(info);
//物证名称
List<String> ctWzName = wResInfoList.stream().map(e -> e.getDictLabel()).collect(Collectors.toList());
//数量
List<String> num = wResInfoList.stream().map(e -> e.getCtOther1()).collect(Collectors.toList());
map.put("name",ctWzName );
map.put("num",num );
return map;
}
<select id="selectWResInfoList" parameterType="WResInfo" resultMap="WResInfoResult">
<include refid="selectWResInfoVo"/>
<where>
<if test="ctWzName != null and ctWzName != ''"> and ct_wz_name like concat('%', #{ctWzName}, '%')</if>
<if test="ctState != null and ctState != ''"> and ct_state = #{ctState}</if>
<if test="ctWzType != null and ctWzType != ''"> and ct_wz_type = #{ctWzType}</if>
<if test="dtRksjDate != null "> and dt_rksj_date >= #{dtRksjDate}</if>
<if test="dtCksjDate != null "> or dt_cksj_date >= #{dtCksjDate}</if>
</where>
</select>
<select id="data2" parameterType="WResInfo" resultMap="WResInfoResult">
select
b.DICT_LABEL as dictLabel,
count(b.DICT_LABEL) as ct_other1
from w_res_info AS a left join sys_dict_data as b on a.ct_wz_type = b.dict_value and b.dict_type = 'wz_type'
<where>
<if test="dtRksjDate != null "> and a.dt_rksj_date >= #{dtRksjDate}</if>
<if test="dtCksjDate != null "> or a.dt_cksj_date >= #{dtCksjDate}</if>
and a.ct_state = '1'
group by b.DICT_LABEL
</where>
</select>
<select id="data3" parameterType="WResInfo" resultMap="WResInfoResult">
select
b.DICT_LABEL as dictLabel,
count(b.DICT_LABEL) as ct_other1
from w_res_info AS a left join sys_dict_data as b on a.ct_wz_type = b.dict_value and b.dict_type = 'wz_type'
<where>
<if test="dtRksjDate != null "> and a.dt_rksj_date >= #{dtRksjDate}</if>
<if test="dtCksjDate != null "> or a.dt_cksj_date >= #{dtCksjDate}</if>
and a.ct_state = '0'
group by b.DICT_LABEL
</where>
</select>
2.html
<!DOCTYPE html>
<div class="col-sm-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>物证出库入库统计图</h5>
</div>
<div class="ibox-content no-padding">
<div class="container-div">
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="height:600px"></div>
</div>
<div th:include="include :: footer"></div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>物证入库分类统计图</h5>
</div>
<div class="ibox-content no-padding">
<div class="container-div">
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main2" style="height:600px"></div>
</div>
<div th:include="include :: footer"></div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>物证出库分类统计图</h5>
</div>
<div class="ibox-content no-padding">
<div class="container-div">
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main3" style="height:600px"></div>
</div>
<div th:include="include :: footer"></div>
</div>
</div>
</div>
3.截图