Ejemplo n.º 1
0
  public ActionForward update(
      ActionMapping mapping,
      ActionForm form, // 修改
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    log.debug("update");
    Map filterMap = WebUtils.getParametersStartingWith(request, "new_");
    String startDate = (String) filterMap.get("startMonth") + (String) filterMap.get("startDay");
    String endDate = (String) filterMap.get("endMonth") + (String) filterMap.get("endDay");

    Vacation vacation = vacationService.get((String) filterMap.get("vid"));
    vacation.setEnddate(endDate);
    vacation.setStartdate(startDate);
    vacation.setVactionalname((String) filterMap.get("confName"));
    vacationService.update(vacation);

    request.setAttribute("msg", "修改成功");
    return mapping.findForward("goVacation");
  }
Ejemplo n.º 2
0
  public ActionForward addVacation(
      ActionMapping mapping,
      ActionForm form, // 增加节假日
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    log.debug("addVacation");

    Map filterMap = WebUtils.getParametersStartingWith(request, "new_");
    String startDate = (String) filterMap.get("startMonth") + (String) filterMap.get("startDay");
    String endDate = (String) filterMap.get("endMonth") + (String) filterMap.get("endDay");

    Department department = departmentService.getDepartment((String) filterMap.get("departId"));

    Vacation vacation = new Vacation();
    vacation.setDepartid((String) filterMap.get("departId"));
    vacation.setVactionalname((String) filterMap.get("confName"));
    vacation.setStartdate(startDate);
    vacation.setEnddate(endDate);
    if (department.getParent() == null) {
      vacation.setIsglobe(CommonConfig.isGlobe); // 部门为顶级部门,公休日期则为全局
    }

    vacationService.save(vacation);

    request.setAttribute("confname", vacation.getVactionalname());
    request.setAttribute("startMonth", (String) filterMap.get("startMonth"));
    request.setAttribute("startDay", (String) filterMap.get("startDay"));

    request.setAttribute("endMonth", (String) filterMap.get("endMonth"));
    request.setAttribute("endDay", (String) filterMap.get("endDay"));

    request.setAttribute("dptName", department.getName());

    return mapping.findForward("showDetail");
  }