/**
*
*/
package com.jbit.jboa.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.jbit.jboa.constants.Constants;
import com.jbit.jboa.dao.ClaimVoucherDao;
import com.jbit.jboa.dao.ClaimVoucherDetailDao;
import com.jbit.jboa.dao.EmployeeDao;
import com.jbit.jboa.entity.ClaimVoucherDetail;
import com.jbit.jboa.entity.ClaimVoucher;
import com.jbit.jboa.entity.Employee;
import com.jbit.jboa.service.ClaimVoucherService;
import com.jbit.jboa.util.PageBean;
/**
* @author 北大青鸟
* 报销单审核业务类,用于调用DAO类相应方法
*/
public class ClaimVoucherServiceImpl implements ClaimVoucherService {
private ClaimVoucherDao claimVoucherDao;
private EmployeeDao employeeDao;
private ClaimVoucherDetailDao claimVoucherDetailDao;
// 删除报销
public void removeClaimVoucher(ClaimVoucher claimVoucher) {
this.claimVoucherDao.deletClaimVoucher(claimVoucher);
}
// 查看报销单信息
public ClaimVoucher query(ClaimVoucher claimVoucher) {
claimVoucher = this.claimVoucherDao.getClaimVoucher(claimVoucher);
return claimVoucher;
}
// 员工查询报销单方法
public PageBean queryForPage(int pageSize, int page,
ClaimVoucher condition, Employee employee) {
StringBuffer sb_hql = new StringBuffer("from ClaimVoucher c ");// 查询语句
String hql;
if (condition != null) {
sb_hql.append("where");
if (!"".equals(employee.getSn())) {
sb_hql.append(" c.creator.sn=:creatorSn order by c.status asc c.createTime desc and ");
}
String temp = sb_hql.toString();
if (temp.contains("and")) {
hql = temp.substring(0, temp.lastIndexOf("and")).trim();
} else {
hql = temp.substring(0, temp.lastIndexOf("where")).trim();
}
} else {
hql = sb_hql.toString();
}
System.out.println(hql);
String countHql = "select count(c.id) " + hql.substring(0, hql.lastIndexOf("order")).trim();
System.out.println(countHql);
int allRow = claimVoucherDao.getAllRowCount(countHql, condition, employee, null);// 总记录数
int totalPage = PageBean.countTotalPage(pageSize, allRow);// 总页数
final int offset = PageBean.countOffset(pageSize, page);// 当前页开始记录
final int length = pageSize;// 每页记录数
final int currentPage = PageBean.countCurrentPage(page);
final int totalGroup = PageBean.countTotalGroup(totalPage);
List<ClaimVoucher> list = claimVoucherDao.queryForPage(hql,
offset, length, condition, employee, null);// "一页"的记录
// 把分页信息保存到Bean中
return setPageBean(pageSize,currentPage,allRow,totalPage,list,totalGroup);
}
// 按日期查询功能
public PageBean queryByDate(int pageSize, int page,
ClaimVoucher condition, Employee employee) {
StringBuffer sb_hql = new StringBuffer(
"select distinct c from ClaimVoucher c,Employee e ");// 查询语句
String hql = null;
if (employee != null) {
if (employee.getSysPosition().getNameCn().equals(
Constants.POSITION_FM)) {
sb_hql.append("where");
if (!"".equals(employee.getSn()) && null != employee.getSn()) {
sb_hql.append(" e.sysDepartment.id=:departmentId and ");
}
if (!"".equals(condition.getCreateTime())) {// 增加按日期查询条件
sb_hql.append(" c.createTime between :date1 and :date2 and");
}
if (!"".equals(condition.getStatus())) {
sb_hql.append(" c.status<>:status order by c.status asc c.createTime desc and");
}
} else if (employee.getSysPosition().getNameCn().equals(
Constants.POSITION_GM)
|| employee.getSysPosition().getNameCn().equals(
Constants.POSITION_CASHIER)) {
sb_hql.append(" ,CheckResult cr where");
if (!"".equals(employee.getSn()) && null != employee.getSn()) {
sb_hql.append(" c.nextDealBy.sn=e.sn and e.sn=:nextDealSn or (cr.sheetId=c.id and cr.sysEmployee.sn=e.sn and e.sn=:nextDealSn) ");
}
if (!"".equals(condition.getCreateTime())) {// 增加按日期查询条件
sb_hql.append(" and c.createTime between :date1 and :date2 ");
}
if (1 == 1) {
sb_hql.append(" order by c.status asc c.createTime desc and");
}
} else if (employee.getSysPosition().getNameCn().equals(// 增加按日期查询功能
Constants.POSITION_STAFF)) {
if (condition != null) {
sb_hql.append("where");
if (!"".equals(condition.getCreateTime())) {
sb_hql.append(" c.createTime between :date1 and :date2 and");
}
if (!"".equals(employee.getSn())) {
sb_hql.append(" c.creator.sn=:creatorSn order by c.status asc c.createTime desc and ");
}
}
}
String temp = sb_hql.toString();
if (temp.contains("and")) {
hql = temp.substring(0, temp.lastIndexOf("and")).trim();
} else {
hql = temp.substring(0, temp.lastIndexOf("where")).trim();
}
} else {
hql = sb_hql.toString();
}
System.out.println(hql);
String newhql = hql.substring(0, hql.lastIndexOf("order")).trim();
int num = newhql.toUpperCase().indexOf("FROM");
String countHql = "select count(distinct c.id) " + newhql.substring(num, newhql.length());
System.out.println(newhql);
int allRow = 0;
if (employee.getSysPosition().getNameCn().equals(Constants.POSITION_STAFF)) {// 增加按日期查询功能
allRow = claimVoucherDao.getAllRowCount(countHql, condition, employee, "date");
} else {
allRow = claimVoucherDao.getAllRowCountM(countHql, condition, employee, "date");// 总记录数
}
int totalPage = PageBean.countTotalPage(pageSize, allRow);// 总页数
final int offset = PageBean.countOffset(pageSize, page);// 当前页开始记录
final int length = pageSize;// 每页记录数
final int currentPage = PageBean.countCurrentPage(page);
final int totalGroup = PageBean.countTotalGroup(totalPage);
List<ClaimVoucher> list = null;
if (employee.getSysPosition().getNameCn().equals(Constants.POSITION_STAFF)) {// 增加按日期查询功能
list = claimVoucherDao.queryForPage(hql, offset, length, condition, employee, "date");// 传的参数中有“date”,代表执行按日期查询 ,"一页"的记录
} else {
list = claimVoucherDao.queryForPageM(hql, offset, length, condition, employee, "date");// 传的参数中有“date”,代表执行按日期查询
}
// 把分页信息保存到Bean中
return setPageBean(pageSize,currentPage,allRow,totalPage,list,totalGroup);
}
/**
* @author 北大青鸟
* 修改报销单, 分成两种情况,即保存和提交报销单,通过参数type进行区分
* 保存时执行两个动作,(1)当在请求页面中已经填写了报销单信息
* ,数据库中没有此条信息时,执行保存到库中(2)当已经提交过了,此时再点保存只修改报销单处理人信息
* 提交包含两个动作,(1)当在请求页面中已经填写了报销单信息
* ,同时也已经填写了报销单详细信息,数据库中没有此条报销单信息时,将报销单信息和报销单详细信息分别保存到库中,并更改处理人信息。
* (2)当在请求页面中已经填写了报销单信息,数据库中没有此条报销单信息时,点击提交只需将�
没有合适的资源?快使用搜索试试~ 我知道了~
JBOA办公自动化管理系统源代码
共229个文件
jar:84个
class:37个
java:33个
5星 · 超过95%的资源 需积分: 10 156 下载量 128 浏览量
2013-12-15
22:23:00
上传
评论 3
收藏 24.49MB RAR 举报
温馨提示
这是用Hibernate+Struts+Spring三大框架实现的,里面功能很多,很适合基础一般的人学习,里面代码都有注释,看起来很方便,对大家绝对有帮助!
资源推荐
资源详情
资源评论
收起资源包目录
JBOA办公自动化管理系统源代码 (229个子文件)
ClaimVoucherServiceImpl.class 10KB
ClaimVoucherAction.class 9KB
ClaimVoucherDaoImpl.class 7KB
CheckResultAction.class 6KB
ClaimVoucherDetailServiceImpl.class 4KB
PageBean.class 4KB
EmployeeAction.class 4KB
Employee.class 4KB
Util.class 3KB
RandomNumUtil.class 3KB
ClaimVoucher.class 3KB
ClaimVoucherDaoImpl$4.class 3KB
ClaimVoucherDaoImpl$2.class 3KB
CheckResult.class 3KB
EmployeeServiceImpl.class 3KB
ClaimVoucherDaoImpl$3.class 2KB
ClaimVoucherDetailDaoImpl.class 2KB
ClaimVoucherDaoImpl$1.class 2KB
EmployeeDaoImpl.class 2KB
Account.class 2KB
CheckResultServiceImpl.class 2KB
ClaimVoucherDetail.class 2KB
Department.class 2KB
Postition.class 2KB
Dictionary.class 1KB
CheckResultDaoImpl.class 1KB
RandomAction.class 1KB
Constants.class 1KB
ClaimVoucherDao.class 1KB
ClaimVoucherService.class 640B
ClaimVoucherDetailDao.class 613B
EmployeeDao.class 575B
ClaimVoucherDetailAction.class 500B
ClaimVoucherDetailService.class 490B
EmployeeService.class 435B
CheckResultService.class 425B
CheckResultDao.class 350B
datepicker.css 5KB
datepicker.css 5KB
style.css 2KB
WdatePicker.css 158B
Thumbs.db 25KB
login_01.gif 33KB
login_02.gif 7KB
logo.gif 7KB
right_bg.gif 4KB
login_sub.gif 3KB
copyright.gif 3KB
left_bg.gif 3KB
right.gif 2KB
img.gif 2KB
img.gif 2KB
bg.gif 1KB
submit.gif 1KB
datePicker.gif 1KB
ico.gif 1009B
Top_bg.gif 851B
sub.gif 660B
save.gif 649B
edit.gif 639B
delete.gif 636B
search.gif 617B
My97DatePicker.htm 1KB
openjpa-0.9.7-incubating.jar 2.3MB
xwork-2.1.2.jar 2.18MB
toplink-essentials.jar 2.03MB
hibernate3.jar 1.85MB
aspectjweaver.jar 1.55MB
jasperreports-1.3.3.jar 1.42MB
classes12.jar 1.14MB
itext-1.3.jar 1.08MB
xerces-2.6.2.jar 966KB
freemarker-2.3.13.jar 850KB
struts2-core-2.1.6.jar 719KB
freemarker.jar 711KB
mysql-connector-java-5.1.8-bin.jar 707KB
poi-2.5.1.jar 682KB
c3p0-0.9.1.1.jar 524KB
jxl.jar 520KB
struts.jar 479KB
antlr-2.7.6rc1.jar 425KB
velocity-1.5.jar 337KB
spring-beans.jar 337KB
ibatis-2.3.0.677.jar 323KB
log4j-1.2.14.jar 320KB
log4j-1.2.11.jar 305KB
cglib-nodep-2.1_3.jar 284KB
spring-aop.jar 265KB
dom4j-1.6.1.jar 257KB
spring-webmvc.jar 245KB
cglib-2.1.3.jar 244KB
commons-httpclient.jar 238KB
hibernate-annotations.jar 222KB
commons-lang.jar 203KB
spring-jdbc.jar 198KB
jaxen-1.1-beta-7.jar 194KB
ehcache-1.2.4.jar 182KB
serp-1.12.1.jar 171KB
commons-collections-2.1.1.jar 169KB
ognl-2.6.11.jar 164KB
共 229 条
- 1
- 2
- 3
hu7657977
- 粉丝: 3
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页