高级软件工程第七次作业:LLS战队Alpha敏捷冲刺5

召开迭代会议照片:

 

会议内容:继续对昨天的工作进行完善,将剩下的活动行为完成,并做明天的工作计划。

任务分配:宋非队长:201810812006  RuleAction代码编写

    罗建彪队员:201810812005  ScoreAction代码编写

    罗远云队员:201810775002  UserAction代码编写

 需要注意的细节(用户行为):新增和修改要注意参数的数据类型,格式要一致;删除要注意删除的条件。

任务分解图:

任务燃尽图:

conding代码链接:https://git.coding.net/Ssl_dhlg18/SIMsystem.git

部分代码截图:

package com.ms.action;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.ms.dao.ActivitylistInterface;
import com.ms.model.Userform;
import com.ms.service.UserServiceI;
import com.ms.utils.getPageUtil;
import com.opensymphony.xwork2.ModelDriven;

/**
 * @Description : 活动列表的Action实现
 * @author LSS
 * @Date 2018-11-28
 *
 */
@SuppressWarnings("serial")
public class UserAction extends BaseAction implements ModelDriven<Userform>{
    @Autowired
    private UserServiceI userService;
    @Autowired
    @Qualifier("activityDao")
    private ActivitylistInterface activityDao;
    private Userform user = new Userform();
    private List<Userform> list_users= new ArrayList<Userform>();
    private List<Integer> pages = new ArrayList<Integer>();
    
    
    /**
     * @Description : 查询所有的用户
     * @author LLS
     * @Date 2018-11-28
     *
     */
    @Action(value = "getUsers" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String getUsers(){
        String page=ServletActionContext.getRequest().getParameter("page");
        String rows=ServletActionContext.getRequest().getParameter("rows");
        pages = getPageUtil.getPage(page, rows);//获取int值得页码和页数
        jsoMap.put("rows", userService.getAllUser(pages.get(0),pages.get(1)));
        int total = userService.getUserCounts();
        jsoMap.put("total", total);
        return "success";
    }
    
    
    /**
     * @Description : 增加用户
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "addUser" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String addUser(){
        jsoMap.put("msg", userService.addUser(user));
        return "success";
    }
    
    /**
     * @Description : 修改用户
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "updateUser" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String updateUser(){
        jsoMap.put("msg", userService.updateUser(user));
        return "success";
    }
    
    /**
     * @Description : 删除用户
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "deleteUser" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String deleteUser(){
        jsoMap.put("msg", userService.deleteUser(user.getUserId()));
        return "success";
    }
    
    /**
     * @Description : 查询评委
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "getJudges" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String getJudges(){
        jsoMap.put("rows", userService.getJudge(2));
        return "success";
    }
    
    /**
     * @Description : 通过活动ID查询评委
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "getJudgesByActivId" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String getJudgesByActivId(){
        int activityId = Integer.parseInt(ServletActionContext.getRequest().getParameter("activityId"));
        jsoMap.put("msg", true);
        jsoMap.put("rows", userService.getJudgeById(2, activityId));
        return "success";
    }
    
    /**
     * @Description : 通过已启动活动的ID查询评委
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "getJudgesByStartActivId" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String getJudgesByStartActivId(){
        int activityId = activityDao.getStartActivity(true).getActivityId();
        jsoMap.put("rows", userService.getJudgeById(2, activityId));
        return "success";
    }
    
    /**
     * @Description : 一键添加评委到活动中
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "addAllJudge2Activ" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String addAllJudge2Activ(){
        int activityId = Integer.parseInt(ServletActionContext.getRequest().getParameter("activityId"));
        jsoMap.put("msg", userService.addAllJudgeToActiv(activityId, 2));
        return "success";
    }
    
    /**
     * @Description : 一键移除评委到活动中
     * @author LLS
     * @Date 2018-11-28
     *
     */
    @Action(value = "removeAllJudgeFromActiv" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String removeAllJudgeFromActiv(){
        int activityId = Integer.parseInt(ServletActionContext.getRequest().getParameter("activityId"));
        jsoMap.put("msg", userService.removeAllJudgeToActiv(activityId, 2));
        return "success";
    }
    
    /**
     * @Description : 单个添加(移除)评委到活动中
     * @author LSS
     * @Date 2018-11-28
     *
     */
    @Action(value = "addSingleJudge2Activ" , results = {@Result(name = "success", type = "json",params = {"root","jsoMap"})})
    public String addSingleJudge2Activ(){
        int activityId = Integer.parseInt(ServletActionContext.getRequest().getParameter("activityId"));
        int userId = Integer.parseInt(ServletActionContext.getRequest().getParameter("userId"));
        jsoMap.put("msg", userService.addSingleJudgeToActiv(activityId, userId));
        return "success";
    }
    

    @Override
    public Userform getModel() {
        return user;
    }

    public Userform getUser() {
        return user;
    }

    public void setUser(Userform user) {
        this.user = user;
    }

    public List<Userform> getList_users() {
        return list_users;
    }

    public void setList_users(List<Userform> list_users) {
        this.list_users = list_users;
    }
    
}

 

posted @ 2018-11-28 18:29  小小萝卜  阅读(179)  评论(0编辑  收藏  举报