public void signInOff(Long sectionId, Short signInOff, AppUser curUser, Date registerDate) {
    DutySection dutySection = (DutySection) this.dutySectionDao.get(sectionId);

    DutyRegister dutyRegister =
        this.dao.getTodayUserRegister(curUser.getUserId(), signInOff, sectionId);
    if (dutyRegister != null) {
      return;
    }

    DutyRegister register = new DutyRegister();
    register.setAppUser(curUser);
    register.setFullname(curUser.getFullname());

    Calendar regiserCal = Calendar.getInstance();
    regiserCal.setTime(registerDate);
    register.setRegisterDate(registerDate);
    register.setDayOfWeek(Integer.valueOf(regiserCal.get(7)));
    register.setInOffFlag(signInOff);

    register.setDutySection(dutySection);

    Calendar startCalendar = Calendar.getInstance();
    if (DutyRegister.SIGN_IN.equals(signInOff))
      startCalendar.setTime(dutySection.getDutyStartTime());
    else {
      startCalendar.setTime(dutySection.getDutyEndTime());
    }

    DateUtil.copyYearMonthDay(startCalendar, regiserCal);

    if (DutyRegister.SIGN_IN.equals(signInOff)) {
      if (regiserCal.compareTo(startCalendar) > 0) {
        register.setRegFlag(DutyRegister.REG_FLAG_LATE);

        Long minis =
            Long.valueOf((regiserCal.getTimeInMillis() - startCalendar.getTimeInMillis()) / 60000L);
        register.setRegMins(Integer.valueOf(minis.intValue()));
      } else {
        register.setRegFlag(DutyRegister.REG_FLAG_NORMAL);
        register.setRegMins(Integer.valueOf(0));
      }
    } else if (regiserCal.compareTo(startCalendar) < 0) {
      register.setRegFlag(DutyRegister.REG_FLAG_EARLY_OFF);

      Long minis =
          Long.valueOf((startCalendar.getTimeInMillis() - regiserCal.getTimeInMillis()) / 60000L);
      register.setRegMins(Integer.valueOf(minis.intValue()));
    } else {
      register.setRegFlag(DutyRegister.REG_FLAG_NORMAL);
      register.setRegMins(Integer.valueOf(0));
    }

    save(register);
  }
Example #2
0
 /** 添加及保存操作 */
 public String save() {
   String strUserId = getRequest().getParameter("userId");
   if (StringUtils.isNotEmpty(strUserId)) {
     if (carApply.getApplyId() == null) {
       AppUser appUser = appUserService.get(new Long(strUserId));
       carApply.setDepartment(appUser.getDepartment().getDepName());
       carApply.setApprovalStatus((short) 0);
     }
   }
   carApplyService.save(carApply);
   setJsonString("{success:true}");
   return SUCCESS;
 }
Example #3
0
 /** 显示自定义的任务信息 */
 public List<TaskInfo> getTaskInfosByUserId(String userId, PagingBean pb) {
   List<TaskImpl> list = getTasksByUserId(userId, pb);
   List<TaskInfo> taskInfoList = new ArrayList<TaskInfo>();
   for (TaskImpl taskImpl : list) {
     TaskInfo taskInfo = new TaskInfo(taskImpl);
     if (taskImpl.getAssignee() != null) {
       AppUser user = appUserService.get(new Long(taskImpl.getAssignee()));
       taskInfo.setAssignee(user.getFullname());
     }
     ProcessRun processRun = processRunService.getByPiId(taskImpl.getExecutionId());
     if (processRun != null) {
       taskInfo.setActivityName(
           processRun.getProDefinition().getName() + "--" + taskImpl.getActivityName());
     }
     // 显示任务,需要加上流程的名称
     taskInfoList.add(taskInfo);
   }
   return taskInfoList;
 }
 /*    */ public Integer saveRegister(FlowRunInfo flowRunInfo) /*    */ {
   /* 29 */ AppUser curUser = ContextUtil.getCurrentUser();
   /* 30 */ String comments = flowRunInfo.getRequest().getParameter("comments");
   /*    */
   /* 32 */ ErrandsRegister register = new ErrandsRegister();
   /* 33 */ register.setUserId(curUser.getUserId());
   /*    */ try
   /*    */ {
     /* 36 */ BeanUtil.populateEntity(flowRunInfo.getRequest(), register, "errandsRegister");
     /*    */ } catch (Exception ex) {
     /* 38 */ this.logger.error(ex.getMessage());
     /* 39 */ return Integer.valueOf(0);
     /*    */ }
   /* 41 */ register.setApprovalOption(comments);
   /* 42 */ if (register.getDateId() != null) {
     /* 43 */ ErrandsRegister orgRegister = (ErrandsRegister) get(register.getDateId());
     /*    */ try {
       /* 45 */ BeanUtil.copyNotNullProperties(orgRegister, register);
       /*    */
       /* 47 */ orgRegister.setApprovalId(curUser.getUserId());
       /* 48 */ orgRegister.setApprovalName(curUser.getFullname());
       /* 49 */ String destName = flowRunInfo.getDestName();
       /* 50 */ if (destName.equals("申请人查看结果"))
         /* 51 */ orgRegister.setStatus(ErrandsRegister.STATUS_APPROVAL);
       /*    */ else {
         /* 53 */ orgRegister.setStatus(ErrandsRegister.STATUS_UNAPPROVAL);
         /*    */ }
       /* 55 */ this.dao.save(orgRegister);
       /*    */ } catch (Exception ex) {
       /* 57 */ this.logger.error(ex);
       /*    */ }
     /*    */ } else {
     /* 60 */ this.dao.save(register);
     /*    */ }
   /*    */
   /* 63 */ flowRunInfo.getVariables().put("dateId", register.getDateId());
   /* 64 */ flowRunInfo.setFlowSubject(curUser.getFullname() + "提交请假申请");
   /* 65 */ return Integer.valueOf(1);
   /*    */ }
Example #5
0
  public String save() {
    if (this.calendarPlan.getPlanId() == null) {
      this.calendarPlan.setStatus(CalendarPlan.STATUS_UNFINISHED);

      AppUser appUser = ContextUtil.getCurrentUser();

      this.calendarPlan.setAssignerId(appUser.getUserId());
      this.calendarPlan.setAssignerName(appUser.getFullname());

      this.calendarPlanService.save(this.calendarPlan);
    } else {
      CalendarPlan cp = (CalendarPlan) this.calendarPlanService.get(this.calendarPlan.getPlanId());
      try {
        BeanUtil.copyNotNullProperties(cp, this.calendarPlan);
      } catch (Exception ex) {
        this.logger.error(ex.getMessage());
      }
      this.calendarPlanService.save(cp);
    }

    setJsonString("{success:true}");
    return "success";
  }