JfreeChar创建人力资源管理系统数据统计图表
导入下面的包
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
import com.opensymphony.xwork2.ActionSupport;
import com.wepull.hrms.biz.ChannelBiz;
import com.wepull.hrms.biz.DataCountBiz;
import com.wepull.hrms.dto.ChannelDto;
import com.wepull.hrms.dto.ChannelTypeDto;
/**
* 数据统计模块action层
* @author $KangMiao$
*/
public class DataCountAction extends ActionSupport{
private DataCountBiz dataCountBiz = null;
private ChannelBiz channelBiz = null;
public void setDataCountBiz(DataCountBiz dataCountBiz) {
this.dataCountBiz = dataCountBiz;
}
public void setChannelBiz(ChannelBiz channelBiz) {
this.channelBiz = channelBiz;
}
/*******************************************************/
private List<ChannelDto> channelList = new ArrayList<ChannelDto>();
public List<ChannelTypeDto> typeList = new ArrayList<ChannelTypeDto>();
private ChannelDto channelDto = new ChannelDto();
/**统计某渠道 某种状态的简历数*/
public String channelCount() throws IOException{
typeList = channelBiz.findChannelType();
List<ChannelDto> list = channelBiz.findChannel();
int resumeCount=0,num1=0,num2=0,num3=0,num4=0,num5=0;
if(channelList.size()!=0) channelList.clear();
for ( ChannelDto dto: list) {
resumeCount = dataCountBiz.countChannelResume(dto.getId()); //某渠道简历总数
num1 = dataCountBiz.countResumeView(dto.getId(), 2); //基本合格数
num2 = dataCountBiz.countResumeView(dto.getId(), 3); //专员面试合格数
num3 = dataCountBiz.countResumeView(dto.getId(), 4); //需求负责任面试合格数
num4 = dataCountBiz.countResumeView(dto.getId(), 5); //客户面试合格数
num5 = dataCountBiz.countResumeView(dto.getId(), 6); //实际到岗人数
int[] count = new int[6];
count[0] = resumeCount;
count[1] = num1;
count[2] = num2;
count[3] = num3;
count[4] = num4;
count[5] = num5;
dto.setCount(count);
channelList.add(dto);
}
barChar();
return SUCCESS;
}
/**生成渠道类型简历数据统计柱状图*/
public void barChar() throws IOException{
CategoryDataset dataset = getDataSet();
JFreeChart chart = ChartFactory.createBarChart3D(
"渠道类型简历数据统计图", // 图表标题
"渠道类型", // 目录轴的显示标签
"简历数量", // 数值轴的显示标签
dataset, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平、垂直
true, // 是否显示图例(对于简单的柱状图必须是false)
false, // 是否生成工具
false // 是否生成URL链接
);
FileOutputStream fos_jpg = null;
try {
String projectRealPath= ServletActionContext.getServletContext().getRealPath("/"); //获得工程路径
String imagePath = projectRealPath+"images/dataCount.jpg";
System.out.println("图片路径3:-----------------------"+imagePath);
fos_jpg = new FileOutputStream(imagePath);
ChartUtilities.writeChartAsJPEG(fos_jpg,1,chart,900,400,null);
} finally {
try {
fos_jpg.close();
} catch (Exception e) {}
}
}
/**统计渠道类别的简历数据*/
public CategoryDataset getDataSet(){
String[] typeName = {"合作伙伴","培训公司","招聘网","猎头公司","高等院校","中介公司","其他"};
String[] dataName = {"简历总数","基本合格","专员面试合格","需求面试合格","客户面试合格","实际到岗人数"};
int[] type1 = {0,0,0,0,0,0}; //合作伙伴类型
int[] type2 = {0,0,0,0,0,0}; //培训公司类型
int[] type3 = {0,0,0,0,0,0}; //招聘网类型
int[] type4 = {0,0,0,0,0,0}; //猎头公司类型
int[] type5 = {0,0,0,0,0,0}; //高等院校类型
int[] type6 = {0,0,0,0,0,0}; //中介公司类型
int[] type7 = {0,0,0,0,0,0}; //其他类型
for (ChannelDto dto : channelList) {
if (dto.getChannelTypeId() != null) {
// 获得合作伙伴类型的数据
if (dto.getChannelTypeId() == 3) {
type1 = getData(type1, dto);
}
// 获得培训公司类型的数据
else if (dto.getChannelTypeId() == 4) {
type2 = getData(type2, dto);
}
// 获得招聘网类型的数据
else if (dto.getChannelTypeId() == 22) {
type3 = getData(type3, dto);
}
// 获得中介公司类型的数据
else if (dto.getChannelTypeId() == 39) {
type4 = getData(type4, dto);
}
// 获得猎头公司类型的数据
else if (dto.getChannelTypeId() == 23) {
type5 = getData(type5, dto);
}
// 获得高等院校类型的数据
else if (dto.getChannelTypeId() == 37) {
type6 = getData(type6, dto);
}
// 获得其他类型的数据
else if (dto.getChannelTypeId() == 41) {
type7 = getData(type7, dto);
}
}
}
//生成柱状图
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset = setData(dataset,type1,typeName[0],dataName);
dataset = setData(dataset,type2,typeName[1],dataName);
dataset = setData(dataset,type3,typeName[2],dataName);
dataset = setData(dataset,type4,typeName[3],dataName);
dataset = setData(dataset,type5,typeName[4],dataName);
dataset = setData(dataset,type6,typeName[5],dataName);
dataset = setData(dataset,type7,typeName[6],dataName);
return dataset;
}
/**获得渠道类型的各种数据*/
public int[] getData(int[] type,ChannelDto dto){
type[0]=type[0]+dto.getCount()[0]; //获得简历总数
type[1]=type[1]+dto.getCount()[1]; //获得基本合格数
type[2]=type[2]+dto.getCount()[2]; //获得专员面试合格数
type[3]=type[3]+dto.getCount()[3]; //获得需求负责任面试合格数
type[4]=type[4]+dto.getCount()[4]; //获得客户面试合格数
type[5]=type[5]+dto.getCount()[5]; //获得实际到岗人数
return type;
}
public DefaultCategoryDataset setData(DefaultCategoryDataset dataset,int[] type,
String typeName,String[] dataName) {
dataset.addValue(type[0], dataName[0], typeName);
dataset.addValue(type[1], dataName[1], typeName);
dataset.addValue(type[2], dataName[2], typeName);
dataset.addValue(type[3], dataName[3], typeName);
dataset.addValue(type[4], dataName[4], typeName);
dataset.addValue(type[5], dataName[5], typeName);
return dataset;
}
public static String fomat(float num){
DecimalFormat df = new DecimalFormat("XXXX.0");
System.out.println(df.format(num));
return df.format(num);
}
/**查询某时间段渠道简历数*/
public String findByTime() throws IOException{
HttpServletRequest request = ServletActionContext.getRequest();
//判断 页面传的条件
String beginTime = request.getParameter("beginTime");
String endTime = request.getParameter("endTime");
typeList = channelBiz.findChannelType();
List<ChannelDto> list = channelBiz.findChannel();
int resumeCount=0,num1=0,num2=0,num3=0,num4=0,num5=0;
if(channelList.size()!=0) channelList.clear();
for ( ChannelDto dto: list) {
resumeCount = dataCountBiz.countChannelTime(dto.getId(), beginTime, endTime); //某时间段渠道简历总数
num1 = dataCountBiz.countByTime(dto.getId(), 2, beginTime, endTime); //基本合格数
num2 = dataCountBiz.countByTime(dto.getId(), 3, beginTime, endTime); //专员面试合格数
num3 = dataCountBiz.countByTime(dto.getId(), 4, beginTime, endTime); //需求负责任面试合格数
num4 = dataCountBiz.countByTime(dto.getId(), 5, beginTime, endTime); //客户面试合格数
num5 = dataCountBiz.countByTime(dto.getId(), 6, beginTime, endTime); //实际到岗人数
int[] count = new int[6];
count[0] = resumeCount;
count[1] = num1;
count[2] = num2;
count[3] = num3;
count[4] = num4;
count[5] = num5;
dto.setCount(count);
channelList.add(dto);
}
request.setAttribute("beginTime", beginTime);
request.setAttribute("endTime", endTime);
barChar();
return "data";
}
/************************************/
public ChannelDto getChannelDto() {
return channelDto;
}
public void setChannelDto(ChannelDto channelDto) {
this.channelDto = channelDto;
}
public List<ChannelDto> getChannelList() {
return channelList;
}
public void setChannelList(List<ChannelDto> channelList) {
this.channelList = channelList;
}
}
分享到:
相关推荐
人力资源管理系统是这样的一种管理软件,它能够快速、方便地显示结果,还可以对有关工资的各种信息进行统计,服务于财务部门及公司主要管理者。
用Rational Rose 2007制作的,关于“人力资源管理系统HRMS”的类图、用例图、状态图、顺序图,本人亲自制作,吸取各家,特此上传!
sdfasdfasdfdasdfasdfaf asdfasdfsafasfdasdfasdfsadfasdf
人力资源管理系统HRMS实践报告.pdf
hrms managemnet project
某公司人力资源管理系统HRMS方案介绍.pptx
IPL HRMS人力资源管理系统是由香港IPL Research Ltd.和上海商络软件有限公司开发的专业人力资源管理系统。致力为用户提供最优的人力资源管理系统。由上海商络软件有限公司负责IPL HRMS在中国大陆地区的开发、销售和...
Oracle HRMS常用接口开发与项目实践
java开发的HRMS(Human Resource Management System)是人力资源管理的一个发展方向,人力资源管理系统从系统学理论的角度对人力资源管理进行阐释,注重在人力资源管理的各个方面的系统规划、设计运作,并在企业管理...
一個HRMS系統實例的安裝文件,welcome to you download
2014最近做好的学期项目hr 带数据 JSP页面 完全能运行 带有完整的libs jar包 J2EE SSH Ajax easyUI 带有上传功能 自动菜单生成 登录验证 员工管理 薪资管理 培训管理 招聘管理 等等
此系统整体采用struts1.2+spring2.5+Ibatis框架实现,数据源利用的是SpringIoC注入;模型层严格按照JavaBean规范要求;用Struts进行流程的控制,并实现了国际化,JSP用纯标签进行页面显示。为达到用户名唯一的目的...
HRMS is human resource manager application source code for free. u can use and distribute is as you wish.
HRMS(Human Resource Managent System)是人力资源管理的一个发展方向,人力资源管理系统从系统学理论的角度对人力资源管理进行阐释,注重在人力资源管理的各个方面的系统规划、设计运作,并在企业管理管理中持续...
hrms ADASDASDSADSADSAD
人力资源管理系统,本系统实现了以下功能:系统界面设计美观、友好;智能化程度高、操作灵活、方便;系统运行稳定、安全可靠;反应快速、计算准确;实现新员工入职登记、查询修改及入职合同的录入、编辑;...
用PHP开发的人事管理系统源代码,可以挂接到OA系统中使用,特点是:速度快,可以挂接相片等。
oracle HRMS 懂得人应该知道它的价值!
Its a project on JSP