package com.thinkgem.jeesite.modules.oa.web;


import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.oa.entity.Attendance;
import com.thinkgem.jeesite.modules.oa.entity.AttendanceDay;
import com.thinkgem.jeesite.modules.oa.entity.AttendanceMonth;
import com.thinkgem.jeesite.modules.oa.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 考勤Controller
 *
 * @author mojun
 */
@Controller
@RequestMapping(value = "${adminPath}/oa/attendance")
public class AttendanceController extends BaseController {

    @Autowired
    private AttendanceService attendanceService;


    /**
     * MongoDB测试
     */
    @RequestMapping(value = "mongo1", method = RequestMethod.GET)
    public String mongo(HttpServletRequest request, HttpServletResponse response, Model model) {
        attendanceService.getName();
        logger.debug("MongoDB开始");
        return "MongoDB开始";
    }


    @RequestMapping(value = {"list", ""}, method = RequestMethod.GET)
    public String list(Attendance attendance, Model model) {
//        insertAtt();
        List<Attendance> list = attendanceService.getAllAttendance(attendance);
        model.addAttribute("list", list);
        return "modules/oa/attendanceList";
    }

    /**
     * 查看跳转
     */
    @RequestMapping(value = "insert")
    public String attendanceUpdate() {
        return "modules/oa/attendanceInsert";
    }

    /**
     * 查看所有考勤
     */
    @RequestMapping(value = "showAll")
    public String showAllAttendance(HttpServletRequest request, HttpServletResponse response, Model model) {

        return "modules/oa/attendanceShowAll";
    }

    /**
	 * 添加考勤列表
	 */
	@RequestMapping(value = "attendanceSearchList")
	public String attendanceList(Attendance attendance, Model model) {
		List<AttendanceDay> attendanceDayList = attendanceService.getAttendanceDateList(attendance);
		model.addAttribute("attendanceDayList", attendanceDayList);
		return "modules/oa/attendanceInsertList";
	}
	
	@ModelAttribute("attendance")
	public Attendance getAttendanceModel() {
		return new Attendance();
	}
	
	@ModelAttribute("attendanceMonth")
	public AttendanceMonth getAttendanceMonthModel() {
		return new AttendanceMonth();
	}
	
	@ModelAttribute("attendanceDay")
	public AttendanceDay getAttendanceDayModel() {
		return new AttendanceDay();
	}
	
	/**
	 * 提交考勤列表
	 */
	@RequestMapping(value = "attendanceInsertList")
	public String attendanceInsert(Attendance attendance, Model model) {
		attendanceService.InsertAttendanceList(attendance);
		return "modules/oa/attendanceList";
	}

    /**
     * test insert
     */
    @RequestMapping(value = "insertAtt")
    public void insertAtt() {
        attendanceService.insertAtt();
    }

    /**
     * 根据条件查询
     */
    @RequestMapping(value = "getAttendance")
    public List<Attendance> getAttendance(Attendance attendance) {
        return attendanceService.getAttendance(attendance);
    }

    /**

     * 查询所有
     */
    @RequestMapping(value = "getAllAttendance")
    public List<Attendance> getAllAttendance(Attendance attendance) {
        List<Attendance> list = attendanceService.getAllAttendance(attendance);
        return list;
    }

    /**
     * test delete
     */
    @RequestMapping(value = "delete")
    public void delete() {
        attendanceService.delete();
    }

	
    /**
     * 查看个人考勤
     */
    @RequestMapping(value = "show")
    public String attendanceShow() {
        return "modules/oa/attendanceShow";
    }
	
	/**
	 * test getAttendanceByDate
	 */
	@RequestMapping(value = "getAttendanceByDate")
	public void getAttendanceByDate() {
		attendanceService.getAttendanceByDate();
	}
	
	
	/**
	 * test update
	 */
	@RequestMapping(value = "update")
	public void update() {
		attendanceService.update();
	}
}
@@ -342,16 +342,79 @@
 Service;
+%0A%0Aimport org.apache.shiro.authz.annotation.RequiresPermissions;
 %0Aimport 
@@ -838,16 +838,17 @@
 sponse;%0A
+%0A
 import j
@@ -1910,32 +1910,79 @@
  %E6%9F%A5%E7%9C%8B%E6%89%80%E6%9C%89%E8%80%83%E5%8B%A4%0A     */%0A
+    @RequiresPermissions(%22oa:attendance:view%22)%0A
     @RequestMapp

update AttendanceController.java