private void doLog(Date createTime, User opUser, String opName, Model model) throws ParseException { String opUserName = opUser == null ? "系统管理员" : opUser.getDisplayName(); String contents = getContents(createTime, opUserName, opName, model); printLogMsg(contents); saveToDb(createTime, opUserName, opName, contents); }
protected JSONObject toJsonObject(User user) throws Exception { AdminHelper record = new AdminHelper(); record.put("id", user.getId()); record.put("userName", user.getName()); record.put("userDisplayName", user.getDisplayName()); record.put("password", user.getPassword()); record.put("password2", user.getPassword()); record.put("employee", user.getEmployee()); record.put("locked", user.isLocked()); record.put("lastLoginTime", user.getLoginSession().getLastLoginTime()); record.put("logined", user.getLoginSession().isLogined()); record.put("organization", user.getEmployee().getOrganization()); record.put("role", toRoleArray(user.getRoles())); return record.getJsonObject(); }
public String getUserIsSysManager() throws Exception { Role role = roleService.getRoleByCode(Role.SYSTEM_GENERAL_STAFF); queryMap.put("roleId", role.getDbId() + ""); queryMap.put("type", "sysOperate"); List<User> list = userService.getListData(query, queryMap, 0, 0).getList(); // List<User> list = userService.getSomeUser(); JSONArray ja = new JSONArray(); for (User user : list) { JSONObject record = new JSONObject(); // Employee e = user.getEmployee(); record.put("id", user.getId()); record.put("name", user.getDisplayName()); record.put("userName", user.getName()); ja.add(record); } jo.put("data", ja); return render(jo); }