加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

通过WebService及存储过程等技术批量初始化系统组织数据

发布时间:2020-12-16 22:24:27 所属栏目:安全 来源:网络整理
导读:1. 使用Test Web Gateway批量注册组织部门ID Test Web Gateway用途是能从客户端发多请求测试Web Gateway的性能,例如测试WebService请求的性能,主要用途有: 接受来自客户端的多请求,测试Web Gateway性能 (‘com.eibus.Web.soap.Gateway.wcp’); 测试Java

1. 使用Test Web Gateway批量注册组织部门ID

Test Web Gateway用途是能从客户端发多请求测试Web Gateway的性能,例如测试WebService请求的性能,主要用途有:

  • 接受来自客户端的多请求,测试Web Gateway性能 (‘com.eibus.Web.soap.Gateway.wcp’);
  • 测试Java类的性能,提供的类文件中包含的类路径。

The Cordys Web gateway is the HTTP interface of Cordys BOP. The Cordys Web Gateway forwards Web requests to and receives responses from service groups. It functions as a bridge between the Web browser and the service groups that operate in Cordys BOP. Gateway is a Java object and is loaded as a Web server object in the Web server. Once it is loaded,the Gateway searches for specific service groups in Cordys BOP and passes the requests back and forth between the service groups and the Web browser.

由于系统使用了支持分布式、多租户的主键关键字,不能使用数据库直接产生,因此,需要通过调用WebService方式生成到数据库中。

1.1. 如何获取SOAP请求

打开Workspace工作台,选择对应项目(例如:RJDBXM)下的Web Services文件夹,如下图所示。

这里写图片描述

找到需要使用的WebService接口,例如:UpdateSmOrganization,选中右键弹出窗口,选中“Test Web Service Operation”,如下图所示:

这里写图片描述

如下图所示,从“Operation Test Tool”获取SOAP请求(SOAP Request)。

这里写图片描述


关于SOAP请求XML详见下段内容。

1.2. 重复调用SOAP请求批量注册组织ID

登录Cordys开发平台,在 CUSP > My Applications,点击

这里写图片描述

(Test Web Gateway),打开 The Test Web Gateway 窗口,如下图所示。

这里写图片描述

如上图所示,执行800次SOAP请求(注:已经人工初始化了200多个部门),在数据中产生800个组织ID,SOAP请求内容如下:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <UpdateSmOrganization xmlns="http://com.unicom.bopm/organization" reply="yes" commandUpdate="no" preserveSpace="no" batchUpdate="no">
      <tuple>
        <new>
          <SM_ORGANIZATION qAccess="0" qConstraint="0" qInit="0" qValues="">
            <ORG_ID></ORG_ID>
            <ORG_NAME>GMJT_ZHB</ORG_NAME>
            <PARENT_ID>875e3086-6422-11e5-f4ad-14d3e43b5f96</PARENT_ID>
            <ORG_CODE>HLJ_01</ORG_CODE>
            <TENANT_DN>dn</TENANT_DN>
            <ORG_LEVEL>1</ORG_LEVEL>
            <IS_COMPANY>0</IS_COMPANY>
            <IS_COUNTY>0</IS_COUNTY>
            <IS_VIRTUAL_ORG>0</IS_VIRTUAL_ORG>
            <IS_TENANT_ROOT>0</IS_TENANT_ROOT>
            <SORT_NO>0</SORT_NO>
            <STATUS_SIGN>0</STATUS_SIGN>
            <CREATE_PERSON>99</CREATE_PERSON>
            <DESC_MEMO>0</DESC_MEMO>
          </SM_ORGANIZATION>
        </new>
      </tuple>
    </UpdateSmOrganization>
  </SOAP:Body>
</SOAP:Envelope>

注:此处只保留操作,用于插入数据操作。

2. 从电子表格中导入组织数据

2.1. 分析、解析电子表格数据

这里写图片描述

2.2. 创建临时表并导入数据

create table TMP_ORG ( DEPTCODE VARCHAR2(40) not null,DEPTNAME VARCHAR2(100),OWNER VARCHAR2(40),DN VARCHAR2(100),DEPTID VARCHAR2(50),OWNERID VARCHAR2(50),BZ1 VARCHAR2(50) );
-- Create/Recreate primary,unique and foreign key constraints 
alter table TMP_ORG add constraint PK_TMP_ORG primary key (DEPTCODE);

导入数据操作,略。
详见:《新PaaS平台上线数据初始化经验》.

2.3. 处理数据

获取上级组织ID。

update tmp_org t set t.ownerid = (select tt.org_id from sm_organization tt where tt.org_code = t.owner);

3. 通过存储过程批量处理数据

由于组织表(sm_organization)与临时数据表间,无直接对应关系,需要编程把临时表中的数据更新到组织表中。

create or replace procedure proc_init_org is --游标,取出临时组织数据 cursor get_org_data is select deptcode,deptname,owner,ownerid from bop_pdt.tmp_org where owner not in ('HLJ','HRB');

  v_deptcode  bop_pdt.tmp_org.deptcode%type;
  v_deptname  bop_pdt.tmp_org.deptname%type;
  v_owner     bop_pdt.tmp_org.owner%type;
  v_ownerid   bop_pdt.tmp_org.ownerid%type;

  v_sqlcode        number;
  v_sqlmsg         varchar2(2000);

begin

  v_num := 0;
  open get_org_data;
  loop
    fetch get_org_data
        into v_deptcode,v_deptname,v_owner,v_ownerid;

        exit when get_org_data%notfound;

        update bop_pdt.sm_organization
          set org_code = v_deptcode,org_name = v_deptname,parent_id = v_ownerid,tenant_dn = 'o='||v_owner||',cn=cordys,cn=defaultInst,o=hlcuc.com'
        where org_code = 'GMJT_ZHB' and create_person = '99' and rownum = 1;

  end loop;
  commit;
  close get_org_data;

  exception
  when others then
    v_sqlcode := sqlcode;
    v_sqlmsg  := substr(sqlerrm,1,2000);
    dbms_output.put_line(v_sqlcode || '::' || v_sqlmsg);

end proc_init_org;

通过PL/SQL工具执行存储过程。
选择需要执行的存储过程“proc_init_org”,右键选择“Test”。

这里写图片描述

打开测试存储过程(Test script)窗口,点击“齿轮”图标来执行存储过程。

这里写图片描述

稍后,查询sm_organization表,确认组织数据导入完整。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读