# 七、常见问题

# 源代码编译打包方法

# 前端

1.安装nodejs,下载并安装nodejs:http://nodejs.cn/download/

2.下载前端源代码,将前端源代码下载到本地。

3.编译打包

  • 执行登录私服命令: npm login --registry=http://119.255.194.80:8081/repository/npm-public/
  • 输入用户名:vue-admin
  • 输入密码:hos1234qwer
  • 输入邮箱:chenyuan@mediway.cn
  • 执行安装依赖命令:npm install --registry=http://119.255.194.80:8081/repository/npm-public/

4.打包:npm run build,dist目录即为打好包的前端程序,用于后续部署。

# 后端

HOS平台提供的jar包都已经上传到maven私服上,可以从私服上直接下载使用。

  • 私服地址:http://119.255.194.80:8081/
  • 用户名/密码:guest/guest

1.前提准备,安装并配置jdk和maven,具体版本:

  • JDK: 1.8
  • Maven: 3.3+

2.maven私服配置:在C盘的当前用户目录里面找到 .m2目录下的settings.xml文件(或者在maven安装目录下的conf目录里), 如果没有settings.xml的话,可以将示例文件复制到该目录中。

中添加如下server:

    <server>
        <id>nexus</id>
        <username>guest</username>
        <password>guest</password>
    </server>

中添加如下mirror:

<mirror>
    <id>nexus</id>
    <name>nexus maven</name>
    <url>http://119.255.194.80:8081/repository/maven-public/</url>
    <mirrorOf>*</mirrorOf>
</mirror>

完整的Maven setting文件示例如下:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!--自定义仓库地址-->
    <localRepository>D:\repository</localRepository>
 

	<servers>
		<server>
			<id>nexus</id>
			<username>guest</username>
			<password>guest</password>
		</server>
	</servers>


    <mirrors>
        <mirror>
			<id>alimaven</id>
			<name>aliyun maven</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
		
		<mirror>
			<id>nexus</id>
			<name>nexus maven</name>
			<url>http://119.255.194.80:8081/repository/maven-public/</url>
			<mirrorOf>*</mirrorOf>
		</mirror>
	
    </mirrors>


    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>http://119.255.194.80:8081/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                     <id>central</id>
                     <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                     <releases>
                         <enabled>true</enabled>
                     </releases>
                     <snapshots>
                         <enabled>true</enabled>
                     </snapshots>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>guanwang</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://repository.sonatype.org/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>guanwang1</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://central.maven.org/maven2</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
        
        <profile>
            <id>guanwang2</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://maven.atlassian.com/repository/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        
        </profile>
    </profiles>
    
</settings>

3.下载源代码:下载后端服务的源代码到本地机器。 4.编译打包:使用mvn命令打包:

mvn clean package -Dmaven.test.skip=true

打好的jar包所在目录:

  • 开放平台:hos-open-runner/target/hos-open-platform.jar
  • 统一认证:hos-authserver-runner/target/hos-authserver-runner.jar

# 源代码编译问题

问题1:前端vue代码install时报错:npm ERR! code EINTEGRITY npm ERR! sha512-XXX,类似下图:

img.png

问题分析:使用不同版本nodejs(npm)对代码进行过编译造成的,需要清理缓存。

解决方案:

  • 删除源码的package-lock.json文件。
  • 执行 npm cache clean --force清理缓存。

# keepalived配置后主备服务器都存在vip的问题

原因:可能是因为服务器所在网络环境禁用了组播

方案:修改为单播方式

#/etc/keepalived/keepalived.conf,在主备服务器的配置文件中增加内容:
    unicast_src_ip 本机IP地址
    unicast_peer {
        另一台服务器IP地址
    }

#以下是配置文件完整示例:
global_defs {
   router_id hos-1
}

vrrp_instance VI_1 {
    state MASTER
        # 该实例绑定的网卡名称,根据实际修改
    interface eth0
    virtual_router_id 211
    priority 100
    advert_int 1
    unicast_src_ip 172.16.6.81
    unicast_peer {
        172.16.6.82
    }
    authentication {
        auth_type PASS
        auth_pass 2111
    }
        # 修改为医院提供的虚拟vip
    virtual_ipaddress {
        172.16.6.79
    }
}

# HOS依赖系统配置

# 工作流系统配置

1.注册租户。进入工作流平台,为统一用户平台注册一个租户,并记住租户id信息,后续统一用户平台启动的配置文件中会使用到该租户id。配置如下图。

2.配置通用接口。注册租户完成后,点击进入通用服务管理,配置所有统一用户平台可支持的基础信息接口,ip地址根据实际情况配置。配置如下图。

需要配置的16个通用接口(服务类型为restful)如下:

  • 获取用户集合通过部门ID

编码:getUsersByDeptId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/select-org-account

服务参数:deptId

  • 获取上级部门领导通过用户ID

编码:getParentSuperiorByUserId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-parent-leader-by-account-id

服务参数:userId

  • 获取用户通过用户ID

编码:getUserById

url:http://统一用户平台后端ip:port/api/openApi/org/flow/select-account

服务参数:userCode

  • 获取上级部门分管领导通过用户ID

编码:getParentLeaderByUserId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-pb-leader-by-account-id

服务参数:userId

  • 获取所有分管领导

编码:getAllSuperior

url:http://统一用户平台后端ip:port/openApi/org/flow/org-all-branch-leader

服务参数:无

  • 获取部门通过部门ID

编码:getDeptById

url:http://统一用户平台后端ip:port/api/openApi/org/flow/orginfo

服务参数:deptId

  • 获取所有角色

编码:getAllRole

url:http://统一用户平台后端ip:port/api/openApi/org/flow/get-all-role

服务参数:无

  • 获取用户集合通过角色ID

编码:getUsersByRoleId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/get-user-by-post

服务参数:roleId

  • 获取所有部门领导

编码:getAllDeptLeader

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-all-leader

服务参数:无

  • 获取分管领导通过用户ID

编码:getSuperiorByUserId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-branch-leader-by-account-id

服务参数:userId

  • 获取所有职务

编码:getAllPosition

url:http://统一用户平台后端ip:port/api/openApi/org/flow/get-all-prof

服务参数:无

  • 获取部门领导通过部门ID

编码:getLeaderByDeptId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-leader-by-id

服务参数:deptId

  • 获取所有部门

编码:getAllDept

url:http://统一用户平台后端ip:port/api/openApi/org/flow/all-orginfo

服务参数:无

  • 获取部门分管领导通过部门ID

编码:getSuperiorByDeptId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-branch-leader-by-id

服务参数:deptId

  • 获取所有用户

编码:getAllUser

url:http://统一用户平台后端ip:port/api/openApi/org/flow/select-all-account

服务参数:无

  • 获取部门领导通过用户ID

编码:getLeaderByUserId

url:http://统一用户平台后端ip:port/api/openApi/org/flow/org-leader-by-account-id

服务参数:userId

3.配置回调接口。当表单审批结束后,需实时响应结果的业务要配置回调接口,ip地址根据实际情况配置。配置如下图。

接口信息如下(服务类型为restful):

  • hos推送接口

编码:hospush

url:http://统一用户平台后端ip:port/api/openApi/approve/callback/finish

# 服务总线

需要依赖服务总线系统,用于开放平台与其他应用系统(如门户引擎)的接口交互,具体服务总线的配置请联系服务总线相关人员。

# 开放平台服务发布

在服务总线中配置系统接入、服务发布,发布的10个接口如下:

  • 同步账号

编码:USER

url:/hsb/HOSOpenService/account

  • 同步角色

编码:ROLE

url:/hsb/HOSOpenService/role

  • 同步岗位角色:

编码:POST_BU

url:/hsb/HOSOpenService/postRole

  • 同步菜单:

编码:RESOURCE

url:/hsb/HOSOpenService/resource

  • 同步数据权限:

编码:DATA_SCOPE

url:/hsb/HOSOpenService/scopeData

  • 同步接口权限:

编码:INTERFACE

url:/hsb/HOSOpenService/interface

  • 同步页面预置:

编码:PAGE_PRESET

url:/hsb/HOSOpenService/pagePreset

  • 同步权限-同源:

编码:SYNCH_PERMISSION_SAME

url:/hsb/HOSOpenService/perms

  • 查询资源-异构:

编码:QUERY_RESOURCE

url:/hsb/HOSOpenService/isomerismResource

  • 同步权限-异构:

编码:SYNCH_PERMISSION_DIFF

url:/hsb/HOSOpenService/isomerismPerms

接口的请求方式

method:POST
content-type:application/json;charset=UTF-8

接口的请求数据结构

{
    "Request":{
        "Data":xxx,
        "AppId":"m9Bweb0a87a3"
    }
}

接口的响应数据结构

{
    "code":"200",
    "msg":"",
    "data":xxx,
    "success":true
}

在服务总线配置服务发布的示例如下:

service-pub

消息订阅:其他应用系统根据请求的数据结构中的AppId(具体AppId可到开放平台应用中心-应用管理-应用信息查看)进行消息订阅过滤,订阅的配置示例如下:

message-sub

# 开放平台服务注册

在服务总线中配置系统接入、服务注册,需要注册的16个接口如下:

开放平台的8个接收同步数据的接口

  • 接收账号:

编码:syncAccount

url:/api/openApi/sync/sync-account

  • 接收角色:

编码:syncRole

url:/api/openApi/sync/syncRole

  • 接收岗位角色:

编码:syncPostRole

url:/api/openApi/sync/syncPostRole

  • 接收菜单:

编码:syncResource

url:/api/openApi/sync/resource

  • 接收数据权限:

编码:syncScopeData

url:/api/openApi/sync/scopeData

  • 接收接口权限:

编码:syncInterface

url:/api/openApi/sync/interface

  • 接收页面预置:

编码:syncPagePreset

url:/api/openApi/sync/pagePreset

  • 接收授权数据:

编码:syncPerms

url:/api/openApi/sync/perms

接口的请求方式

method:POST
content-type:application/json;charset=UTF-8

接口的请求数据结构

{
    "Request":{
        "Data":xxx
    }
}

接口的响应数据结构

{
    "code":"200",
    "msg":"",
    "data":xxx,
    "success":true
}

同时开放平台还提供了1个接收主数据平台人员组织的接口,接口如下:

  • 组织人员接收主数据平台的数据接口

编码:org-receive

url:/api/openApi/org/receive

接口的请求方式

method:post

接口的响应数据结构

{
    "code":"200",
    "msg":"",
    "data":xxx,
    "success":true
}

同时开放平台还提供了8个查询数据的接口,接口如下:

  • 拉取应用账号信息:

编码:pullAccount

url:/api/openApi/uum/account/pull-account?appId&queryType&startTime&endTime

  • 拉取角色信息:

编码:pullRole

url:/api/openApi/uum/role/pullRole?appId&queryType&startTime&endTime

  • 拉取岗位角色信息:

编码:pullPostRole

url:/api/openApi/uum/postRole/pullPostRole?appId&queryType&startTime&endTime

  • 拉取菜单信息:

编码:pullResource

url:/api/openApi/uum/resources/pull?appId&queryType&startTime&endTime

  • 拉取数据权限信息:

编码:pullScopeData

url:/api/openApi/uum/scope-data/pull?appId&queryType&startTime&endTime

  • 拉取接口权限信息:

编码:pullInterface

url:/api/openApi/uum/interface/pull?appId&queryType&startTime&endTime

  • 拉取页面预置信息:

编码:pullPagePreset

url:/api/openApi/uum/page-preset/pull?appId&queryType&startTime&endTime

  • 拉取同源授权信息:

编码:pullPerms

url:/api/openApi/uum/perms/pull?appId&queryType&startTime&endTime

接口的请求方式

method:GET

接口的响应数据结构

{
    "code":"200",
    "msg":"",
    "data":xxx,
    "success":true
}

上述17个接口需要在服务总线中配置服务注册,示例如下:

service-reg

其他应用通过总线请求开放平台时,需要把开放平台作为订阅方在消息订阅中进行配置。


提示 服务总线系统针对外部访问拥有ip白名单限制,需要访问服务总线的应用需要把自己的ip提供给总线进行配置

# 主数据平台

开发中,暂不对接。

# https相关问题

如果协议不一致,http和https链接的互相访问,在较新版本的浏览器中会存在以下问题:

  • 问题1:http网站中嵌入https链接时,如果https使用自签名ssl证书,则无法访问https链接;
  • 问题2:https网站中嵌入http链接时,Chrome浏览器会把http转为https,导致无法访问。

首选的解决方案是所有链接采用相同的协议,比如都采用http。或者全都采用https。针对无法统一的场景,可以考虑以下临时方案:

  • 针对问题1:使用自签名ssl证书,或者内网无法进行证书验证的环境,参考:导入证书,可以解决不安全提示及初次访问需要点击信任的问题
  • 针对问题2:参考:解决方案