package com.two.studentRoll.service.impl;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.my.ms.framework.persistence.hibernate.IBaseDao;
import com.my.ms.framework.persistence.model.Page;
import com.two.studentRoll.model.Classes;
import com.two.studentRoll.model.Degree;
import com.two.studentRoll.model.Student;
import com.two.studentRoll.service.IClassService;
import com.two.studentRoll.service.IStudentService;
/**
* 学生
*
* @author The bird is my most loving smile
* @version 1.0
* @updated 19-二月-2014 20:46:09
*
*/
@Service("studentService")
@Transactional(readOnly = true)
public class StudentServiceImpl implements IStudentService {
@Resource(name = "ClassService")
private IClassService classService;
@Resource
private IBaseDao dao;
// 用来输出日志
private static final Logger LOG = LoggerFactory
.getLogger(StudentServiceImpl.class);
@Override
@Transactional(readOnly = false)
public void addStudent(Student student, int classId, int degreeId) {
Degree degree = dao.queryEntityById(Degree.class, degreeId);
Classes classes = dao.queryEntityById(Classes.class, classId);
student.setDegree(degree);
student.setCla(classes);
dao.addEntity(student);
}
@Override
public void exportStudentBasic(Map<String, Object> outPutMap,
OutputStream out, InputStream templateFile) {
String fileName = (String) outPutMap.get("fileName");
int classId = (Integer) outPutMap.get("classId");
String className = (String) outPutMap.get("className");
List<Student> list = dao.queryEntitys("from Student where cla.id=? ",
new Object[] { classId });
this.outputString(list, className, fileName, out, templateFile);
}
@SuppressWarnings("deprecation")
public void outputString(List<Student> list, String className,
String filteName, OutputStream out, InputStream templateFile) {
HSSFWorkbook wb;
try {
wb = new HSSFWorkbook(templateFile);
HSSFSheet sheet = wb.getSheetAt(0);
// 设置标题
sheet.getRow(0).getCell(0).setCellValue(className + "学生信息表");
// 取得模板行数据
HSSFRow templateRow = sheet.getRow(2);
int startRow = 2;
for (Student s : list) {
HSSFRow row = sheet.createRow(startRow);
// ID
HSSFCell cell_id = row.createCell(0);
cell_id.setCellStyle(templateRow.getCell(0).getCellStyle());
cell_id.setCellValue(s.getId());
// 学生姓名
HSSFCell cell_name = row.createCell(1);
cell_name.setCellStyle(templateRow.getCell(1).getCellStyle());
cell_name.setCellValue(s.getName());
// 学生性别
HSSFCell cell_sex = row.createCell(2);
cell_sex.setCellStyle(templateRow.getCell(2).getCellStyle());
cell_sex.setCellValue(s.getSex());
// 学生年龄
HSSFCell cell_age = row.createCell(3);
cell_age.setCellStyle(templateRow.getCell(3).getCellStyle());
cell_age.setCellValue(s.getAge());
// 学生报名编号
HSSFCell cell_code = row.createCell(4);
cell_code.setCellStyle(templateRow.getCell(4).getCellStyle());
cell_code.setCellValue(s.getSchoolStartCode());
// 学生报名时间
HSSFCell cell_stadeTime = row.createCell(5);
cell_stadeTime.setCellStyle(templateRow.getCell(5)
.getCellStyle());
cell_stadeTime.setCellValue(new SimpleDateFormat("yyyy-mm-dd")
.format(s.getSchoolStartTime()));
// 学生所在班级
HSSFCell cell_classes = row.createCell(6);
cell_classes
.setCellStyle(templateRow.getCell(6).getCellStyle());
cell_classes.setCellValue(s.getCla().getClassName());
// 计算机程度
HSSFCell cell_computerKnow = row.createCell(7);
cell_computerKnow.setCellStyle(templateRow.getCell(7)
.getCellStyle());
cell_computerKnow.setCellValue(s.getComputerKnow());
// 毕业学院
HSSFCell cell_graduateSchool = row.createCell(8);
cell_graduateSchool.setCellStyle(templateRow.getCell(8)
.getCellStyle());
cell_graduateSchool.setCellValue(s.getGraduateSchool());
// 身份证号
HSSFCell cell_iDcard = row.createCell(9);
cell_iDcard.setCellStyle(templateRow.getCell(9).getCellStyle());
cell_iDcard.setCellValue(s.getiDcard());
// 专业
HSSFCell cell_major = row.createCell(10);
cell_major.setCellStyle(templateRow.getCell(10).getCellStyle());
cell_major.setCellValue(s.getMajor());
// 家长电话
HSSFCell cell_partentPhone = row.createCell(11);
cell_partentPhone.setCellStyle(templateRow.getCell(11)
.getCellStyle());
cell_partentPhone.setCellValue(s.getPartentPhone());
// 学生电话
HSSFCell cell_studentPhone = row.createCell(12);
cell_studentPhone.setCellStyle(templateRow.getCell(12)
.getCellStyle());
cell_studentPhone.setCellValue(s.getStudentPhone());
// 信产部考试
HSSFCell cell_seTest = row.createCell(13);
cell_seTest
.setCellStyle(templateRow.getCell(13).getCellStyle());
cell_seTest.setCellValue(s.getSeTest());
// 是否住宿
HSSFCell cell_isDormitory = row.createCell(14);
cell_isDormitory.setCellStyle(templateRow.getCell(14)
.getCellStyle());
cell_isDormitory.setCellValue(s.getIsDormitory());
// 学历
HSSFCell cell_degree = row.createCell(15);
cell_degree
.setCellStyle(templateRow.getCell(15).getCellStyle());
cell_degree.setCellValue(s.getDegree().getDegreeName());
// 备注
HSSFCell cell_remark = row.createCell(16);
cell_remark
.setCellStyle(templateRow.getCell(16).getCellStyle());
cell_remark.setCellValue(s.getRemark());
startRow = startRow + 1;
}
wb.write(out);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public Student findByStudentId(int studentId) {
Student stu = dao.queryEntityById(Student.class, studentId);
return stu;
}
// @Override
public Page<Student> findByStudentItem(Map queryMap, int pageNO) {
StringBuffer hql = new StringBuffer("from Student s where 1=1 ");
List<Object> params = new ArrayList<Object>();
if (queryMap.containsKey("studentName")) {
hql.append("and s.name like ?");
params.add(queryMap.get("studentName"));
}
if (queryMap.containsKey("classesId")) {
hql.append("and s.cla.id = ?");
params.add(queryMap.get("classesId"));
}
if (queryMap.containsKey("age")) {
hql.append("and s.age = ?");
params.add(queryMap.get("age"));
}
if (queryMap.containsKey("degreeId")) {
hql.append("and s.degree.id = ?");
params.add(queryMap.get("degreeId"));
}
if (queryMap.containsKey("sex")) {
hql.append("and s.sex = ?");
params.add(queryMap.get("sex"));
}
if (queryMap.containsKey("state")) {
hql.append("and s.state = ?");
params.add(queryMap.get("state"));
}
if (queryMap.containsKey("isDormitory")) {
hql.append("and s.isDormitory = ?");
params.add(queryMap.get("isDormitory"));
}
Page p = this.dao.queryEntityByPage(pageNO, pageCount, hql.toString(),
params.toArray());
return p;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JAVA+MYSQL学生学籍后台管理系统源码+可用于毕设 (445个子文件)
StudentServiceImpl.class 16KB
ClassesAction.class 11KB
JobServiceImpl.class 11KB
JobAction.class 9KB
SchoolRollAction.class 9KB
UserAction.class 8KB
GradeAction.class 8KB
UserServiceImpl.class 8KB
StudentInputOutPutAction.class 7KB
Student.class 7KB
PayMoneyAction.class 7KB
GradeServiceImpl.class 7KB
DormitoryAction.class 7KB
StudentAction.class 6KB
SchoolRollServiceImpl.class 6KB
ClassServiceImpl.class 6KB
Classes.class 6KB
RoleAction.class 6KB
Job.class 5KB
ClassTypeAction.class 5KB
GradeCountAction.class 4KB
JobStatisticsAction.class 4KB
PayMoneyServiceImpl.class 4KB
RoleServiceImpl.class 4KB
PostAction.class 4KB
User.class 4KB
ModelAction.class 3KB
Dormitory.class 3KB
DormitoryServiceImpl.class 3KB
ClassTypeServiceImpl.class 3KB
Grade.class 3KB
DegreeAction.class 3KB
PayMoney.class 3KB
FileUploadAction.class 3KB
SchoolRoll.class 3KB
SchoolRollStatistics.class 3KB
Role.class 3KB
SchoolRollTypeAction.class 3KB
ClassType.class 3KB
SubjectsServiceImpl.class 2KB
ModelServiceImpl.class 2KB
ClassStage.class 2KB
Models.class 2KB
GradeCount.class 2KB
Select.class 2KB
PositionServiceImpl.class 2KB
JobStatistics.class 2KB
MoneyTongji.class 2KB
Degree.class 2KB
GradeCountServiceImpl.class 2KB
SchoolRollType.class 2KB
SpringMvcOppensessionInView.class 2KB
Subjects.class 2KB
SchoolRollTypeServiceImpl.class 2KB
SelectServiceImpl.class 2KB
ClassStageServiceImpl.class 2KB
DegreeServiceImpl.class 1KB
IStudentService.class 1KB
Position.class 1KB
IJobService.class 1KB
Tool.class 1KB
IClassService.class 1KB
IntConverter.class 1KB
DoubleConverter.class 1KB
DateConverter.class 1KB
IClassTypeService.class 1018B
IUserService.class 989B
ISchoolRollService.class 838B
IPayMoneyService.class 750B
IGradeService.class 722B
IRoleService.class 639B
IPosition.class 600B
ISubjectsService.class 575B
IDormitoryService.class 569B
IGradeCountService.class 554B
IClassStageService.class 386B
ISelectService.class 377B
ISchoolRollTypeService.class 366B
IDegreeService.class 323B
IModelService.class 312B
.classpath 588B
org.eclipse.wst.common.component 490B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap-cyborg.css 113KB
bootstrap-cyborg.css 113KB
bootstrap-cerulean.css 106KB
bootstrap-cerulean.css 106KB
bootstrap.min.css 104KB
bootstrap.min.css 103KB
style.css 103KB
bootstrap-classic.css 98KB
bootstrap-classic.css 98KB
bootstrap-classic.min.css 81KB
bootstrap-classic.min.css 81KB
jquery-ui-1.8.21.custom.css 32KB
jquery-ui-1.8.21.custom.css 32KB
font-awesome.min.css 21KB
bootstrap-responsive.min.css 16KB
bootstrap-responsive.css 14KB
bootstrap-responsive.css 14KB
共 445 条
- 1
- 2
- 3
- 4
- 5
资源评论
破碎的天堂鸟
- 粉丝: 8578
- 资源: 2350
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python 中数据结构和算法的最少示例.zip
- 全国大学生智能车竞赛:基于Arduino的智能车设计与实现
- Python SOAP 客户端.zip
- Python ODBC 桥.zip
- Python MIDI 库.zip
- Python for DevOps repo 包含有用的 Python 脚本,可供您学习并在日常 DevOps 自动化任务中实施 .zip
- Python API 包装器和库列表.zip
- Python - 与我的 YouTube 频道相关的脚本存储在这里,可以用任何版本的 Python 编写.zip
- PyClass 课程计划.zip
- Puppet 模块用于安装和管理 Python、pip、virtualenvs 和 Gunicorn 虚拟主机 .zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功