| | |
| | | package com.vci.server.framework.delegate; |
| | | |
| | | import java.text.Collator; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.framework.data.UserInfo; |
| | | import com.vci.corba.framework.data.UserLogonInfo; |
| | | import com.vci.corba.log.data.LogType; |
| | | import com.vci.server.base.delegate.BaseDelegate; |
| | | import com.vci.server.base.delegate.UserEntityDelegate; |
| | | import com.vci.server.base.utility.LogHelper; |
| | | import com.vci.server.base.utility.LogRecordUtil; |
| | | import com.vci.server.cache.OrgCacheProvider; |
| | | import com.vci.server.common.ThreeDES; |
| | | import com.vci.server.framework.Logon.SessionInfo; |
| | |
| | | import com.vci.server.framework.cache.UserCacheUtil; |
| | | import com.vci.server.framework.interfac.SingleLogonInterface; |
| | | import com.vci.server.framework.interfac.TokenLogonInterface; |
| | | import com.vci.server.framework.systemConfig.log.LogRecordUtil; |
| | | import com.vci.server.framework.systemConfig.stafforgmanage.combination.Combination; |
| | | import com.vci.server.framework.systemConfig.stafforgmanage.combination.CombinationService; |
| | | import com.vci.server.framework.systemConfig.stafforgmanage.combination.CombinationValue; |
| | |
| | | import com.vci.server.framework.systemConfig.stafforgmanage.user.UserLogon; |
| | | import com.vci.server.framework.systemConfig.stafforgmanage.user.UserService; |
| | | import com.vci.server.framework.utils.ObjectConvert; |
| | | //import com.vci.common.LoginInfoDTO; |
| | | import com.vci.common.log.LogType; |
| | | import com.vci.common.log.ServerWithLog4j; |
| | | import com.vci.common.objects.UserEntity; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | |
| | | /** |
| | |
| | | UserInfo ui = fetchUserInfoByName(userName); |
| | | if (ui != null && ui.status == 0 && ui.pwd.equals(password)) { |
| | | res = ui; |
| | | LogRecordUtil.saveLoginLog(true, "登陆成功", userEntityInfo); |
| | | } else { |
| | | //System.out.println("===========用户=" + res.userName + "; 状态=" + res.status); |
| | | // else |
| | | LogRecordUtil.saveLogoutLog("登陆失败", userEntityInfo); |
| | | } |
| | | //System.out.println("===========用户=" + res.userName + "; 状态=" + res.status); |
| | | // else |
| | | // LogRecordUtil.writeLog(userEntity, "登陆", "登陆失败", LogType.Login, ""); |
| | | |
| | | } catch (Exception e) { |
| | | ServerWithLog4j.logger.error(e); |
| | |
| | | // log.append("用户名:"); |
| | | // User user = (User) userService.getUserInfoList(id).get(0); |
| | | // log.append("[" + user.getUserName() + "]"); |
| | | // LogRecordUtil.writeLog(userEntity, "向文件柜分配成员", "成功", log.toString(), LogType.GeneralOperation, |
| | | // LogRecordUtil.writeLog(userEntity, "向文件柜分配成员", "成功", log.toString(), LogType.General, |
| | | // pvolume.getId()); |
| | | // } |
| | | // } catch (Exception e) { |
| | |
| | | */ |
| | | public boolean saveRight(String roleId, String[] userIds, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | //UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | RoleService roleService = new RoleService(); |
| | | UserService userService = new UserService(); |
| | |
| | | // log.append("用户:"); |
| | | User user = (User) userService.getUserInfoList(id).get(0); |
| | | log.append("[" + user.getUserName() + "(" + user.getTrueName() + ")]"); |
| | | LogRecordUtil.writeLog(userEntity, "角色增加成员", "成功", log.toString(), LogType.GeneralOperation, role.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "角色增加成员", "成功", log.toString(), LogType.General, role.getId()); |
| | | } |
| | | |
| | | // 删除的人员 |
| | |
| | | log.append(role.getLogInfo() + "->[减少用户]->"); |
| | | // log.append("用户:"); |
| | | log.append("[" + u.getUserName() + "(" + u.getTrueName() + ")]"); |
| | | LogRecordUtil.writeLog(userEntity, "角色减少成员", "成功", log.toString(), LogType.GeneralOperation, role.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "角色减少成员", "成功", log.toString(), LogType.General, role.getId()); |
| | | } |
| | | |
| | | // for(String id : userIds){ |
| | |
| | | // log.append("用户名:"); |
| | | // User user = (User)userService.getUserInfoList(id).get(0); |
| | | // log.append("["+user.getUserName()+"]"); |
| | | // LogRecordUtil.writeLog(userEntity, "向角色分配成员", log.toString(), LogType.GeneralOperation, role.getId()); |
| | | // LogRecordUtil.writeLog(userEntity, "向角色分配成员", log.toString(), LogType.General, role.getId()); |
| | | // } |
| | | // LogRecordUtil.writeLog(userEntity, "向角色分配成员", role.getLogInfo() + ",角色发生变化", |
| | | // LogType.GeneralOperation, role.getId()); |
| | | // LogType.General, role.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("120306", new String[0]); |
| | | } |
| | |
| | | */ |
| | | public boolean saveSpecialRole(String roleId, String[] userIds, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | RoleService roleService = new RoleService(); |
| | | UserService userService = new UserService(); |
| | |
| | | // log.append("用户:"); |
| | | User user = (User) userService.getUserInfoList(id).get(0); |
| | | log.append("[" + user.getUserName() + "(" + user.getTrueName() + ")]"); |
| | | LogRecordUtil.writeLog(userEntity, "角色增加成员", "成功", log.toString(), LogType.GeneralOperation, role.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "角色增加成员", "成功", log.toString(), LogType.General, role.getId()); |
| | | } |
| | | |
| | | |
| | |
| | | // log.append("用户名:"); |
| | | // User user = (User)userService.getUserInfoList(id).get(0); |
| | | // log.append("["+user.getUserName()+"]"); |
| | | // LogRecordUtil.writeLog(userEntity, "角色分配成员", log.toString(), LogType.GeneralOperation,role.getId()); |
| | | // LogRecordUtil.writeLog(userEntity, "角色分配成员", log.toString(), LogType.General,role.getId()); |
| | | // } |
| | | } catch (Exception e) { |
| | | throw new VCIError("120306", new String[0]); |
| | |
| | | */ |
| | | public boolean saveRighForDept(String deptId, String[] userIds, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | DepartmentService deptService = new DepartmentService(); |
| | | |
| | |
| | | // log.append("用户:"); |
| | | User user = (User) userService.getUserInfoList(id).get(0); |
| | | log.append("[" + user.getUserName() + "(" + user.getTrueName() + ")]"); |
| | | LogRecordUtil.writeLog(userEntity, "部门增加成员", "成功", log.toString(), LogType.GeneralOperation, deptId); |
| | | LogRecordUtil.writeLog(userEntityInfo, "部门增加成员", "成功", log.toString(), LogType.General, deptId); |
| | | } |
| | | |
| | | // 删除的人员 |
| | |
| | | log.append("[").append(deptPath).append("]->[减少用户]->"); |
| | | // log.append("用户:"); |
| | | log.append("[" + u.getUserName() + "(" + u.getTrueName() + ")]"); |
| | | LogRecordUtil.writeLog(userEntity, "部门减少成员", "成功", log.toString(), LogType.GeneralOperation, deptId); |
| | | LogRecordUtil.writeLog(userEntityInfo, "部门减少成员", "成功", log.toString(), LogType.General, deptId); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new VCIError("120111", new String[0]); |
| | |
| | | |
| | | public boolean saveRights(String[] roleIds, String[] userIds, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | RoleService roleService = new RoleService(); |
| | |
| | | log.append("->"); |
| | | for (String roleId : roleIds) { |
| | | Role role = roleService.selectRole(roleId); |
| | | LogRecordUtil.writeLog(userEntity, "成员分配角色", "成功", log.toString() + "[" + role.getName() + "]", |
| | | LogType.GeneralOperation, "角色ID:" + roleId + " 用户ID:" + userId); |
| | | LogRecordUtil.writeLog(userEntityInfo, "成员分配角色", "成功", log.toString() + "[" + role.getName() + "]", |
| | | LogType.General, "角色ID:" + roleId + " 用户ID:" + userId); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public boolean saveUserDept(String[] userIds, String deptId, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | DepartmentService departmentService = new DepartmentService(); |
| | |
| | | log.append("[").append(deptPath).append("]"); |
| | | // log.append("["+user.getUserName()+"]"); |
| | | } |
| | | LogRecordUtil.writeLog(userEntity, "用户分配部门", "成功", log.toString(), LogType.GeneralOperation, |
| | | LogRecordUtil.writeLog(userEntityInfo, "用户分配部门", "成功", log.toString(), LogType.General, |
| | | "部门ID:" + deptId + " 用户id:" + userId); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | String id = ObjectUtility.getNewObjectID36(); |
| | | department.setId(id); |
| | | } |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | DepartmentService departmentService = new DepartmentService(); |
| | | UserEntityDelegate.setUserEntityToService(departmentService, userEntityInfo); |
| | | departmentService.saveDepartment(department); |
| | | // LogRecordUtil.writeLog(userEntity, "添加", department.getLogInfo(), |
| | | // LogType.GeneralOperation,department.getId()); |
| | | // LogType.General,department.getId()); |
| | | |
| | | DeptCacheUtil.getInstance().setObject(departmentInfo); |
| | | |
| | | String log = String.format("添加部门:%s [%s]", department.getName(), LogHelper.toNewLogString(department)); |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", log, LogType.GeneralOperation, department.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", log, LogType.General, department.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("120109", new String[0]); |
| | | } |
| | |
| | | Role role = ObjectConvert.changeRoleInfoToRole(roleInfo); |
| | | String id = ObjectUtility.getNewObjectID36(); |
| | | role.setId(id); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | RoleService roleService = new RoleService(); |
| | | UserEntityDelegate.setUserEntityToService(roleService, userEntityInfo); |
| | |
| | | RoleCacheUtil.getInstance().setObject(role); |
| | | |
| | | String log = String.format("添加角色:%s [%s]", role.getName(), LogHelper.toNewLogString(role)); |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", log, LogType.GeneralOperation, role.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", log, LogType.General, role.getId()); |
| | | |
| | | // LogRecordUtil.writeLog(userEntity, "添加", role.getLogInfo(), |
| | | // LogType.GeneralOperation,role.getId()); |
| | | // LogType.General,role.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | | ServerWithLog4j.logger.error(e); |
| | |
| | | } else { |
| | | id = user.getId(); |
| | | } |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userService, userEntityInfo); |
| | |
| | | UserCacheUtil.getInstance().setObject(userInfo); |
| | | |
| | | String log = String.format("添加用户:%s [%s]", user.getUserName(), LogHelper.toNewLogString(user)); |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", log, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", log, LogType.General, user.getId()); |
| | | |
| | | // LogRecordUtil.writeLog(userEntity, "添加", user.getLogInfo(), |
| | | // LogType.GeneralOperation,user.getId()); |
| | | // LogType.General,user.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | | ServerWithLog4j.logger.error(e); |
| | |
| | | public boolean updateDepartment(DeptInfo deptInfo, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | Department departmentAfter = ObjectConvert.changeDepartmentInfoToDepartment(deptInfo); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | DepartmentService departmentService = new DepartmentService(); |
| | | UserEntityDelegate.setUserEntityToService(departmentService, userEntityInfo); |
| | |
| | | DeptCacheUtil.getInstance().setObject(deptInfo); |
| | | |
| | | if (rs) |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log, LogType.GeneralOperation, departmentAfter.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log, LogType.General, departmentAfter.getId()); |
| | | else |
| | | LogRecordUtil.writeLog(userEntity, "更新", "失败", log, LogType.GeneralOperation, departmentAfter.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "失败", log, LogType.General, departmentAfter.getId()); |
| | | |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | public boolean updateRole(RoleInfo roleInfo, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | Role role = ObjectConvert.changeRoleInfoToRole(roleInfo); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | RoleService roleService = new RoleService(); |
| | | UserEntityDelegate.setUserEntityToService(roleService, userEntityInfo); |
| | |
| | | // StringBuilder log = new StringBuilder(); |
| | | // log.append("更新前:"+roleBefroe.getLogInfo()); |
| | | // log.append(" 更新后:"+role.getLogInfo()); |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log, LogType.GeneralOperation, role.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log, LogType.General, role.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | | ServerWithLog4j.logger.error(e); |
| | |
| | | public boolean updateUser(UserInfo userInfo, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | User user = ObjectConvert.changeUserInfoToUser(userInfo); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userService, userEntityInfo); |
| | |
| | | userService.updateUser(user); |
| | | |
| | | UserCacheUtil.getInstance().setObject(userInfo); |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log, LogType.General, user.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | | ServerWithLog4j.logger.error(e); |
| | |
| | | public String modifyUserPassword(String idUser, String oldPW, String newPW, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | String error = ""; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userService, userEntityInfo); |
| | |
| | | |
| | | if (StringUtils.isEmpty(user.getId())) { |
| | | error = String.format("用户ID无效:", idUser); |
| | | LogRecordUtil.writeLog(userEntity, "修改密码", "失败", error, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "修改密码", "失败", error, LogType.General, user.getId()); |
| | | return error; |
| | | } |
| | | |
| | |
| | | oldPW = des.getEncString(oldPW); |
| | | if (!user.getPassword().equals(oldPW)) { |
| | | error = String.format("更改[%s]密码失败,输入旧密码不正确!", user.getUserName()); |
| | | LogRecordUtil.writeLog(userEntity, "修改密码", "失败", error, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "修改密码", "失败", error, LogType.General, user.getId()); |
| | | return error; |
| | | //throw new VCIError("120405", new String[] {"旧密码输入不正确!"}); |
| | | } |
| | |
| | | error = checkPasswordStrategyByUserId(idUser, newPW); |
| | | |
| | | if (!StringUtils.isEmpty(error)) { |
| | | LogRecordUtil.writeLog(userEntity, "修改密码", "失败", "更改用户密码:" + user.getUserName() + "; " + error, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "修改密码", "失败", "更改用户密码:" + user.getUserName() + "; " + error, LogType.General, user.getId()); |
| | | return error; |
| | | } |
| | | |
| | |
| | | if (!rs) { |
| | | |
| | | error = "修改用户密码失败"; |
| | | LogRecordUtil.writeLog(userEntity, "修改密码", "失败", "更改用户密码:%s" + user.getUserName() +"; " + error, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "修改密码", "失败", "更改用户密码:%s" + user.getUserName() +"; " + error, LogType.General, user.getId()); |
| | | return error; |
| | | } |
| | | |
| | |
| | | |
| | | log = String.format("更改用户密码:%s", user.getUserName()); |
| | | |
| | | LogRecordUtil.writeLog(userEntity, "修改密码", "成功", log, LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "修改密码", "成功", log, LogType.General, user.getId()); |
| | | } catch (VCIError e) { |
| | | throw e; |
| | | } catch (Exception e) { |
| | |
| | | public boolean deleteDepartment(String[] id, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | // List<Department> list = new ArrayList<Department>(); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | DepartmentService departmentService = new DepartmentService(); |
| | | UserEntityDelegate.setUserEntityToService(departmentService, userEntityInfo); |
| | |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while (it.hasNext()) { |
| | | String deptId = it.next(); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", deptId, LogType.GeneralOperation, map.get(deptId)); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", deptId, LogType.General, map.get(deptId)); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | |
| | | public boolean updateDeptParentId(String id, String parentId, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | DepartmentService departmentService = new DepartmentService(); |
| | | UserEntityDelegate.setUserEntityToService(departmentService, userEntityInfo); |
| | |
| | | DeptCacheUtil.getInstance().setObject(dept); |
| | | |
| | | if (rs) { |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", parentId, LogType.GeneralOperation, id); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", parentId, LogType.General, id); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | */ |
| | | public boolean deleteRole(String[] ids, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | RoleService roleService = new RoleService(); |
| | | UserEntityDelegate.setUserEntityToService(roleService, userEntityInfo); |
| | |
| | | String id = it.next(); |
| | | RoleCacheUtil.getInstance().delObject(id); |
| | | |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", map.get(id), LogType.GeneralOperation, id); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", map.get(id), LogType.General, id); |
| | | } |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | */ |
| | | public boolean deleteUser(String[] ids, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userService, userEntityInfo); |
| | |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while (it.hasNext()) { |
| | | String id = it.next(); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", map.get(id), LogType.GeneralOperation, id); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", map.get(id), LogType.General, id); |
| | | } |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | */ |
| | | public boolean stopUsers(String[] id, boolean flag, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userService, userEntityInfo); |
| | |
| | | user.setStatus(flag ? (short)1 : (short)0); |
| | | UserCacheUtil.getInstance().setObject(user); |
| | | |
| | | LogRecordUtil.writeLog(userEntity, "停用、启用", rs ? "成功" : "失败", log.toString(), LogType.GeneralOperation, user.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "停用、启用", rs ? "成功" : "失败", log.toString(), LogType.General, user.getId()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | public boolean savePasswordStrategy(PasswordStrategyInfo info, //String[] combinationIds, |
| | | UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean res = false; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | PasswordStrategyService srv = new PasswordStrategyService(); |
| | | UserEntityDelegate.setUserEntityToService(srv, userEntityInfo); |
| | | PasswordStrategy passwordStrategy = ObjectConvert.changePassStrategyInfoToEntity(info); |
| | | res = srv.savePasswordStrategy(passwordStrategy); |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", passwordStrategy.getLogInfo(), LogType.GeneralOperation, |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", passwordStrategy.getLogInfo(), LogType.General, |
| | | passwordStrategy.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | |
| | | public boolean editPasswordStrategy(PasswordStrategyInfo info, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean res = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | PasswordStrategyService srv = new PasswordStrategyService(); |
| | | UserEntityDelegate.setUserEntityToService(srv, userEntityInfo); |
| | |
| | | |
| | | res = srv.updatePasswordStrategy(passwordStrategy); |
| | | |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log.toString(), LogType.GeneralOperation, |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log.toString(), LogType.General, |
| | | passwordStrategyBefore.getId()); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | |
| | | public boolean deletePasswordStrategy(String[] ids, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean res = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | PasswordStrategyService srv = new PasswordStrategyService(); |
| | | UserEntityDelegate.setUserEntityToService(srv, userEntityInfo); |
| | |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while (it.hasNext()) { |
| | | String logKey = it.next(); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", logKey, LogType.GeneralOperation, map.get(logKey)); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", logKey, LogType.General, map.get(logKey)); |
| | | } |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | |
| | | public boolean saveUserPasswordStrateg(String[] userIds, String passwordStrategId, UserEntityInfo userEntityInfo) |
| | | throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userService = new UserService(); |
| | | PasswordStrategyService srv = new PasswordStrategyService(); |
| | |
| | | rs = userService.saveUserPasswordStrateg(userId, passwordStrategId); |
| | | log.append("->"); |
| | | log.append(passwordStrategy.getLogInfo()); |
| | | LogRecordUtil.writeLog(userEntity, "为成员分配密码策略", "成功", log.toString(), LogType.GeneralOperation, |
| | | LogRecordUtil.writeLog(userEntityInfo, "为成员分配密码策略", "成功", log.toString(), LogType.General, |
| | | userId + "密码策略ID:" + passwordStrategId); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | public void deblock(String[] ids, UserEntityInfo userEntityInfo) throws VCIError { |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | UserService userSrv = new UserService(); |
| | | UserEntityDelegate.setUserEntityToService(userSrv, userEntityInfo); |
| | |
| | | for (String userId : ids) { |
| | | User user = (User) userSrv.getUserObjectByoid(userId); |
| | | // LogRecordUtil.writeLog(userEntity, "账户解锁", "["+user.getLogInfo()+"]", |
| | | // LogType.GeneralOperation, userId); |
| | | // LogType.General, userId); |
| | | |
| | | // add by caill 2016.9.13 |
| | | LogRecordUtil.writeLog(userEntity, LogType.UnlockUser.getLabel(), "解锁成功", "[" + user.getLogInfo() + "]", |
| | | LogRecordUtil.writeLog(userEntityInfo, "解锁用户", "解锁成功", "[" + user.getLogInfo() + "]", |
| | | LogType.UnlockUser, userId); |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 简单记录系统登入、登出日�? |
| | | * <p> |
| | | * Description: |
| | | * </p> |
| | | * |
| | | * @author wangxl |
| | | * @time 2012-12-27 |
| | | * @param message |
| | | * @param userEntityInfo |
| | | * @throws VCIError |
| | | */ |
| | | public void savelog(String message, UserEntityInfo userEntityInfo) throws VCIError { |
| | | userEntityInfo.modules = "登录模块";// add by liujw |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | LogRecordUtil.writeLog(userEntity, message, "登录成功", message, |
| | | "登入".equals(message) ? LogType.Login : LogType.Logout, user.getId()); |
| | | } |
| | | |
| | | public void saveLogV2(String result, String message, String type, int logTypeIntVal, String dataObjOid, |
| | | UserEntityInfo userEntityInfo) throws VCIError { |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | LogType logType = LogType.getByIntVal(logTypeIntVal); |
| | | LogRecordUtil.writeLog(userEntity, type, result, message, logType, dataObjOid); |
| | | } |
| | | |
| | | public void savelogfail(String message, UserEntityInfo userEntityInfo) throws VCIError { |
| | | userEntityInfo.modules = "登录模块"; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | LogRecordUtil.writeLog(userEntity, "登入", "登录失败", message, LogType.Login, user.getId()); |
| | | } |
| | | |
| | | // add by caill start 2016.9.13简单记录用户被锁定的日志 |
| | | public void blocklog(String userId, UserEntityInfo userEntityInfo) throws VCIError { |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | LogRecordUtil.writeLog(userEntity, LogType.LockUser.getLabel(), "用户锁定", |
| | | "[" + user.getLogInfo() + "]" + "在连续输入多次密码错误后导致账户被锁定", LogType.LockUser, userId); |
| | | } |
| | | // /** |
| | | // * 简单记录系统登入、登出日�? |
| | | // * <p> |
| | | // * Description: |
| | | // * </p> |
| | | // * |
| | | // * @author wangxl |
| | | // * @time 2012-12-27 |
| | | // * @param message |
| | | // * @param userEntityInfo |
| | | // * @throws VCIError |
| | | // */ |
| | | // public void savelog(String message, UserEntityInfo userEntityInfo) throws VCIError { |
| | | // userEntityInfo.modules = "登录模块";// add by liujw |
| | | // // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | // LogRecordUtil.writeLog(userEntityInfo, message, "登录成功", message, |
| | | // "登入".equals(message) ? LogType.Login : LogType.Logout, user.getId()); |
| | | // } |
| | | // |
| | | // public void saveLogV2(String result, String message, String type, int logTypeIntVal, String dataObjOid, |
| | | // UserEntityInfo userEntityInfo) throws VCIError { |
| | | // // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // LogType logType = LogType.getByIntVal(logTypeIntVal); |
| | | // LogRecordUtil.writeLog(userEntityInfo, type, result, message, logType, dataObjOid); |
| | | // } |
| | | // |
| | | // public void savelogfail(String message, UserEntityInfo userEntityInfo) throws VCIError { |
| | | // userEntityInfo.modules = "登录模块"; |
| | | // // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | // LogRecordUtil.writeLog(userEntityInfo, "登入", "登录失败", message, LogType.Login, user.getId()); |
| | | // } |
| | | // |
| | | // // add by caill start 2016.9.13简单记录用户被锁定的日志 |
| | | // public void blocklog(String userId, UserEntityInfo userEntityInfo) throws VCIError { |
| | | // // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // User user = ObjectConvert.changeUserInfoToUser(fetchUserInfoByName(userEntity.getUserName())); |
| | | // LogRecordUtil.writeLog(userEntityInfo, LogType.LockUser.getLabel(), "用户锁定", |
| | | // "[" + user.getLogInfo() + "]" + "在连续输入多次密码错误后导致账户被锁定", LogType.LockUser, userId); |
| | | // } |
| | | |
| | | /** |
| | | * 获取所有密码组合方�? |
| | |
| | | Combination comb = changeCombinationInfoToCombination(info); |
| | | String id = ObjectUtility.getNewObjectID36(); |
| | | comb.setId(id); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | CombinationService service = new CombinationService(); |
| | | UserEntityDelegate.setUserEntityToService(service, userEntityInfo); |
| | | service.saveCombination(comb); |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", comb.getLogInfo(), LogType.GeneralOperation, comb.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", comb.getLogInfo(), LogType.General, comb.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("120502", new String[0]); |
| | | } |
| | |
| | | public boolean updateCombination(CombinationInfo info, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | Combination comb = changeCombinationInfoToCombination(info); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | CombinationService service = new CombinationService(); |
| | | UserEntityDelegate.setUserEntityToService(service, userEntityInfo); |
| | |
| | | StringBuilder log = new StringBuilder(); |
| | | log.append("更新前:" + combinationBefore.getLogInfo()); |
| | | log.append(" 更新后:" + comb.getLogInfo()); |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log.toString(), LogType.GeneralOperation, comb.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log.toString(), LogType.General, comb.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("120503", new String[0]); |
| | | } |
| | |
| | | |
| | | public boolean deleteCombination(String[] id, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | CombinationService service = new CombinationService(); |
| | | UserEntityDelegate.setUserEntityToService(service, userEntityInfo); |
| | |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while (it.hasNext()) { |
| | | String logKey = it.next(); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", logKey, LogType.GeneralOperation, map.get(logKey)); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", logKey, LogType.General, map.get(logKey)); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new VCIError("120504", new String[0]); |
| | |
| | | @SuppressWarnings("unchecked") |
| | | public String saveCombinationValue(CombinationValueInfo[] valueInfos, UserEntityInfo userEntityInfo) |
| | | throws VCIError { |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | CombinationValueService service = new CombinationValueService(); |
| | | int length = valueInfos.length; |
| | | |
| | |
| | | service.saveCombinationValue(combinationValues); |
| | | |
| | | for (CombinationValue value : combinationValues) { |
| | | LogRecordUtil.writeLog(userEntity, "添加", "成功", value.getLogInfo(), LogType.GeneralOperation, value.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", value.getLogInfo(), LogType.General, value.getId()); |
| | | } |
| | | ; |
| | | |
| | |
| | | throws VCIError { |
| | | boolean rs = true; |
| | | CombinationValue combVal = changeCombinationValueInfoToVal(valueInfo); |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | CombinationValueService service = new CombinationValueService(); |
| | | |
| | | // add by liujw |
| | |
| | | log.append("更新前:" + combinationValueBefroe.getLogInfo()); |
| | | log.append(" 更新后:" + combVal.getLogInfo()); |
| | | rs = service.updateCombinationValue(combVal); |
| | | LogRecordUtil.writeLog(userEntity, "更新", "成功", log.toString(), LogType.GeneralOperation, combVal.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", log.toString(), LogType.General, combVal.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("120508", new String[0]); |
| | | } |
| | |
| | | |
| | | public boolean deletCombinationValues(String[] id, UserEntityInfo userEntityInfo) throws VCIError { |
| | | boolean rs = true; |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | CombinationValueService service = new CombinationValueService(); |
| | | CombinationService combinService = new CombinationService(); |
| | |
| | | } |
| | | } |
| | | rs = service.deleteCombinationValueByMQL(id); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "成功", log.toString(), LogType.GeneralOperation, |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", log.toString(), LogType.General, |
| | | combinIds.toString() + valuesIds.toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | */ |
| | | public void savelogGeneralOperation(String result, String message, UserEntityInfo userEntityInfo, String dataId, String plType) |
| | | throws VCIError { |
| | | UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | LogRecordUtil.writeLog(userEntity, plType, result, message, LogType.GeneralOperation, dataId); |
| | | // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | LogRecordUtil.writeLog(userEntityInfo, plType, result, message, LogType.General, dataId); |
| | | } |
| | | |
| | | /**** |