package oa.action;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;

import oa.domain.User;
import oa.service.ApplicationTemplateService;
import oa.service.DepartmentService;
import oa.service.ForumService;
import oa.service.PrivilegeService;
import oa.service.ProcessDefinitionService;
import oa.service.ReplyService;
import oa.service.RoleService;
import oa.service.TopicService;
import oa.service.UserService;

import oa.service.ApplicationService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {

	@Resource
	protected RoleService roleService;
	@Resource
	protected DepartmentService departmentService;
	@Resource
	protected UserService userService;
	@Resource
	protected PrivilegeService privilegeService;
	@Resource
	protected ForumService forumService;
	@Resource
	protected TopicService topicService;
	@Resource
	protected ReplyService replyService;
	@Resource
	protected ProcessDefinitionService processDefinitionService;
	@Resource
	protected ApplicationTemplateService applicationTemplateService;
	@Resource
	protected ApplicationService applicationService;
	public User getCurrentUser(){
		return (User) ActionContext.getContext().getSession().get("user");
	}
	protected int pageNum = 1;

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	protected String saveUploadFile(File temp) {
		//设置路径
		String basePath=ServletActionContext.getServletContext().getRealPath("/WEB-INF/upload/");
		SimpleDateFormat dateFormat=new SimpleDateFormat("/yyyy/MM/dd/");
		String subpath=dateFormat.format(new Date());
		//路径处理
		File dir=new File(basePath+subpath);
		if(!dir.exists()){
			dir.mkdirs();
		}
		//拼接文件路径
		String path=basePath+subpath+UUID.randomUUID().toString();
		//移动文件
		temp.renameTo(new File(path));
		return path;
	}
}
最近下载更多
lironggang  LV38 2023年11月30日
朱俪的邮件及存储  LV8 2023年1月28日
微信网友_6115804675756032  LV7 2022年12月3日
wanglinddad  LV55 2022年3月9日
and123456  LV11 2022年2月19日
xiaohe229  LV8 2021年8月9日
Demo1111  LV30 2021年3月15日
有糖吃的面面  LV3 2021年2月25日
aaa5849310  LV25 2020年9月4日
ASDZXZCDGSDFHUJD  LV9 2020年5月13日
最近浏览更多
xianyu091012  LV5 2024年12月24日
zuizhonghuanxiang16 2024年7月2日
暂无贡献等级
1941549176  LV4 2024年4月29日
m5433661  LV2 2024年3月28日
123456wadff  LV3 2024年1月15日
lironggang  LV38 2023年11月30日
2036495585  LV9 2023年9月25日
暂无贡献等级
微信网友_6467077197238272  LV1 2023年5月8日
uni-code_0123  LV1 2023年3月31日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友