@Override public DataResult getAuditAppraisalRecord( Appraisal appraisal, Map<String, Object> params, int pageIndex, int pageSize) { DataResult dataResult = new DataResult(); SqlQueryParameter sqlQueryParameter = new SqlQueryParameter(); if (pageIndex != -1) { sqlQueryParameter.setPageIndex(pageIndex); sqlQueryParameter.setPage(true); } if (pageSize != -1) { sqlQueryParameter.setPageSize(pageSize); } sqlQueryParameter.setParameter(appraisal); if (!CollectionUtils.isEmpty(params)) { sqlQueryParameter.getKeyValMap().putAll(params); } List<Appraisal> appraisalList = appraisalDao.getAuditAppraisalRecord(sqlQueryParameter); if (!CollectionUtils.isEmpty(appraisalList)) { List<Map<String, Object>> dataMap = new ArrayList<Map<String, Object>>(); Map<String, Object> temp = null; for (Appraisal a : appraisalList) { temp = a.getPersistentState(); temp.put("screateDate", DateUtil.dateToString(a.getCreateTime(), "yyyy年MM月dd日")); temp.put( "statusDisplay", SystemCacheUtil.getInstance() .getSystemStatusCache() .get("Status_" + StringUtil.getString(temp.get("status")))); dataMap.add(temp); } dataResult.setData(dataMap); dataResult.setTotal(sqlQueryParameter.getTotalRecord()); } return dataResult; }
/** * 我发起的签到信息 * * @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; }
/** * 签到详情 * * @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; }