package com.bzu.action;
//Download by http://www.codefans.net
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.bzu.entity.Employer;
import com.bzu.entity.EmployerWage;
import com.bzu.entity.GoodsSpend;
import com.bzu.entity.IntoGoods;
import com.bzu.service.inter.EmployerService;
import com.bzu.service.inter.EmployerWageService;
import com.bzu.service.inter.IntoGoodsService;
import com.bzu.service.inter.WorkdayService;
import com.bzu.util.ToolMethodUtil;
import com.opensymphony.xwork2.ActionSupport;
public class EmployerWageAction extends ActionSupport {
private EmployerWage employerWage;
private EmployerWageService employerWageService;
private IntoGoodsService intoGoodsService;
private Double beginWage;
private Double endWage;
private int index;
public String employerWageList() {
String hql = "";
if (employerWage != null) {
if (employerWage.getEmployer().getId() != -1)
hql += " and s.employer.id = "
+ employerWage.getEmployer().getId();
if (beginWage != null && endWage != null)
hql += " and s.wage between " + beginWage + " and " + endWage
+ "";
}
List<EmployerWage> list = index != 0 ? employerWageService.getByPage(
index, EmployerWage.class, hql) : employerWageService
.getByPage(1, EmployerWage.class, hql);
HttpSession session = ServletActionContext.getRequest().getSession();
session.setAttribute("list", list);
session.setAttribute("thisindex", index == 0 ? 1 : index);
session.setAttribute("count", employerWageService.getAllEmployerWage(
EmployerWage.class, hql).size());
Map<Integer, String> map = employerWageService.getAllEmployer(
Employer.class, "");
ServletActionContext.getRequest().setAttribute("map", map);
return "employerWageList";
}
private EmployerService employerService;
private WorkdayService workdayService;
public String createWage() {
List<Employer> emplist = employerService.getAllEmployer(Employer.class,
"");// 获得所有的员工
// List<EmployerWage> wagelist=new ArrayList<EmployerWage>();
String months = ToolMethodUtil.getYearAndMonth();
String num = ((List) (employerWageService
.getInfo("select count(*) from EmployerWage e where e.months='"
+ months + "'"))).get(0).toString();
if (Integer.parseInt(num) != 0)
return "createWageSuccess";
for (Iterator iterator = emplist.iterator(); iterator.hasNext();) {// 遍历所有的员工,通过他们的id获得到他们的月薪
Employer employer = (Employer) iterator.next();
double monthpay = employer.getMonthpay();
int workday = workdayService.getWorkday(employer.getId());
Double dempWage = (monthpay * (((float) workday) / 30));
int empWage = dempWage.intValue();
EmployerWage employerWage = new EmployerWage(employer, months,
empWage);
employerWageService.addempWage(employerWage);
// wagelist.add(employerWage);
}
return "createWageSuccess";
}
public String createGoodsSpend() {
String date = ToolMethodUtil.getDate();
String num = ((List) (employerWageService//getInfo方法就是通过hql语句获得list的集合,这里是查询物品消费表里面是否有本月的记录
.getInfo("select count(*) from GoodsSpend g where month(g.intoGoods.intoDate)=month('"
+ date + "')"))).get(0).toString();
System.out.println(num);
if (Integer.parseInt(num) != 0)
return "createWageSuccess";
List<IntoGoods> inglist=intoGoodsService.getAllIntoGoods(IntoGoods.class, " and month(s.intoDate)=month('"
+ date + "')");//获得所有本月的进货记录
for (Iterator iterator = inglist.iterator(); iterator.hasNext();) {
IntoGoods intoGoods = (IntoGoods) iterator.next();
double money=intoGoods.getNum()*intoGoods.getGoods().getInputPrise();
GoodsSpend goodSpend=new GoodsSpend(intoGoods, money);
intoGoodsService.addGoodsSpend(goodSpend);
}
return "createWageSuccess";//创建货物花费金额成功,为了少写一个result,就直接返回createWageSuccess。
}
public String goodsSpendList(){
String date = ToolMethodUtil.getDate();
List<GoodsSpend> list=intoGoodsService.getGoodsSpendList(GoodsSpend.class, "and month(s.intoGoods.intoDate)=month('"+date + "')");
HttpSession session = ServletActionContext.getRequest().getSession();
session.setAttribute("spendlist", list);
return "spendlist";
}
public WorkdayService getWorkdayService() {
return workdayService;
}
public void setWorkdayService(WorkdayService workdayService) {
this.workdayService = workdayService;
}
public EmployerService getEmployerService() {
return employerService;
}
public void setEmployerService(EmployerService employerService) {
this.employerService = employerService;
}
public Double getBeginWage() {
return beginWage;
}
public void setBeginWage(Double beginWage) {
this.beginWage = beginWage;
}
public Double getEndWage() {
return endWage;
}
public void setEndWage(Double endWage) {
this.endWage = endWage;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public EmployerWageService getEmployerWageService() {
return employerWageService;
}
public void setEmployerWageService(EmployerWageService employerWageService) {
this.employerWageService = employerWageService;
}
public EmployerWage getEmployerWage() {
return employerWage;
}
public void setEmployerWage(EmployerWage employerWage) {
this.employerWage = employerWage;
}
public IntoGoodsService getIntoGoodsService() {
return intoGoodsService;
}
public void setIntoGoodsService(IntoGoodsService intoGoodsService) {
this.intoGoodsService = intoGoodsService;
}
public static void main(String[] args) {
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd");
String date1 = format.format(date);
System.out.println(date1);
//
System.out.println("20" + date1.substring(0, date1.indexOf("-")));
System.out.println(date1.substring(date1.indexOf("-") + 1, date1
.indexOf("-") + 3));
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
java SSH 超市后台管理系统 (216个子文件)
EmployerWageAction.class 8KB
EmployerAction.class 7KB
IntoGoodsAction.class 6KB
GoodsAction.class 6KB
WorkdayDaoImpl.class 5KB
Goods.class 4KB
GoodsServiceImpl.class 4KB
EmployerWageServiceImpl.class 4KB
SuperDao.class 4KB
IntoGoodsServiceImpl.class 3KB
Employer.class 3KB
InputerServiceImpl.class 3KB
EmployerServiceImpl.class 3KB
IntoGoodsDaoImpl.class 3KB
GoodsDaoImpl.class 2KB
InputerAction.class 2KB
WorkdayServiceImpl.class 2KB
EmployerDaoImpl.class 2KB
AdminAction.class 2KB
GoodsSell.class 2KB
WorkMapUtil.class 2KB
InputerDaoImpl.class 2KB
IntoGoods.class 2KB
Workday.class 2KB
AdminDaoImpl.class 1KB
Inputer.class 1KB
EmployerWage.class 1KB
ToolMethodUtil.class 1KB
SuperDao$1.class 1KB
GoodsSpend.class 1KB
Admin.class 1KB
AdminServiceImpl.class 1KB
IntoGoodsService.class 848B
GoodsService.class 831B
IntoGoodsDao.class 818B
EmployerWageService.class 803B
GoodsDao.class 720B
EmployerService.class 659B
EmployerDao.class 633B
InputerService.class 474B
WorkdayService.class 435B
WorkdayDao.class 417B
InputerDao.class 344B
AdminService.class 310B
AdminDao.class 289B
.classpath 3KB
org.eclipse.wst.jsdt.ui.superType.container 49B
jquery-ui-1.8.12.css 34KB
jquery-ui-1.8.20.custom.css 32KB
style.css 2KB
general.css 1KB
css.css 1KB
title.gif 3KB
titles.gif 3KB
admin_left_1.gif 2KB
admin_left_9.gif 2KB
admin_left_2.gif 1KB
index_22.gif 787B
index_18.gif 367B
index_23.gif 235B
index_20.gif 234B
index_16.gif 179B
index_19.gif 110B
index_21.gif 106B
graph.gif 66B
spacer.gif 43B
spring.jar 2.81MB
hibernate3.jar 2.31MB
xwork-2.1.2.jar 2.18MB
aspectjweaver.jar 1.47MB
jfreechart-1.0.8a.jar 1.23MB
freemarker-2.3.13.jar 850KB
struts2-core-2.1.6.jar 719KB
javassist-3.9.0.GA.jar 583KB
sqljdbc.jar 570KB
commons-collections-3.1.jar 546KB
mysql-connector-java-3.1.13-bin.jar 446KB
antlr-2.7.6.jar 433KB
log4j-1.2.15.jar 383KB
cglib-nodep-2.1_3.jar 317KB
dom4j-1.6.1.jar 307KB
jcommon-1.0.12.jar 301KB
hibernate-annotations.jar 273KB
ognl-2.6.11.jar 164KB
commons-dbcp.jar 119KB
aspectjrt.jar 112KB
commons-io-1.3.2.jar 86KB
jfreechart-1.0.8a-swt.jar 70KB
hibernate-commons-annotations.jar 65KB
commons-pool.jar 61KB
commons-fileupload-1.2.1.jar 56KB
commons-logging-1.1.jar 52KB
ejb3-persistence.jar 49KB
slf4j-api-1.5.8.jar 23KB
jta-1.1.jar 13KB
jfreechart-1.0.8a-experimental.jar 12KB
slf4j-log4j12-1.5.8.jar 9KB
struts2-spring-plugin-2.1.6.jar 9KB
common-annotations.jar 6KB
EmployerWageAction.java 6KB
共 216 条
- 1
- 2
- 3
资源评论
- 奇纳尼2018-07-04可以用,仔细安装就好了
- a3458151062015-07-17从别的地方下来的吧!
- 猿少尉2019-05-22没有数据库
qq_24193501
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功