ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
Source/Service/FrameService/src/com/vci/server/framework/delegate/RightManagementDelegate.java
@@ -1,13 +1,10 @@
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;
@@ -22,9 +19,11 @@
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;
@@ -33,7 +32,6 @@
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;
@@ -50,10 +48,7 @@
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;
/**
@@ -182,10 +177,12 @@
         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);
@@ -1157,7 +1154,7 @@
//            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) {
@@ -1182,7 +1179,7 @@
    */
   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();
@@ -1217,7 +1214,7 @@
            // 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());
         }
         // 删除的人员
@@ -1226,7 +1223,7 @@
            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){
@@ -1235,10 +1232,10 @@
//            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]);
      }
@@ -1257,7 +1254,7 @@
    */
   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();
@@ -1287,7 +1284,7 @@
            // 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());
         }
@@ -1297,7 +1294,7 @@
//            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]);
@@ -1321,7 +1318,7 @@
    */
   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();
@@ -1356,7 +1353,7 @@
            // 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);
         }
         // 删除的人员
@@ -1365,7 +1362,7 @@
            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]);
@@ -1376,7 +1373,7 @@
   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();
@@ -1395,8 +1392,8 @@
            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);
            }
         }
@@ -1409,7 +1406,7 @@
   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();
@@ -1441,7 +1438,7 @@
               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) {
@@ -1496,18 +1493,18 @@
         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]);
      }
@@ -1561,7 +1558,7 @@
      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);
@@ -1570,10 +1567,10 @@
         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);
@@ -1619,7 +1616,7 @@
      } else {
         id = user.getId();
      }
      UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo);
      // UserEntity userEntity = ObjectConvert.changeUserEntityInfoToUserEntity(userEntityInfo);
      try {
         UserService userService = new UserService();
         UserEntityDelegate.setUserEntityToService(userService, userEntityInfo);
@@ -1628,10 +1625,10 @@
         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);
@@ -1655,7 +1652,7 @@
   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);
@@ -1672,9 +1669,9 @@
         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();
@@ -1699,7 +1696,7 @@
   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);
@@ -1715,7 +1712,7 @@
//         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);
@@ -1776,7 +1773,7 @@
   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);
@@ -1788,7 +1785,7 @@
         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);
@@ -1816,7 +1813,7 @@
   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);
@@ -1824,7 +1821,7 @@
         
         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;
         }
         
@@ -1835,7 +1832,7 @@
         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[] {"旧密码输入不正确!"});
         }
@@ -1843,7 +1840,7 @@
         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;
         }
         
@@ -1853,7 +1850,7 @@
         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;
         }
         
@@ -1862,7 +1859,7 @@
         
         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) {
@@ -1995,7 +1992,7 @@
   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);
@@ -2012,7 +2009,7 @@
         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) {
@@ -2025,7 +2022,7 @@
   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);
@@ -2038,7 +2035,7 @@
         DeptCacheUtil.getInstance().setObject(dept);
         
         if (rs) {
            LogRecordUtil.writeLog(userEntity, "更新", "成功", parentId, LogType.GeneralOperation, id);
            LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", parentId, LogType.General, id);
         }
      } catch (Exception e) {
@@ -2063,7 +2060,7 @@
    */
   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);
@@ -2078,7 +2075,7 @@
            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();
@@ -2103,7 +2100,7 @@
    */
   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);
@@ -2119,7 +2116,7 @@
         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();
@@ -2144,7 +2141,7 @@
    */
   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);
@@ -2159,7 +2156,7 @@
            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) {
@@ -2295,13 +2292,13 @@
   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();
@@ -2314,7 +2311,7 @@
   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);
@@ -2328,7 +2325,7 @@
         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();
@@ -2340,7 +2337,7 @@
   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);
@@ -2353,7 +2350,7 @@
         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();
@@ -2390,7 +2387,7 @@
   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();
@@ -2408,7 +2405,7 @@
            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) {
@@ -2469,7 +2466,7 @@
   }
   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);
@@ -2477,10 +2474,10 @@
         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) {
@@ -2490,47 +2487,47 @@
      }
   }
   /**
    * 简单记录系统登入、登出日�?
    * <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);
//   }
   /**
    * 获取所有密码组合方�?
@@ -2590,12 +2587,12 @@
      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]);
      }
@@ -2605,7 +2602,7 @@
   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);
@@ -2614,7 +2611,7 @@
         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]);
      }
@@ -2623,7 +2620,7 @@
   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);
@@ -2636,7 +2633,7 @@
         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]);
@@ -2664,7 +2661,7 @@
   @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;
@@ -2687,7 +2684,7 @@
         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());
         }
         ;
@@ -2702,7 +2699,7 @@
         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
@@ -2720,7 +2717,7 @@
         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]);
      }
@@ -2729,7 +2726,7 @@
   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();
@@ -2755,7 +2752,7 @@
            }
         }
         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();
@@ -2934,8 +2931,8 @@
    */
   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);
   }
   /****