📄 carapplyaction.java
字号:
package org.langsin.car.web.carapply;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.langsin.car.service.IApplycheckService;
import org.langsin.car.service.ICarApplyService;
import org.langsin.car.service.ICarService;
import org.langsin.car.service.ICaroutService;
import org.langsin.car.service.IDriverService;
import org.langsin.car.vo.Applycheck;
import org.langsin.car.vo.Carapply;
import org.langsin.car.vo.Carout;
import org.langsin.car.vo.Dept;
import org.langsin.car.vo.Driver;
import org.langsin.car.vo.User;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;
public class CarApplyAction extends ActionSupport {
private static final Log log = LogFactory.getLog(CarApplyAction.class);
private ICarService carService;
private Carapply carApply;
private ICarApplyService carApplyService;
private IApplycheckService applyCheckService;
private Carout carOut;
private ICaroutService caroutService;
private Integer checkid;
private Applycheck applyCheck;
private IDriverService driverService;
private Driver driver;
public Driver getDriver() {
return driver;
}
public void setDriver(Driver driver) {
this.driver = driver;
}
public IDriverService getDriverService() {
return driverService;
}
public void setDriverService(IDriverService driverService) {
this.driverService = driverService;
}
public Applycheck getApplyCheck() {
return applyCheck;
}
public void setApplyCheck(Applycheck applyCheck) {
this.applyCheck = applyCheck;
}
public Integer getCheckid() {
return checkid;
}
public void setCheckid(Integer checkid) {
this.checkid = checkid;
}
public IApplycheckService getApplyCheckService() {
return applyCheckService;
}
public void setApplyCheckService(IApplycheckService applyCheckService) {
this.applyCheckService = applyCheckService;
}
public Carapply getCarApply() {
return carApply;
}
public void setCarApply(Carapply carApply) {
this.carApply = carApply;
}
public ICarApplyService getCarApplyService() {
return carApplyService;
}
public void setCarApplyService(ICarApplyService carApplyService) {
this.carApplyService = carApplyService;
}
public ICarService getCarService() {
return carService;
}
public void setCarService(ICarService carService) {
this.carService = carService;
}
@SuppressWarnings("unchecked")
public String prepareCarApply() {
log.info("Action中addCarApply方法被执行!申请车辆前准备");
List carInuses = carService.findByInUser();
Map session = ActionContext.getContext().getSession();
session.put("carInuses", carInuses);
return SUCCESS;
}
public String addCarApply() {
log.info("Action中addCarApply方法被执行!申请车辆");
Map session = ActionContext.getContext().getSession();
User user = (User) session.get("user");
Dept dept = (Dept) session.get("dept");
carApply.setUser(user);
carApply.setDept(dept);
carApplyService.save(carApply);
Applycheck applyCheck = new Applycheck();
applyCheck.setUser(user);
applyCheck.setCarapply(carApply);
applyCheck.setCheckstatus("N");
applyCheckService.save(applyCheck);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findCarApplyAll() {
log.info("Action中findCarApplyAll方法被执行!查出所有未通过审批的车辆");
List applyChecks = applyCheckService.findAll();
Map session = ActionContext.getContext().getSession();
session.put("applyChecks", applyChecks);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findCarApplyById() {
log.info("Action中findCarApplyById方法被执行!根据审批的ID查询出具体信息");
Applycheck applyCheck = applyCheckService.findById(checkid);
Map session = ActionContext.getContext().getSession();
session.put("applyCheck", applyCheck);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String addCarApplyCheck() {
log.info("Action中addCarApplyCheck方法被执行!通过审批");
applyCheckService.update(applyCheck);
List drivers = driverService.findAllDriver();
Map session = ActionContext.getContext().getSession();
session.put("drivers", drivers);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String dispatchDriver() {
log.info("Action中dispatchDriver方法被执行!通过审批后分配车辆");
Map session = ActionContext.getContext().getSession();
Applycheck temp = (Applycheck) session.get("applyCheck");
Carapply carApply = carApplyService.findById(temp.getCarapply()
.getApplyid());
carApply.setDriver(driver);
carApplyService.update(carApply);
Applycheck tempApplycheck = applyCheckService.findById(temp
.getCheckid());
session.put("applyCheck", tempApplycheck);
return SUCCESS;
}
public String addCarout(){
Map session = ActionContext.getContext().getSession();
Applycheck applycheck=(Applycheck)session.get("applyCheck");
carOut.setUser(applycheck.getUser());
carOut.setApplycheck(applycheck);
caroutService.save(carOut);
return SUCCESS;
}
public Carout getCarOut() {
return carOut;
}
public void setCarOut(Carout carOut) {
this.carOut = carOut;
}
public ICaroutService getCaroutService() {
return caroutService;
}
public void setCaroutService(ICaroutService caroutService) {
this.caroutService = caroutService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -