Ruoyi Vue版集成JFlowSpringBoot(成功版)

1.下载https://gitee.com/kikock/RuoYi-JFlow的源码,以及ruoyi-vue源码,ruoyi-jflow只是一个参考,因为他不是ruoyi-vue版


2.修改WF/Comm/Gener.js.
所有url增加从cookie里面获取Token,添加GetCookie函数,参考如下:

$.ajax({
                type: 'post',
                async: false,
                xhrFields: {
                    withCredentials: true
                },
                crossDomain: true,
                url: dynamicHandler + "?DoType=Entity_Init&EnName=" + self.enName + "&PKVal=" + self.pkval + "&t=" + new Date().getTime()+"&token="+getCookie("Admin-Token"),
                ***: ''
});

添加getcookie函数

//获取cookie
function getCookie(cookie_name) {
    var allcookies = document.cookie;
    //索引长度,开始索引的位置
    var cookie_pos = allcookies.indexOf(cookie_name);

    // 如果找到了索引,就代表cookie存在,否则不存在
    if (cookie_pos != -1) {
        // 把cookie_pos放在值的开始,只要给值加1即可
        //计算取cookie值得开始索引,加的1为“=”
        cookie_pos = cookie_pos + cookie_name.length + 1;
        //计算取cookie值得结束索引
        var cookie_end = allcookies.indexOf(";", cookie_pos);

        if (cookie_end == -1) {
            cookie_end = allcookies.length;

        }
        //得到想要的cookie的值
        var value = unescape(allcookies.substring(cookie_pos, cookie_end));
    }
    return value;
}


3.修改WF/Scripts/config.js,修改projectname

function basePath() {
    //获取当前网址,如: http://localhost:80/jflow-web/index.jsp
    var curPath = window.document.location.href;
    //获取主机地址之后的目录,如: jflow-web/index.jsp  
    var pathName = window.document.location.pathname;
    var pos = curPath.indexOf(pathName);
    //获取主机地址,如: http://localhost:80  
    var localhostPaht = curPath.substring(0, pos);
    //获取带"/"的项目名,如:/jflow-web
    //var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
    var projectName ='';

    return localhostPaht + projectName;

}


4.修改WebUser.java的GetSessionByKey()做了修改

/**
     * 通过key,取出session.
     *
     * @param key         key
     * @param isNullAsVal 如果是Null, 返回的值.
     * @return
     */
    public static String GetSessionByKey(String key, String isNullAsVal) {
//		return GetSessionByKey(key, isNullAsVal, false);
//	}
//
//	/**
//	 * 通过key,取出session.
//	 *
//	 * @param key key
//	 * @param isNullAsVal 如果是Null, 返回的值.
//	 * @return
//	 */
//	public static String GetSessionByKey(String key, String isNullAsVal, boolean isChinese) {
//		try {
        if (getIsBSMode() && null != ContextHolderUtils.getRequest() && null != ContextHolderUtils.getSession()) {
            //Object value = ContextHolderUtils.getSession().getAttribute(key);
            Object value=null;
            if (key=="No") {
                value = ContextHolderUtils.getLoginUser(ServletUtils.getParameter("token")).getUsername();
            }
            else if (key=="Name"){
                value = ContextHolderUtils.getLoginUser(ServletUtils.getParameter("token")).getUser().getNickName();
            }
            else if (key=="FK_DeptName"){
                value = "100";
            }
            else if (key=="FK_DeptNameOfFull"){
                value = "组织架构";
            }
            String str = value == null ? "" : String.valueOf(value);
            if (StringHelper.isNullOrEmpty(str)) {
                //astra.zhao 2019-04-08 modified 注释了str = 'admin'
                str = isNullAsVal;
                //str = "admin";
            }
            return str;
        } else {
            if ((Current.Session.get(key) == null || Current.Session.get(key).toString().equals("")) && isNullAsVal != null) {
                //astra.zhao 2019-04-08 modified 注释了str = 'admin'
                return isNullAsVal;
                //return "admin";
            } else {
                //astra.zhao 2019-04-08 modified 注释了str = 'admin'
                //String str = (String) Current.Session.get(key);
                String str =  ContextHolderUtils.getLoginUser(ServletUtils.getParameter("token")).getUsername();
                return str;
                //return "admin";
            }
        }
//		} catch (UnsupportedEncodingException e) {
//			return isNullAsVal;
//		}
    }


5.修改WF/HttpHandle/WF_Comm.java
6.修改DBAccess.java的RunSQL_200705_MySQL方法,(上述这两个方法省略,只是集成报错后,进行修改,可以在控制台看到具体错误)

7.将jflow-core作为一个module模块包,编译后,添加到spring boot项目中,添加jar包<dependency>
    <groupId>jflow-core</groupId>
    <artifactId>jflow-core</artifactId>
    <version>1.1.0-SNAPSHOT</version>
</dependency>

8.spring boot的项目中添加yaml文件的mvc配置
mvc:
    ### request url .do后缀支持
    pathmatch:
      use-suffix-pattern: true
      #      静态文件
      static-path-pattern: /JFlow/**
    resources:
      static-locations: classpath:/JFlow/
    view:
      prefix: /JFlow/

已标记关键词 清除标记
我按照 readme.md的提示集成了jflow 报了如下问题 请问有没有人知道如何解决 ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wsDesignerSoap': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at com.yiit.code.demo.JflowtestApp.main(JflowtestApp.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z at org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:85) at org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:55) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1758) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1695) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ... 19 common frames omitted ``` ```<!-- JFlow流程设计器服务 --> <jaxws:server id="wsDesignerSoap" serviceClass="cn.jflow.controller.wf.admin.xap.service.WSDesignerSoap" address="/Service"> <jaxws:serviceBean> <bean class="cn.jflow.controller.wf.admin.xap.service.WSDesignerSoapImpl" /> </jaxws:serviceBean> </jaxws:server> <!-- JFlow表单设计器服务 --> <jaxws:server id="ccFormSoap" serviceClass="cn.jflow.controller.wf.admin.xap.service.CCFormSoap" address="/ccformSoap"> <jaxws:serviceBean> <bean class="cn.jflow.controller.wf.admin.xap.service.CCFormSoapImpl" /> </jaxws:serviceBean> </jaxws:server> ``` 问题出在这两个上 请问有没有知道如何解决
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页