Exemple #1
0
 public boolean checkParameter(IMessage message, String processid) {
   con = (Connection) message.getOtherParameter("con");
   Str_name = message.getUserParameterValue("Str_name");
   Str_code = message.getUserParameterValue("Str_code");
   Int_instructStateID = message.getUserParameterValue("Int_instructStateID");
   Int_planIncorporate = message.getUserParameterValue("Int_planIncorporate");
   Int_instCount = message.getUserParameterValue("Int_instCount");
   int_materielruleid = message.getUserParameterValue("int_materielruleid");
   // 输出log信息
   String debug =
       "状态名:Int_instructStateID:"
           + Int_instructStateID
           + " Int_planIncorporate:"
           + Int_planIncorporate
           + " Int_instCount:"
           + Int_instCount
           + "\n";
   log.info("添加状态转换的参数: " + debug);
   if (Str_name == null) {
     message.addServiceException(
         new ServiceException(
             ServiceExceptionType.PARAMETERLOST,
             "输入参数为空",
             this.getId(),
             processid,
             new java.util.Date(),
             null));
     return false;
   }
   return true;
 }
Exemple #2
0
  public ExecuteResult doAdapterService(IMessage message, String processid)
      throws SQLException, Exception {
    try {

      ProduceUnit produceUnit = new ProduceUnit();
      produceUnit.setStr_name(Str_name);
      produceUnit.setStr_code(Str_code);
      produceUnit.setInt_instructStateID(Integer.parseInt(Int_instructStateID));
      produceUnit.setInt_planIncorporate(Integer.parseInt(Int_planIncorporate));
      produceUnit.setInt_instCount(Integer.parseInt(Int_instCount));
      produceUnit.setInt_Type(1);
      produceUnit.setInt_delete(0);
      produceUnit.setInt_materielRuleid(Integer.parseInt(int_materielruleid));
      ProduceUnitFactory factory = new ProduceUnitFactory();
      factory.saveProduceUnit(produceUnit, con);
      log.debug("保存更改单元工厂成功!");
    } catch (SQLException sqle) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.DATABASEERROR,
              "数据库操作异常",
              this.getId(),
              processid,
              new Date(),
              sqle));
      log.error("保存单元操作时,数据库异常" + sqle.toString());
      return ExecuteResult.fail;
    } catch (Exception e) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.UNKNOWN,
              e.toString(),
              this.getId(),
              processid,
              new java.util.Date(),
              e));
      log.error("保存单元操作时,未知异常" + e.toString());
      return ExecuteResult.fail;
    }
    return ExecuteResult.sucess;
  }
  @Override
  public boolean checkParameter(IMessage message, String processid) {
    con = (Connection) message.getOtherParameter("con");
    int_produnitid = message.getUserParameterValue("int_produnitid");
    int_exceptioncause = message.getUserParameterValue("int_exceptioncause");
    str_description = message.getUserParameterValue("str_description");
    int_device =
        message.getUserParameterValue("int_device") == null
            ? ""
            : message.getUserParameterValue("int_device");
    devicetype =
        message.getUserParameterValue("devicetype") == null
            ? ""
            : message.getUserParameterValue("devicetype");
    userid = message.getUserParameterValue("userid");
    int_exceptiontype = message.getUserParameterValue("int_exceptiontype");
    int_device = int_device == null ? "" : int_device;
    devicetype = devicetype == null ? "" : devicetype;

    // 输出log信息
    String debug =
        " 生产单元 :" + int_produnitid + ";" + "描述:" + str_description + ";" + "设备号:" + int_device;
    log.debug("添加异常记录用户提交的参数: " + debug);

    if (int_produnitid == null || str_description == null || int_exceptioncause == null) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.PARAMETERLOST,
              "输入参数为空",
              this.getId(),
              processid,
              new java.util.Date(),
              null));
      log.fatal("生产单元、描述、异常原因中有为空参数,退出服务。");
      return false;
    }
    return true;
  }
  public ExecuteResult doService(IMessage message, String soa_processid) {
    // 获取运行流程项
    IProcess process = ProcessFactory.getInstance(soa_processid);
    String processInfo = process.getNameSpace() + "." + process.getName();
    // 初始化服务运行参数,如失败,返回执行结果
    if (!initFordo(message, soa_processid)) {
      log.error(processInfo + ",修改适配器,初始化服务运行参数失败");
      return ExecuteResult.fail;
    }

    try {
      Statement stmt = null;
      ResultSet rs = null;
      try {
        IDAO_Core dao = DAOFactory_Core.getInstance(DataBaseType.getDataBaseType(con));
        if (dao == null) {
          message.addServiceException(
              new ServiceException(
                  ServiceExceptionType.UNKNOWNDATABASETYPE,
                  "未知的数据库类型",
                  this.getId(),
                  soa_processid,
                  new Date(),
                  null));
          log.error(processInfo + ",修改适配器中,数据库加载类型错误,未知的数据库类型");
          return ExecuteResult.fail;
        }
        log.debug(processInfo + ",修改适配器中,数据库加载成功");
        stmt = con.createStatement();

        Map<String, String> data = new HashMap<String, String>();
        String map_processid = null;
        String map_i_serveralias = null;
        String map_i_parameter = null;
        String map_source = null;
        String map_o_serveralias = null;
        String map_o_parameter = null;
        String data_sql_select = dao.getSQL_QueryAdepterInfo(processid);
        log.debug(processInfo + "查询此流程号的所有信息的sql语句: data_sql_select = " + data_sql_select);
        rs = stmt.executeQuery(data_sql_select);
        while (rs.next()) {
          map_processid = rs.getString(1);
          map_i_serveralias = rs.getString(2);
          map_i_parameter = rs.getString(3);
          map_source = rs.getString(4);
          map_o_serveralias = rs.getString(5);
          map_o_parameter = rs.getString(6);
        }
        String debug_result_map =
            "select_map_processid = "
                + map_processid
                + "\n"
                + "select_map_i_serveralias = "
                + map_i_serveralias
                + "\n"
                + "select_map_i_parameter = "
                + map_i_parameter
                + "\n"
                + "select_map_source = "
                + map_source
                + "\n"
                + "select_map_o_serveralias = "
                + map_o_serveralias
                + "\n"
                + "select_map_o_parameter = "
                + map_o_parameter;
        log.debug(
            processInfo
                + " , "
                + this.getClass().getName()
                + "查询此流程号的所有信息是: debug_result_map = "
                + debug_result_map);
        data.put("map_processid", map_processid);
        data.put("map_i_serveralias", map_i_serveralias);
        data.put("map_i_parameter", map_i_parameter);
        data.put("map_source", map_source);
        data.put("map_o_serveralias", map_o_serveralias);
        data.put("map_o_parameter", map_o_parameter);
        message.setOtherParameter(this.getClass().getName(), data);
        /*
         * 修改适配器
         */
        String sql_update =
            dao.getSQL_UpdateAdapterInfo(
                processid, i_serveralias, i_parameter, source, o_serveralias, o_parameter);
        log.debug("根据流程号,输入服务别名,输入参数名,更新数据来源号,输出服务别名,输出参数名的sql语句: " + "sql_update = " + sql_update);
        stmt.executeUpdate(sql_update);
        /** 启用新适配器 */
        MessageAdapterFactory.loadAllMessageAdapter(con);
      } catch (SQLException sqle) {
        message.addServiceException(
            new ServiceException(
                ServiceExceptionType.DATABASEERROR,
                "数据库操作异常",
                this.getId(),
                soa_processid,
                new Date(),
                sqle));
        log.fatal(processInfo + ",修改适配器_数据库操作异常:" + sqle.toString());
        return ExecuteResult.fail;
      } finally {
        if (rs != null) rs.close();
        if (stmt != null) stmt.close();
      }
    } catch (Exception e) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.UNKNOWN,
              e.toString(),
              this.getId(),
              soa_processid,
              new java.util.Date(),
              e));
      log.fatal(processInfo + ",修改适配器时出现未知异常" + e.toString());
      return ExecuteResult.fail;
    }
    return ExecuteResult.sucess;
  }
 @SuppressWarnings("unchecked")
 @Override
 public ExecuteResult undoService(IMessage message, String soa_processid) {
   IProcess process = ProcessFactory.getInstance(soa_processid);
   String processInfo = process.getNameSpace() + "." + process.getName();
   Object obj = message.getOtherParameter(this.getClass().getName());
   if (obj instanceof Map) {
     Map<String, String> map = (Map<String, String>) obj;
     String map_processid = map.get("map_processid");
     String map_i_serveralias = map.get("map_i_serveralias");
     String map_i_parameter = map.get("map_i_parameter");
     String map_source = map.get("map_source");
     String map_o_serveralias = map.get("map_o_serveralias");
     String map_o_parameter = map.get("map_o_parameter");
     String debug_map =
         "map_processid = "
             + map_processid
             + "\n"
             + "map_i_serveralias = "
             + map_i_serveralias
             + "\n"
             + "map_i_parameter = "
             + map_i_parameter
             + "\n"
             + "map_source = "
             + map_source
             + "\n"
             + "map_o_serveralias = "
             + map_o_serveralias
             + "\n"
             + "map_o_parameter = "
             + map_o_parameter;
     log.debug(
         processInfo
             + " , "
             + this.getClass().getName()
             + "修改适配器中回退操作Map接收到的值: debug_map = "
             + debug_map);
     try {
       Statement stmt = null;
       try {
         IDAO_Core dao = DAOFactory_Core.getInstance(DataBaseType.getDataBaseType(con));
         if (dao == null) {
           message.addServiceException(
               new ServiceException(
                   ServiceExceptionType.UNKNOWNDATABASETYPE,
                   "dao为空",
                   this.getId(),
                   soa_processid,
                   new Date(),
                   null));
           log.error(processInfo + ",修改适配器回退操作时,数据库加载错误,未知的数据库类型");
           return ExecuteResult.fail;
         }
         log.debug(processInfo + ",修改流程服务回退操作,数据库加载成功");
         stmt = con.createStatement();
         String undo_sql_update =
             dao.getSQL_UpdateAdapterInfo(
                 map_processid,
                 map_i_serveralias,
                 map_i_parameter,
                 map_source,
                 map_o_serveralias,
                 map_o_parameter);
         log.debug(
             processInfo
                 + " , "
                 + this.getClass().getName()
                 + "修改适配器回退操作的sql语句: undo_sql_update = "
                 + undo_sql_update);
         stmt.executeUpdate(undo_sql_update);
       } catch (SQLException sqle) {
         message.addServiceException(
             new ServiceException(
                 ServiceExceptionType.DATABASEERROR,
                 "数据库错误" + sqle,
                 this.getId(),
                 soa_processid,
                 new Date(),
                 sqle));
         log.fatal(processInfo + ",修改适配器回退操作,数据库异常" + sqle.toString());
         return ExecuteResult.fail;
       } finally {
         if (stmt != null) stmt.close();
       }
     } catch (Exception e) {
       message.addServiceException(
           new ServiceException(
               ServiceExceptionType.UNKNOWN,
               e.toString(),
               this.getId(),
               soa_processid,
               new java.util.Date(),
               e));
       log.fatal(processInfo + ",修改适配器回退操作,未知异常" + e.toString());
       return ExecuteResult.fail;
     }
   }
   return ExecuteResult.sucess;
 }
  private boolean initFordo(IMessage message, String soa_processid) {
    // 数据库连接
    con = null;
    // 流程号
    processid = null;
    // 输入端服务别名
    i_serveralias = null;
    // 输入端的参数名
    i_parameter = null;
    // 数据来源
    source = null;
    // 输出端的服务别名
    o_serveralias = null;
    // 输出端的参数名
    o_parameter = null;

    // 获取该服务的输入参数的值
    con = (Connection) message.getOtherParameter("con");

    processid = message.getUserParameterValue("processid");
    i_serveralias = message.getUserParameterValue("i_serveralias");
    i_parameter = message.getUserParameterValue("i_parameter");
    source = message.getUserParameterValue("source");
    o_serveralias = message.getUserParameterValue("o_serveralias");
    o_parameter = message.getUserParameterValue("o_parameter");
    // 获取运行流程项
    IProcess process = ProcessFactory.getInstance(soa_processid);
    String processInfo = process.getNameSpace() + "." + process.getName();
    String debug_Service_UpdateAdapter =
        "流程号: processid = "
            + processid
            + "\n\r"
            + "输入端服务别名: i_serveralias = "
            + i_serveralias
            + "\n\r"
            + "输入端的参数名: i_parameter = "
            + i_parameter
            + "\n\r"
            + "数据来源: source = "
            + source
            + "\n\r"
            + "输出端的服务别名: o_serveralias = "
            + o_serveralias
            + "\n\r"
            + "输出端的参数名: o_parameter = "
            + o_parameter
            + "\n\r"
            + "数据库连接: con = "
            + con
            + "\n\r";

    log.debug(processInfo + ",修改适配器: " + debug_Service_UpdateAdapter + "\n");

    if (processid == null
        || i_serveralias == null
        || i_parameter == null
        || source == null
        || o_serveralias == null
        || o_parameter == null) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.PARAMETERLOST,
              "缺少输入参数",
              this.getId(),
              soa_processid,
              new java.util.Date(),
              null));
      log.error(processInfo + ",修改适配器操作中,缺少输入参数" + "\n");

      return false;
    }
    return true;
  }
  public ExecuteResult doService(IMessage message, String soa_processid) {
    // 获取运行流程项
    IProcess process = ProcessFactory.getInstance(soa_processid);
    String processInfo = process.getNameSpace() + "." + process.getName();
    if (!initFordo(message, soa_processid)) {
      log.error(processInfo + ",修改用户,初始化服务运行失败");
      return ExecuteResult.fail;
    }

    try {
      Statement stmt = null;
      ResultSet rs = null;
      try {
        IDAO_UserManager dao =
            DAOFactory_UserManager.getInstance(DataBaseType.getDataBaseType(con));
        if (dao == null) {
          message.addServiceException(
              new ServiceException(
                  ServiceExceptionType.UNKNOWNDATABASETYPE,
                  "",
                  this.getId(),
                  soa_processid,
                  new Date(),
                  null));
          log.error(processInfo + ",修改用户,加载数据库错误,未知的数据库类型");
          return ExecuteResult.fail;
        }
        log.debug(processInfo + ",修改用户,加载数据库成功");
        stmt = con.createStatement();
        String sql_check = dao.getSQL_QueryCountForUserNo(usrno);
        log.debug("取得用户id是否重复的sql语句: sql_check = " + sql_check);
        rs = stmt.executeQuery(sql_check);
        int count = 0;
        if (rs.next()) {
          count = rs.getInt(1);
        }
        if (count == 0) {
          message.addServiceException(
              new ServiceException(
                  ServiceExceptionType.UNKNOWN,
                  "没有要更新的数据!",
                  this.getId(),
                  soa_processid,
                  new Date(),
                  null));
          log.error(processInfo + ",修改用户时,没有要更新的数据  count = " + count);
          return ExecuteResult.fail;
        }

        /*
         * 查询所有参数放入Map中
         */
        Map<String, String> data = new HashMap<String, String>();
        String rs_usrno = null;
        String rs_usrname = null;
        String rs_password = null;
        String rs_employeeid = null;
        String rs_state = null;
        String rs_lastupdateuser = null;
        String rs_lastupdatetime = null;
        String rs_note = null;
        String rs_enabled = null;
        String map_sql_select = dao.getSQL_QueryUserInfoForUserID(usrno);
        log.debug(processInfo + "查询此用户所有参数的sql语句: map_sql_select = " + map_sql_select);
        rs = stmt.executeQuery(map_sql_select);
        while (rs.next()) {
          rs_usrno = rs.getString(1);
          rs_usrname = rs.getString(2);
          rs_password = rs.getString(3);
          rs_employeeid = rs.getString(5);
          rs_state = rs.getString(6);
          rs_lastupdateuser = rs.getString(7);
          rs_lastupdatetime = rs.getString(8);
          rs_note = rs.getString(9);
          rs_enabled = rs.getString(10);
        }
        String rs_debug =
            "rs_usrno = "
                + rs_usrno
                + "\n"
                + "rs_usrname = "
                + rs_usrname
                + "\n"
                + "rs_password = "******"\n"
                + "rs_employeeid = "
                + rs_employeeid
                + "\n"
                + "rs_state = "
                + rs_state
                + "\n"
                + "rs_lastupdateuser = "******"\n"
                + "rs_lastupdatetime = "
                + rs_lastupdatetime
                + "\n"
                + "rs_note = "
                + rs_note
                + "\n"
                + "rs_enabled = "
                + rs_enabled;
        log.debug(processInfo + "查询的所有信息为: rs_debug = " + rs_debug);
        data.put("rs_usrno", rs_usrno);
        data.put("rs_usrname", rs_usrname);
        data.put("rs_password", rs_password);
        data.put("rs_oldRoleno", oldRoleno);
        data.put("rs_old_default_roleno", old_default_roleno);
        data.put("rs_employeeid", rs_employeeid);
        data.put("rs_state", rs_state);
        data.put("rs_lastupdateuser", rs_lastupdateuser);
        data.put("rs_lastupdatetime", rs_lastupdatetime);
        data.put("rs_note", rs_note);
        data.put("rs_enabled", rs_enabled);
        message.setOtherParameter(this.getClass().getName(), data);

        String sql_update;
        // password be changed
        if (!password.equals("********")) {
          sql_update =
              dao.getSQL_UpdateUser(
                  usrno,
                  usrname,
                  password,
                  employeeid,
                  state,
                  lastupdateuser,
                  lastupdatetime,
                  note,
                  enabled);
        } else // password not changed
        {
          sql_update =
              dao.getSQL_UpdateUser(
                  usrno, usrname, employeeid, state, lastupdateuser, lastupdatetime, note, enabled);
        }
        log.debug("根据用户id,更改用户信息,包括密码的sql语句: sql_update = " + sql_update);
        stmt.executeUpdate(sql_update);
        String sql_deleteDataUserRole = "";
        String sql_insertDataUserRole = "";

        String[] role_new = roleno.split(":");
        sql_deleteDataUserRole = dao.getSQL_DeleteDataUserRole(new Integer(usrno));
        log.debug("根据角色号,删除原有角色号的sql语句:sql_deleteDataUserRole = " + sql_deleteDataUserRole);
        stmt.executeUpdate(sql_deleteDataUserRole);
        for (String ch : role_new) {
          if (ch != null && !ch.equals("")) {
            if (default_roleno.equals(ch)) {
              sql_insertDataUserRole =
                  dao.getSQL_insertDataUserRole(new Integer(usrno), new Integer(ch), "0");
            } else {
              sql_insertDataUserRole =
                  dao.getSQL_insertDataUserRole(new Integer(usrno), new Integer(ch), "1");
            }
            log.debug(
                "插入新角色号data_user_role表的sql语句: sql_insertDataUserRole = " + sql_insertDataUserRole);
            stmt.executeUpdate(sql_insertDataUserRole);
          }
        }

      } catch (SQLException sqle) {
        message.addServiceException(
            new ServiceException(
                ServiceExceptionType.DATABASEERROR,
                "数据库错误" + sqle,
                this.getId(),
                soa_processid,
                new Date(),
                sqle));
        log.fatal(processInfo + ",修改用户,数据库操作异常" + sqle.toString());
        return ExecuteResult.fail;
      } finally {
        if (rs != null) rs.close();
        if (stmt != null) stmt.close();
      }
    } catch (Exception e) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.UNKNOWN,
              e.toString(),
              this.getId(),
              soa_processid,
              new java.util.Date(),
              e));
      log.fatal(processInfo + ",修改用户,未知异常" + e.toString());
      return ExecuteResult.fail;
    }
    return ExecuteResult.sucess;
  }
  private boolean initFordo(IMessage message, String soa_processid) {

    con = null;
    usrno = null;
    usrname = null;
    password = null;
    roleno = null;
    employeeid = null;
    state = null;
    lastupdateuser = null;
    lastupdatetime = null;
    note = null;
    enabled = null;
    oldRoleno = null;

    con = (Connection) message.getOtherParameter("con");
    usrno = message.getUserParameterValue("usrno");
    usrname = message.getUserParameterValue("usrname");
    password = message.getUserParameterValue("password");
    roleno = message.getUserParameterValue("roleno").trim();
    oldRoleno = message.getUserParameterValue("oldRoleno").trim();
    default_roleno = message.getUserParameterValue("default_roleno");
    old_default_roleno = message.getUserParameterValue("old_default_roleno");
    employeeid = message.getUserParameterValue("employeeid");
    state = message.getUserParameterValue("state");
    lastupdateuser = message.getUserParameterValue("lastupdateuser");
    lastupdatetime = message.getUserParameterValue("lastupdatetime");
    note = message.getUserParameterValue("note");
    enabled = message.getUserParameterValue("enabled");
    // 获取运行流程项
    IProcess process = ProcessFactory.getInstance(soa_processid);
    String processInfo = process.getNameSpace() + "." + process.getName();
    String debug_UpdateUser =
        "******"
            + usrno
            + "\n"
            + "usrname = "
            + usrname
            + "\n"
            + "password = "******"\n"
            + "roleno = "
            + roleno
            + "\n"
            + "oldRoleno = "
            + oldRoleno
            + "\n"
            + "default_roleno = "
            + default_roleno
            + "\n"
            + "old_default_roleno = "
            + old_default_roleno
            + "\n"
            + "employeeid = "
            + employeeid
            + "\n"
            + "state = "
            + state
            + "\n\r"
            + "lastupdateuser = "******"\n"
            + "lastupdatetime = "
            + lastupdatetime
            + "\n"
            + "note = "
            + note
            + "\n"
            + "enabled = "
            + enabled
            + "\n";
    log.debug(processInfo + ",修改用户时用户提交的参数: " + debug_UpdateUser);

    if (usrno == null
        || usrname == null
        || password == null
        || roleno == null
        || employeeid == null
        || state == null
        || lastupdateuser == null
        || lastupdatetime == null
        || note == null
        || enabled == null) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.PARAMETERLOST,
              "添加用户时参数为空",
              this.getId(),
              soa_processid,
              new java.util.Date(),
              null));
      log.error(processInfo + ",修改用户,缺少输入参数");
      return false;
    }
    return true;
  }
  @SuppressWarnings("unchecked")
  public ExecuteResult undoService(IMessage message, String soa_processid) {
    IProcess process = ProcessFactory.getInstance(soa_processid);
    String processInfo = process.getNameSpace() + "." + process.getName();
    Object obj = message.getOtherParameter(this.getClass().getName());
    if (obj instanceof Map) {
      Map<String, String> map = (Map<String, String>) obj;
      String map_usrno = map.get("rs_usrno");
      String map_usrname = map.get("rs_usrname");
      String map_password = map.get("rs_password");
      String map_oldRoleno = map.get("rs_oldRoleno").trim();
      String map_employeeid = map.get("rs_employeeid").trim();
      String map_old_default_roleno = map.get("rs_old_default_roleno");
      String map_state = map.get("rs_state");
      String map_lastupdateuser = map.get("rs_lastupdateuser");
      String map_lastupdatetime = map.get("rs_lastupdatetime");
      String map_note = map.get("rs_note");
      String map_enabled = map.get("rs_enabled");
      String map_debug =
          "map_usrno = "
              + map_usrno
              + "\n"
              + "map_usrname = "
              + map_usrname
              + "\n"
              + "map_password = "******"\n"
              + "map_oldRoleno = "
              + map_oldRoleno
              + "\n"
              + "map_employeeid = "
              + map_employeeid
              + "\n"
              + "map_state = "
              + map_state
              + "\n"
              + "map_lastupdateuser = "******"\n"
              + "map_lastupdatetime = "
              + map_lastupdatetime
              + "\n"
              + "map_note = "
              + map_note
              + "\n"
              + "map_enabled = "
              + map_enabled;
      log.debug(processInfo + "修改用户回退操作Map接收的所有信息为: map_debug = " + map_debug);
      try {
        Statement stmt = null;
        try {
          IDAO_UserManager dao =
              DAOFactory_UserManager.getInstance(DataBaseType.getDataBaseType(con));
          if (dao == null) {
            message.addServiceException(
                new ServiceException(
                    ServiceExceptionType.UNKNOWNDATABASETYPE,
                    "",
                    this.getId(),
                    soa_processid,
                    new Date(),
                    null));
            log.error(processInfo + ",修改用户回退操作,加载数据库错误,未知的数据库类型");
            return ExecuteResult.fail;
          }
          log.debug(processInfo + ",修改用户回退操作,加载数据库成功");
          stmt = con.createStatement();
          String undo_sql_update;
          // password be changed
          if (!password.equals("********")) {
            undo_sql_update =
                dao.getSQL_UpdateUser(
                    map_usrno,
                    map_usrname,
                    map_password,
                    map_employeeid,
                    map_state,
                    map_lastupdateuser,
                    map_lastupdatetime,
                    map_note,
                    map_enabled);
          } else // password not changed
          {
            undo_sql_update =
                dao.getSQL_UpdateUser(
                    map_usrno,
                    map_usrname,
                    map_employeeid,
                    map_state,
                    map_lastupdateuser,
                    map_lastupdatetime,
                    map_note,
                    map_enabled);
          }
          log.debug("修改用户回退操作的sql语句: undo_sql_update = " + undo_sql_update);
          stmt.executeUpdate(undo_sql_update);

          String sql_deleteDataUserRole = "";
          String sql_insertDataUserRole = "";

          String[] role_old = map_oldRoleno.split(":");
          sql_deleteDataUserRole = dao.getSQL_DeleteDataUserRole(new Integer(map_usrno));
          log.debug("根据角色号,删除新角色号的sql语句:sql_deleteDataUserRole = " + sql_deleteDataUserRole);
          stmt.executeUpdate(sql_deleteDataUserRole);
          for (String ch : role_old) {
            if (ch != null && !ch.equals("")) {
              if (map_old_default_roleno.equals(ch)) {
                sql_insertDataUserRole =
                    dao.getSQL_insertDataUserRole(new Integer(usrno), new Integer(ch), "0");
              } else {
                sql_insertDataUserRole =
                    dao.getSQL_insertDataUserRole(new Integer(usrno), new Integer(ch), "1");
              }
              log.debug(
                  "插入原有角色号data_user_role表的sql语句: sql_insertDataUserRole = "
                      + sql_insertDataUserRole);
              stmt.executeUpdate(sql_insertDataUserRole);
            }
          }

        } catch (SQLException sqle) {
          message.addServiceException(
              new ServiceException(
                  ServiceExceptionType.DATABASEERROR,
                  "数据库错误" + sqle,
                  this.getId(),
                  soa_processid,
                  new Date(),
                  sqle));
          log.fatal(processInfo + ",修改用户,数据库操作异常" + sqle.toString());
          return ExecuteResult.fail;
        } finally {
          if (stmt != null) stmt.close();
        }
      } catch (Exception e) {
        message.addServiceException(
            new ServiceException(
                ServiceExceptionType.UNKNOWN,
                e.toString(),
                this.getId(),
                soa_processid,
                new java.util.Date(),
                e));
        log.fatal(processInfo + ",修改用户,未知异常" + e.toString());
        return ExecuteResult.fail;
      }
    }
    return ExecuteResult.sucess;
  }
  @Override
  public ExecuteResult doAdapterService(IMessage message, String processid)
      throws SQLException, Exception {
    try {
      try {

        stmt = con.createStatement();
        DAO_Device dao_device =
            (DAO_Device)
                DAOFactoryAdapter.getInstance(DataBaseType.getDataBaseType(con), DAO_Device.class);
        String sql = dao_device.getTypeidByname(devicetype);
        Statement stat1 = con.createStatement();
        log.debug("查询typeid:" + sql);
        ResultSet type = stat1.executeQuery(sql);
        while (type.next()) {
          devicetypeid = type.getInt(1);
        }
        log.info("类型号:" + devicetypeid);
        String sql2 = dao_device.getDeviceidBytype(int_device, devicetypeid);
        Statement stat2 = con.createStatement();
        log.debug("查询deviceid:" + sql2);
        ResultSet device = stat2.executeQuery(sql2);
        while (device.next()) {
          deviceid = device.getInt(1);
        }
        log.info("类型号:" + deviceid);

        ExceptionRecord er = new ExceptionRecord();
        er.setProduceUnitId(new Integer(int_produnitid));
        er.setDescription(str_description);
        er.setExceptionCauseId(new Integer(int_exceptioncause));
        er.setExceptionTypeId(new Integer(int_exceptiontype));
        er.setUserId(new Integer(userid));
        er.setDevicetypeid(devicetypeid);
        er.setDeviceid(deviceid);
        factory.createExceptionRecord(er, con);
        log.info("添加异常记录服务成功!");

      } catch (SQLException sqle) {
        message.addServiceException(
            new ServiceException(
                ServiceExceptionType.DATABASEERROR,
                "数据库操作异常",
                this.getId(),
                processid,
                new Date(),
                sqle));
        log.error("数据库异常,中断服务。");
        return ExecuteResult.fail;
      } finally {
        if (stmt != null) stmt.close();
        if (con != null) con.close();
      }
    } catch (Exception e) {
      message.addServiceException(
          new ServiceException(
              ServiceExceptionType.UNKNOWN,
              e.toString(),
              this.getId(),
              processid,
              new java.util.Date(),
              e));
      log.error("未知异常,中断服务。");
      return ExecuteResult.fail;
    }
    return ExecuteResult.sucess;
  }