コード例 #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);
 }
コード例 #2
0
 /**
  * 签到处理
  *
  * @return
  * @throws UnsupportedEncodingException
  */
 @RequestMapping(
     value = "doSign",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object doSign() {
   ResponseResult responseResult = new ResponseResult();
   try {
     // 获取请假申请信息
     JSONObject jsonSignInfoObj =
         JSON.parseObject(
             URLDecoder.decode(HttpRequestUtil.getInstance().getString("signInfo"), "UTF-8"));
     Map<String, Object> resultData = new HashMap<String, Object>();
     responseResult.setValue(resultData);
     if (null != jsonSignInfoObj) {
       String sSignTime = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm");
       Date signTime = DateUtil.stringToDate(sSignTime + ":00");
       String id = CommonUtil.GeneGUID();
       jsonSignInfoObj.put("signTime", signTime);
       jsonSignInfoObj.put("id", id);
       resultData.put("id", id);
       resultData.put("signTime", DateUtil.dateToString(signTime, "HH:mm"));
     }
     signService.doSign(jsonSignInfoObj);
   } catch (Exception e) {
     e.printStackTrace();
     responseResult.setStatus(-1);
   }
   return responseResult;
 }
コード例 #3
0
 /**
  * 查询签到异常信息 根据月份 并统计
  *
  * @return
  */
 @RequestMapping(
     value = "getExceptionKQRecordByMonth",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object getExceptionKQRecordByMonth(HttpServletRequest request) {
   // 获取请假申请信息
   DataResult dataResult = new DataResult();
   Map<String, Object> singCountInfo = new HashMap<String, Object>();
   singCountInfo.put("userId", SystemCacheUtil.getInstance().getCurrentUser().getUserid());
   singCountInfo.put(
       "monthDate",
       DateUtil.stringToDate(HttpRequestUtil.getInstance().getString("monthDate"), "yyyy-MM"));
   // 异常考勤记录
   dataResult.setData(signUserService.getExceptionKQSignByMonth(singCountInfo));
   return dataResult;
 }
コード例 #4
0
 /**
  * 签到处理
  *
  * @return
  * @throws UnsupportedEncodingException
  */
 @RequestMapping(
     value = "doRemark",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object doRemark() {
   ResponseResult responseResult = new ResponseResult();
   // 获取请假申请信息
   try {
     JSONObject jsonRemarkObj =
         JSON.parseObject(
             URLDecoder.decode(HttpRequestUtil.getInstance().getString("remarkInfo"), "UTF-8"));
     signService.doRemark(jsonRemarkObj);
   } catch (Exception e) {
     e.printStackTrace();
     responseResult.setStatus(-1);
   }
   return responseResult;
 }
コード例 #5
0
 /**
  * 发起签到
  *
  * @param model
  * @return
  */
 @RequestMapping(
     value = "launchSign",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object launchSign(HttpServletRequest request) {
   ResponseResult responseResult = new ResponseResult();
   try {
     // 获取签到发布信息
     JSONObject jsonLaunchSignInfo =
         JSON.parseObject(
             URLDecoder.decode(
                 HttpRequestUtil.getInstance().getString("launchSignInfo"), "UTF-8"));
     String id = CommonUtil.GeneGUID();
     jsonLaunchSignInfo.put("id", id);
     responseResult.setValue(id);
     signService.launchSign(jsonLaunchSignInfo);
   } catch (Exception e) {
     e.printStackTrace();
     responseResult.setStatus(-1);
   }
   return responseResult;
 }
コード例 #6
0
 /**
  * 查询签到统计到信息 根据月份
  *
  * @return
  */
 @RequestMapping(
     value = "getSignStatisticByMonth",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object getSignStatisticByMonth(HttpServletRequest request) {
   // 获取请假申请信息
   DataResult dataResult = new DataResult();
   Map<String, Object> resultData = new HashMap<String, Object>();
   Map<String, Object> singCountInfo = new HashMap<String, Object>();
   singCountInfo.put("userId", SystemCacheUtil.getInstance().getCurrentUser().getUserid());
   singCountInfo.put(
       "monthDate",
       DateUtil.stringToDate(HttpRequestUtil.getInstance().getString("monthDate"), "yyyy-MM"));
   // 签到统计
   singCountInfo.put("signType", "1");
   resultData.put("qtSignCountInfo", signUserService.getSignCountByMonth(singCountInfo));
   // 迟到早退
   singCountInfo.put("isSignException", "0");
   resultData.put("qtBeLateLeaveEarlyInfo", signUserService.getSignCountByMonth(singCountInfo));
   // 出勤率
   resultData.put("qtAttendance", signUserService.getAttendanceRateByMonth(singCountInfo));
   dataResult.setData(resultData);
   return dataResult;
 }
コード例 #7
0
  /**
   * 我发起的签到信息
   *
   * @return
   */
  @RequestMapping(value = "myLaunchSignDetailView", method = RequestMethod.GET)
  public ModelAndView myLaunchSignDetailView() {
    ModelAndView modelAndView = super.createModelAndView("myLaunch_signDetail");
    String id = HttpRequestUtil.getInstance().getString("id");
    // 需要获取签到信息
    Map<String, Object> dataMap = signService.getSignById(id);
    modelAndView.addObject("signInfo", dataMap);
    EntityAccount entityAccount = new EntityAccount();
    entityAccount.setEntityId(id);
    entityAccount.setEntityType(EntityType.QD.value());
    // 获取应签到用户
    List<EntityAccount> entityAccountList = entityAccountService.getEntityAccount(entityAccount);
    // 获取所有应签到用户
    SignUser signUser = new SignUser();
    signUser.setSignId(id);
    List<Map<String, Object>> signUserList = signUserService.getSignUser(signUser);
    // 查询已经签到用户
    List<String> userList = new ArrayList<String>();
    String userId = null;
    for (Map<String, Object> map : signUserList) {
      userId = StringUtil.getString(map.get("userId"));
      if (!userList.contains(userId)) {
        userList.add(userId);
      }
    }
    // 应该签到者
    StringBuffer shouldSignUserInfo = new StringBuffer();
    // 已签到者
    StringBuffer signUserInfo = new StringBuffer();
    // 未签到者
    StringBuffer noSignUserInfo = new StringBuffer();

    // 遍历应签到人
    for (int i = 0, size = (entityAccountList == null) ? 0 : entityAccountList.size();
        i < size;
        i++) {
      entityAccount = entityAccountList.get(i);
      userId = entityAccount.getAccountId();
      if (userList.contains(userId)) {
        signUserInfo.append(',').append(entityAccount.getAccountName());
      } else {
        noSignUserInfo.append(',').append(entityAccount.getAccountName());
      }
      shouldSignUserInfo.append(',').append(entityAccount.getAccountName());
    }

    if (signUserInfo.length() > 0) {
      signUserInfo.deleteCharAt(0);
    }
    if (noSignUserInfo.length() > 0) {
      noSignUserInfo.deleteCharAt(0);
    }
    if (shouldSignUserInfo.length() > 0) {
      shouldSignUserInfo.deleteCharAt(0);
    }
    if (StringUtils.isEmpty(signUserInfo.toString())) {
      signUserInfo.append("无");
    }
    if (StringUtils.isEmpty(noSignUserInfo.toString())) {
      noSignUserInfo.append("无");
    }
    if (StringUtils.isEmpty(shouldSignUserInfo.toString())) {
      shouldSignUserInfo.append("无");
    }
    modelAndView.addObject("signUserInfo", signUserInfo.toString());
    modelAndView.addObject("noSignUserInfo", noSignUserInfo.toString());
    modelAndView.addObject("shouldSignUserInfo", shouldSignUserInfo.toString());
    // 当前时间信息
    Date curentDate = new Date();
    modelAndView.addObject(
        "date", DateUtil.dateToString(curentDate, "MM月dd日") + DateUtil.getDayOfWeek(curentDate));
    modelAndView.addObject("time", DateUtil.dateToString(curentDate, "HH:mm"));

    // TODO 取出当月统计数据
    return modelAndView;
  }