package com.group.ctms.controller;
import com.github.pagehelper.PageInfo;
import com.group.ctms.entity.Application;
import com.group.ctms.entity.AuditLog;
import com.group.ctms.entity.Employee;
import com.group.ctms.service.IApplicationService;
import com.group.ctms.service.IAuditLogService;
import com.group.ctms.util.Const;
import com.group.ctms.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
* Created by zcy-fover on 2016/11/11.
* Completed by Doctor Who on 2016/11/14
* 员工出差申请表的控制器,管理添加、修改等业务
*/
@SuppressWarnings("unused")
@Controller
@RequestMapping("/application")
public class ApplicationController {
private IApplicationService applicationService;
private IAuditLogService auditLogService;
@Autowired
public ApplicationController(IApplicationService applicationService,
IAuditLogService auditLogService){
this.applicationService = applicationService;
this.auditLogService = auditLogService;
}
@RequestMapping("/toAdd")
public ModelAndView toAdd(PageInfo<Application> page){
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("page",page);
modelAndView.setViewName("onBusinessManage/addApplication");
return modelAndView;
}
/**
* 添加申请表
* @param application
* @return
*/
@RequestMapping(value = "/commit", method = RequestMethod.POST)
public ModelAndView commit(HttpSession httpSession, Application application, PageInfo<Application> page)
{
Employee employee = (Employee)httpSession.getAttribute(Const.USER_SESSION_KEY);
ModelAndView modelAndView = new ModelAndView();
Result result = new Result();
AuditLog auditLog = new AuditLog();
if (applicationService.addApplication(employee.getEmployeeNum(), application)){
result.setMessage("添加成功!");
auditLog.setAuditFeedback("提交成功");
applicationService.addAuditLog(application, auditLog);
}else {
result.setMessage("添加失败!");
}
page = applicationService.list(page,employee.getEmployeeNum());
modelAndView.addObject("page",page);
modelAndView.addObject("result", result);
return queryAll(page,httpSession,modelAndView);
}
@RequestMapping("/toUpdate")
public ModelAndView toUpdate(Integer id,PageInfo<Application> page){
Application application = applicationService.getApplicationById(id);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("page",page);
modelAndView.addObject("application", application);
modelAndView.setViewName("onBusinessManage/updateApplication");
return modelAndView;
}
/**
* 修改申请表
* @param application
* @return
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public ModelAndView update(HttpSession httpSession,Application application, PageInfo<Application> page){
Result result = new Result();
ModelAndView modelAndView = new ModelAndView();
Employee employee = (Employee)httpSession.getAttribute(Const.USER_SESSION_KEY);
AuditLog auditLog = new AuditLog();
if (applicationService.reviseApplication(application)){
result.setMessage("修改成功!");
auditLog.setAuditFeedback("修改成功!");
applicationService.addAuditLog(application,auditLog);
}else {
result.setMessage("修改失败!");
}
page = applicationService.list(page,employee.getEmployeeNum());
modelAndView.addObject("page",page);
modelAndView.addObject("result", result);
modelAndView.setViewName("onBusinessManage/applicationList");
return modelAndView;
}
/**
* 删除申请表
* @param id
* @return
*/
@RequestMapping("/delete")
public ModelAndView delete(@RequestParam Integer id,HttpSession httpSession, PageInfo<Application> page){
Result result = new Result();
Employee employee = (Employee)httpSession.getAttribute(Const.USER_SESSION_KEY);
if (applicationService.delApplication(id)){
result.setMessage("删除成功!");
}else{
result.setMessage("删除失败!");
}
page = applicationService.list(page, employee.getEmployeeNum());
if (page.getSize() == 0){
page.setPageNum(page.getPageNum() - 1);
}
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("result",result);
modelAndView.addObject("page",page);
return queryAll(page,httpSession,modelAndView);
}
/**
* 根据输入的条件查询符合条件的表单
* @param application
* @return
*/
@RequestMapping("/query")
public ModelAndView query(PageInfo<Application> page, HttpSession httpSession,Application application){
Employee employee = (Employee)httpSession.getAttribute(Const.USER_SESSION_KEY);
application.setEmployeeNum(employee.getEmployeeNum());
page = applicationService.query(page,application);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("page", page);
modelAndView.setViewName("onBusinessManage/applicationList");
return modelAndView;
}
/**
* 查询所有未删除的表单并显示
* @return
*/
@RequestMapping("/queryAll")
public ModelAndView queryAll(PageInfo<Application> page,HttpSession httpSession, ModelAndView modelAndView){
Employee employee = (Employee)httpSession.getAttribute(Const.USER_SESSION_KEY);
if (modelAndView == null){
modelAndView = new ModelAndView();
}
page = applicationService.list(page,employee.getEmployeeNum());
modelAndView.addObject("page",page);
modelAndView.setViewName("onBusinessManage/applicationList");
return modelAndView;
}
/**
* 查看申请的详情
* @param id
* @return
*/
@RequestMapping("/detail")
public ModelAndView detail(Integer id){
Application application = applicationService.getApplicationById(id);
List<AuditLog> auditLogs = auditLogService.logList(id);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("auditLogs", auditLogs);
modelAndView.addObject("application", application);
modelAndView.setViewName("onBusinessManage/detail");
return modelAndView;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该项目是一款基于Java语言的CTMS差旅管理系统设计源码,综合运用了Java、JavaScript和CSS等多种技术,共包含326个文件,其中JavaScript文件77个,CSS文件69个,PNG图片文件69个,Java源文件47个,JSP文件26个,XML文件10个,JPG图片文件10个,以及其他格式文件共30个。该系统旨在提升企业差旅管理效率,通过自动化记录和管理员工的出差信息,规范出差流程,减少人工差错,提高业务处理效率,助力企业实现效率最大化,有效弥补传统差旅管理中的不足。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java语言的CTMS差旅管理系统设计源码 (326个子文件)
bootstrap.css 134KB
bootstrap.min.css 113KB
AdminLTE.min.css 88KB
_all-skins.min.css 40KB
font-awesome.css 34KB
datepicker3.css 33KB
font-awesome.min.css 28KB
bootstrap-theme.css 21KB
_all.css 21KB
bootstrap-theme.min.css 19KB
_all.css 15KB
_all.css 14KB
_all.css 13KB
bootstrap-datetimepicker.css 12KB
purple.css 2KB
yellow.css 2KB
orange.css 2KB
green.css 2KB
pink.css 2KB
blue.css 2KB
grey.css 2KB
aero.css 2KB
red.css 2KB
line.css 2KB
base-message.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
green.css 2KB
green.css 2KB
pink.css 2KB
blue.css 2KB
grey.css 2KB
aero.css 2KB
pink.css 2KB
blue.css 2KB
grey.css 2KB
aero.css 2KB
red.css 2KB
red.css 2KB
all.css 2KB
minimal.css 2KB
polaris.css 2KB
square.css 2KB
purple.css 1KB
orange.css 1KB
yellow.css 1KB
green.css 1KB
pink.css 1KB
blue.css 1KB
grey.css 1KB
aero.css 1KB
futurico.css 1KB
red.css 1KB
flat.css 1KB
bootstrapValidator.min.css 694B
login.css 648B
error.css 485B
profile.css 305B
applicationAdd.css 301B
applicationSubmit.css 297B
authorityAdd.css 290B
modify.css 283B
applicationList.css 243B
role.css 155B
font-css.css 46B
fontawesome-webfont.eot 75KB
glyphicons-halflings-regular.eot 20KB
.gitignore 82B
logo-32.ico 4KB
logo-24.ico 2KB
ApplicationController.java 7KB
ApplicationServiceImpl.java 6KB
CheckController.java 6KB
EmployeeController.java 5KB
Application.java 4KB
CheckServiceImpl.java 4KB
WebController.java 4KB
ApplicationServiceTest.java 4KB
EmployeeServiceImpl.java 4KB
RoleController.java 3KB
AuthorityServiceImpl.java 3KB
AuditLog.java 3KB
Page.java 2KB
Authority.java 2KB
AuthorityController.java 2KB
Employee.java 2KB
EmployeeServiceTest.java 2KB
IApplicationService.java 2KB
LoginInterceptor.java 2KB
Role.java 2KB
IEmployeeService.java 2KB
RoleServiceTest.java 2KB
EmployeeMapper.java 1KB
AuthorityServiceTest.java 1KB
Department.java 1KB
ApplicationMapper.java 1KB
共 326 条
- 1
- 2
- 3
- 4
资源评论
lsx202406
- 粉丝: 2437
- 资源: 5588
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功