Ejemplo n.º 1
0
 /**
  * 我发起的签到记录
  *
  * @return
  */
 @RequestMapping(
     value = "getMyLaunchSignRecord",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody DataResult getMyLaunchSignRecord() {
   String spageIndex = HttpRequestUtil.getInstance().getString("pageIndex");
   String spageSize = HttpRequestUtil.getInstance().getString("pageSize");
   String type = HttpRequestUtil.getInstance().getString("type");
   int pageIndex = -1;
   int pageSize = -1;
   if (StringUtils.isNotEmpty(spageIndex)) {
     pageIndex = Integer.valueOf(spageIndex);
   }
   if (StringUtils.isNotEmpty(spageSize)) {
     pageSize = Integer.valueOf(spageSize);
   }
   Sign sign = new Sign();
   Map<String, Object> params = new HashMap<String, Object>();
   // params.put("userId",
   // SystemCacheUtil.getInstance().getCurrentUser().getUserid());
   sign.setUserId(SystemCacheUtil.getInstance().getCurrentUser().getUserid());
   if ("0".equals(type)) {
     params.put("isNoEnd", true);
   } else if ("1".equals(type)) {
     params.put("isEnd", true);
   }
   return signService.querySignRecord(sign, params, pageIndex, pageSize);
 }
Ejemplo n.º 2
0
 /**
  * 签到处,显示今天所有的签到信息
  *
  * @param model
  * @return
  */
 @RequestMapping(
     value = "signView",
     method = {RequestMethod.GET, RequestMethod.POST})
 public ModelAndView signView(HttpServletRequest request) {
   ModelAndView modelAndView = super.createModelAndView("sign");
   Sign sign = new Sign();
   sign.setSignType(SignType.KQ.value());
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("userId", SystemCacheUtil.getInstance().getCurrentUser().getUserid());
   List<Map<String, Object>> signListMap =
       (List<Map<String, Object>>) signService.querySignRecord(sign, params, -1, -1).getData();
   modelAndView.addObject("signListMap", signListMap);
   return modelAndView;
 }
Ejemplo n.º 3
0
  /**
   * 签到详情
   *
   * @return
   */
  @RequestMapping(value = "signDetailView", method = RequestMethod.GET)
  public ModelAndView signDetailView(HttpServletRequest request) {
    ModelAndView modelAndView = super.createModelAndViewWithSign("sign_detail", request);
    Map<String, Object> requestParams = getRequestParams(request);
    String id = StringUtil.getString(requestParams.get("id"));
    if (StringUtils.isEmpty(id)) {
      throw new BusinessEnergyException(
          SpringContextUtil.getI18n("1002002", new String[] {"id"}, null));
    }
    // 需要获取签到信息
    Sign sign = new Sign();
    sign.setId(id);
    List<Map<String, Object>> signListMap = signService.getSign(sign);
    if (!CollectionUtils.isEmpty(signListMap)) {
      modelAndView.addObject("signInfo", signListMap.get(0));
    } else {
      if (CollectionUtils.isEmpty(signListMap)) {
        throw new EnergyException(
            SpringContextUtil.getI18n("1002003", new String[] {"id", id}, null));
      }
    }
    // 判断如果已经过期需要提醒
    Date currentDate = new Date();
    String signType = (String) signListMap.get(0).get("signType");
    Date beginTime = (Date) signListMap.get(0).get("beginTime");

    SignUser signUser = new SignUser();
    signUser.setSignId(id);
    signUser.setUserId(SystemCacheUtil.getInstance().getCurrentUser().getUserid());
    List<Map<String, Object>> signUserList = signUserService.getSignUser(signUser);
    if (!CollectionUtils.isEmpty(signUserList)) {
      Map<String, Object> temp = null;
      for (int i = 0, size = signUserList.size(); i < size; i++) {
        temp = signUserList.get(i);
        // 签到信息
        if ("0".equals(temp.get("attendType"))) {
          modelAndView.addObject("sign_in", temp);
          List<Accessory> accessoryList =
              accessoryService.getAccessoryByEntityId(StringUtil.getString(temp.get("id")));
          if (!CollectionUtils.isEmpty(accessoryList)) {
            modelAndView.addObject("signInAccessoryInfor", accessoryList);
          }
        } else
        /** 签退信息 */
        {
          modelAndView.addObject("sign_out", temp);
          List<Accessory> accessoryList =
              accessoryService.getAccessoryByEntityId(StringUtil.getString(temp.get("id")));
          if (!CollectionUtils.isEmpty(accessoryList)) {
            modelAndView.addObject("signOutAccessoryInfor", accessoryList);
          }
        }
      }
    }
    if ("0".equals(signType) && signUserList.size() < 2) {
      // 判断如果不是当天的考勤不能正常进行
      if (!DateUtil.dateToString(currentDate, "yyyy-MM-dd")
          .equals(DateUtil.dateToString(beginTime, "yyyy-MM-dd"))) {
        throw new BusinessEnergyException(SpringContextUtil.getI18n("1002007"));
      }
    }
    Date curentDate = new Date();
    modelAndView.addObject(
        "date", DateUtil.dateToString(curentDate, "MM月dd日") + DateUtil.getDayOfWeek(curentDate));
    modelAndView.addObject("time", DateUtil.dateToString(curentDate, "HH:mm"));

    return modelAndView;
  }