📄 statisticsdepartmentbean.java
字号:
/*$Id: StatisticsDepartmentBean.java,v 1.1 2008/07/15 03:38:23 liqi Exp $ *-------------------------------------- * Apusic (Kingdee Middleware) *--------------------------------------- * Copyright By Apusic ,All right Reserved * author date comment * chenhongxin 2008-4-14 Created*/package org.operamasks.example.ejb.hr.litebean.module;import java.util.ArrayList;import java.util.List;import org.operamasks.example.ejb.hr.entity.Department;import org.operamasks.example.ejb.hr.service.ServiceBean;import org.operamasks.faces.annotation.ManagedBean;import org.operamasks.faces.annotation.ManagedBeanScope;import org.operamasks.faces.annotation.ManagedProperty;/** * 部门培训统计页面的托管Bean * @author chenhongxin */@ManagedBean(name="module.statisticsDepartmentBean", scope=ManagedBeanScope.SESSION)public class StatisticsDepartmentBean extends BeforeRenderBaseBean { /** * 注入服务提供Bean,该Bean提供各种的业务操作对象 */ @ManagedProperty("#{serviceBean}") private ServiceBean service; /** * 合计数据 */ private Total total; /** * 获取部门培训统计的数据结果集 * @return 部门培训统计的数据结果集 */ public List<ReportData> getData() { //获取“部门统计的基础数据” List<Object[]> result = service.getTrainService().getDepartmentReport(); return transResult(result); } /** * 将“部门统计的基础数据”进行转换封装成“部门培训统计的数据结果集” * @param result 部门统计的基础数据 * @return 部门培训统计的数据结果集 */ private List<ReportData> transResult(List<Object[]> result) { total = new Total(); List<ReportData> datas = new ArrayList<ReportData>(); for(Object[] rec : result) { Department dep = (Department)rec[0]; ReportData data = new ReportData(); data.setName(dep.getName()); // 部门名称 data.setTotalEmployee(Integer.valueOf(rec[1].toString())); // 部门总培训员工人次 total.setTotalEmployee(total.getTotalEmployee() + data.getTotalEmployee()); // 合计所有部门总培训员工人次 data.setTotalPeriod(Integer.valueOf(rec[2].toString())); // 部门总培训课时 total.setTotalPeriod(total.getTotalPeriod() + data.getTotalPeriod()); // 合计所有部门总培训课时 data.setDistinctEmployee(Integer.valueOf(rec[3].toString())); // 部门总培训员工人数 total.setDistinctEmployee(total.getDistinctEmployee() + data.getDistinctEmployee()); // 合计所有部门总培训员工人数 data.setCurEmployee(dep.getEmployees().size()); // 部门总员工数 total.setCurEmployee(total.getCurEmployee() + data.getCurEmployee()); // 合计所有部门总员工数 datas.add(data); } return datas; } /** * 获取合计数据 * @return 合计数据 */ public Total getTotal() { if(total == null) return new Total(); return total; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -