package cn.zyan.regist.action;
import java.util.List;
import org.apache.struts2.ServletActionContext;
import cn.zyan.regist.domain.Admin;
import cn.zyan.regist.domain.Item;
import cn.zyan.regist.domain.Notice;
import cn.zyan.regist.domain.PageBean;
import cn.zyan.regist.domain.Student;
import cn.zyan.regist.domain.Team;
import cn.zyan.regist.service.AdminService;
import cn.zyan.regist.service.TeamService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class AdminAction extends ActionSupport{
private AdminService adminService;
private TeamService teamService;
private Admin admin;
private Item item;
private String validateCode;//登陆时的验证码
private Notice notice;
private PageBean pageBean;
private List list;
private int page = 1;
public TeamService getTeamService() {
return teamService;
}
public void setTeamService(TeamService teamService) {
this.teamService = teamService;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public AdminService getAdminService() {
return adminService;
}
public void setAdminService(AdminService adminService) {
this.adminService = adminService;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public Notice getNotice() {
return notice;
}
public void setNotice(Notice notice) {
this.notice = notice;
}
public Admin getAdmin() {
return admin;
}
public void setAdmin(Admin admin) {
this.admin = admin;
}
public String getValidateCode() {
return validateCode;
}
public void setValidateCode(String validateCode) {
this.validateCode = validateCode;
}
public String login(){
Object obj = ActionContext.getContext().getSession().get("code");
String code = obj==null?"":obj.toString();
System.out.println("yanzhengma"+code);
if(code.equalsIgnoreCase(this.validateCode))
{
if(adminService.adminLogin(admin.getName(), admin.getPassword()))
{
ActionContext.getContext().getSession().put("admin", admin);
return SUCCESS;
}
else
{
this.addActionMessage("登录失败,账号或密码错误");
}
}
else
{
this.addActionMessage("校验码错误");
}
return "input";
}
public String addItem(){
adminService.saveItem(item);
ServletActionContext.getRequest().setAttribute("message","增加项目成功");
return "success";
}
/**
* 找到所有待报名项目
* @return
*/
public String registLookItem(){
List<Item> itemList = adminService.findAllItem();
ServletActionContext.getRequest().setAttribute("itemList", itemList);
return "success";
}
public String registPreItem(){
List<Item> itemList = adminService.findAllItem();
ServletActionContext.getRequest().setAttribute("itemList", itemList);
return "success";
}
public String registItem(){
String id = ServletActionContext.getRequest().getParameter("iid");
int id1 = Integer.parseInt(id);
Item item = adminService.findItem(id1);
if(item.getIort().equals("individual")){
Student stu = (Student) ActionContext.getContext().getSession().get("student");
if(item.getStudentSet().contains(stu)){
ServletActionContext.getRequest().setAttribute("message","您已参加该比赛,请勿重复报名");
}else{
item.getStudentSet().add(stu);
adminService.updateItem(item);
ServletActionContext.getRequest().setAttribute("message","报名成功,请准时参加比赛");
}
}
else{
ServletActionContext.getRequest().setAttribute("message","此项目报名对象是团队,请组队后报名");
}
return "message";
}
public String teamRegist(){
String id = ServletActionContext.getRequest().getParameter("iid");
int id1 = Integer.parseInt(id);
System.out.println("woshi iid"+id1);
Item item = adminService.findItem(id1);
System.out.println("item shi :"+item);
if(item.getIort().equals("team")){
Team team = (Team) ActionContext.getContext().getSession().get("team");
Team t = teamService.findTeam(team.getName());
//System.out.println("woshi team de item"+t.getItem());
//if(t.getItem().getIid()==item.getIid()){
// ServletActionContext.getRequest().setAttribute("message","您已参加该比赛,请勿重复报名");
//}else{
t.setItem(item);
teamService.update(t);
ServletActionContext.getRequest().setAttribute("message","报名成功,请准时参加比赛");
//}
}
else{
ServletActionContext.getRequest().setAttribute("message","此项目报名对象是个人,您无法报名");
}
return "success";
}
public String withdrawalItem(){
String id = ServletActionContext.getRequest().getParameter("iid");
int id1 = Integer.parseInt(id);
Item item = adminService.findItem(id1);
System.out.println("woshi item"+item);
Student stu = (Student) ActionContext.getContext().getSession().get("student");
item.getStudentSet().remove(stu);
for(Student s:item.getStudentSet()){
System.out.println(s.getName());
}
System.out.println(item.getStudentSet().contains(stu));
adminService.updateItem(item);
System.out.println(item.getStudentSet().contains(stu));
ServletActionContext.getRequest().setAttribute("message","退选成功");
return "message";
}
public String getItemPage(){
this.pageBean = adminService.queryForPage(3, page);
ServletActionContext.getRequest().setAttribute("pageBean",this.pageBean);
return "success";
}
public String itemPreUpdate(){
String uid = ServletActionContext.getRequest().getParameter("itemid");
int itemid = Integer.parseInt(uid);
this.item = adminService.findItem(itemid);
return "success";
}
public String itemUpdate(){
int itemid = this.item.getIid();
Item item1 = adminService.findItem(itemid);
item1.setName(this.item.getName());
item1.setItemInfo(this.item.getItemInfo());
adminService.updateItem(item1);
ServletActionContext.getRequest().setAttribute("message","更新成功");
return "message";
}
public String itemDelete(){
String uid = ServletActionContext.getRequest().getParameter("itemid");
int itemid = Integer.parseInt(uid);
adminService.deleteItem(itemid);
ServletActionContext.getRequest().setAttribute("message","删除成功");
return "message";
}
public String chartTest(){
StringBuffer a = new StringBuffer();
a.append("[{ \"country\": \"信息学院\",\"visits\": 100," +
"\"color\": \"#FF0F00\"},{ \"country\": \"粮食学院\",\"visits\": 66," +
"\"color\": \"#FFFF00\"},{ \"country\": \"外语学院\",\"visits\": 82," +
"\"color\": \"#0D0D00\"}]");
ServletActionContext.getRequest().setAttribute("result",a.toString());
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于SSH的JavaWeb高校竞赛报名管理系统 (221个子文件)
AdminAction.class 9KB
StudentAction.class 8KB
TeamAction.class 7KB
ChartAction.class 6KB
StudentService.class 4KB
Student.class 3KB
TeamDaoImpl.class 3KB
SendEmail.class 3KB
AdminService.class 3KB
StudentDaoImpl.class 3KB
PageBean.class 3KB
ItemDaoImpl.class 3KB
Team.class 2KB
MD5Util.class 2KB
Item.class 2KB
AuthInterceptor.class 2KB
TeamService.class 2KB
StudentIct.class 2KB
TeamInc.class 2KB
Notice.class 1KB
AdminDao.class 1KB
Admin.class 982B
Authentication.class 837B
ItemDao.class 520B
TeamDao.class 520B
StudentDao.class 455B
ServiceException.class 454B
.classpath 604B
org.eclipse.wst.common.component 456B
org.eclipse.wst.jsdt.ui.superType.container 49B
theme.css 12KB
datepicker.css 5KB
datepicker.css 4KB
admin.css 2KB
admin.css 2KB
WdatePicker.css 158B
Thumbs.db 6KB
Thumbs.db 5KB
Thumbs.db 3KB
admin_p.gif 4KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
login_6.gif 898B
bt_login.gif 300B
menu_icon.gif 64B
menu.htm 2KB
menu.htm 2KB
menu.htm 2KB
My97DatePicker.htm 1KB
hibernate3.jar 2.31MB
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar 1.57MB
freemarker-2.3.22.jar 1.24MB
spring-core-3.2.5.RELEASE.jar 850KB
spring-context-3.2.5.RELEASE.jar 845KB
mysql-connector-java-5.1.25-bin.jar 829KB
struts2-core-2.3.24.jar 812KB
xwork-core-2.3.24.jar 661KB
spring-web-3.2.5.RELEASE.jar 613KB
com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar 603KB
javassist-3.11.0.GA.jar 600KB
spring-beans-3.2.5.RELEASE.jar 596KB
commons.collections_3.2.0.jar 568KB
spring-test-3.2.5.RELEASE.jar 447KB
antlr-2.7.7.jar 435KB
spring-jdbc-3.2.5.RELEASE.jar 396KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
spring-orm-3.2.5.RELEASE.jar 376KB
commons-lang3-3.2.jar 376KB
spring-aop-3.2.5.RELEASE.jar 328KB
dom4j-1.6.1.jar 307KB
org.springframework.transaction-sources-3.0.2.RELEASE.jar 263KB
spring-tx-3.2.5.RELEASE.jar 237KB
ognl-3.0.6.jar 223KB
spring-expression-3.2.5.RELEASE.jar 192KB
mailapi.jar 174KB
commons-io-2.2.jar 170KB
imap.jar 132KB
commons-fileupload-1.3.1.jar 67KB
commons-logging-1.1.3.jar 61KB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
activation.jar 55KB
spring-aspects-3.2.5.RELEASE.jar 50KB
asm-3.3.jar 43KB
asm-commons-3.3.jar 37KB
slf4j-api-1.6.1.jar 25KB
smtp.jar 23KB
struts2-spring-plugin-2.3.20.jar 21KB
asm-tree-3.3.jar 21KB
jstl.jar 20KB
pop3.jar 20KB
jta-1.1.jar 11KB
slf4j-log4j12-1.7.5.jar 9KB
com.springsource.org.aopalliance-1.0.0.jar 5KB
AdminAction.java 7KB
StudentAction.java 6KB
TeamAction.java 6KB
ChartAction.java 4KB
StudentService.java 3KB
PageBean.java 3KB
共 221 条
- 1
- 2
- 3
资源评论
- 沙漠行走的野骆驼2018-04-23有点多简单啊
- weixin_388538932018-12-22没有数据库文件垃圾
- topgd2018-08-25一般般,适合初学者
- 愤怒的小小鸟。2018-10-21我的出不来,不知道为啥,浪费我的C币哦
一剪寒梅傲立雪
- 粉丝: 4
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功