jeecg问题

在这里插入图片描述

1、开发小问题

1.1、前端请求,后端方法未结束:访问超时,请稍后再试!

原因:框架熔断处理
解决:修改响应时间(默认3秒)
jeecg-cloud-module\jeecg-cloud-gateway\src\main\resources\application.yml

# hystrix 信号量隔离,3秒后自动超时
hystrix:
  enabled: true
  shareSecurityContext: true
  command:
    default:
      execution:
        isolation:
          strategy: SEMAPHORE
          thread:
            timeoutInMilliseconds: 3000

1.2、前端:设置请求超时时间(默认9秒)

src\utils\request.js

const service = axios.create({
  //baseURL: '/jeecg-boot',
  baseURL: apiBaseUrl, // api base_url
  timeout: 9000 // 请求超时时间
})

1.3、前端:执行 npm run build 报错,但是npm run dev没问题

ERROR TypeError: Class extends value undefined is not a constructor or null
原因:CssDependency的问题,依赖包不兼容
解决:执行npm add webpack@4.5.0,解决

1.4、后端:引入第三方jar包

1.4.1 项目下新建libs文件夹,放第三方jar包

在这里插入图片描述

1.4.2 项目下pom文件,添加依赖配置

 ![在这里插入图片描述](https://img-blog.csdnimg.cn/d2b566f1d90d4472898f85f23913a80e.png)
        <!--打印机-->
        <dependency>
            <groupId>com.printer</groupId>
            <artifactId>com.printer</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/healthy-printer.jar</systemPath>
        </dependency>

1.4.3 打包时引入第三方jar

在这里插入图片描述

<build>
		<finalName>cctd-print</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<!--引入第三方jar后打包,否则第三方服务模块无法引用-->
					<includeSystemScope>true</includeSystemScope>
					<!--微服务模式下修改为true,跳过此打包插件,否则微服务模块无法引用-->
					<skip>false</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>

1.4.4 打包后可查看 jar\BOOT-INF\lib\第三方jar

在这里插入图片描述

1.5、前端组件 j-dict-select-tag 过滤数据

<a-col :span="24">
  <a-form-model-item label="当前状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="statusOld">
    <j-dict-select-tag  :dictCode="dictCode" disabled  v-model="model.statusOld" placeholder="请选择当前状态" style="width: 100%" />
 </a-form-model-item>
</a-col>
<a-col :span="24">
   <a-form-model-item label="新状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<j-dict-select-tag  ref="warnDictValue" :dictCode="dictCode" v-model="model.status" placeholder="请选择新状态" style="width: 100%" />
   </a-form-model-item>
</a-col>
      this.$nextTick(res => {
        this.$refs.warnDictValue.dictOptions = this.$refs.warnDictValue.dictOptions.filter(item => {
          return item.value != this.model.statusOld
        })
      })

1.6、后端:打jar包去掉BOOT-INF文件夹

修改pom.xml文件,设置:<skip>true</skip>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>

1.7、前端:使用$forceUpdate()强制刷新,表单rules校验失效问题

使用 this. d e l e t e 、 t h i s . delete、this. deletethis.set 设置值
解决参考链接

修改前:

      if (this.model.workOrderStatus == 1) {
        this.model.customerAddressId = val;
      } else {
        this.model.supportingUnitsAddressId= val;
      }
      this.$forceUpdate()

修改后:

      if (this.model.workOrderStatus == 1) {
        this.$delete(this.model,"customerAddressId")
        this.$set(this.model,"customerAddressId",val)
      } else {
        this.$delete(this.model,"supportingUnitsAddressId")
        this.$set(this.model,"supportingUnitsAddressId",val)
      }

2、单体转微服务

2.1、微服务打包运行jeecg-cloud-gateway-2.4.6报错

(注:IDEA启动正常,但打包后采用本地java -jar启动发生配置文件解析异常)

报错:NacosPropertySourceBuilder :parse data from Nacos error,dataId:pearl-test.yaml,data:server:
原因:nacos读取配置文件默认使用UTF-8,通过cmd启动项目,项目默认编码格式为GBK
解决:添加启动参数-Dfile.encoding=utf-8 ,则能正常启动并读取远程配置
java -Dfile.encoding=utf-8 -jar test.jar

参考链接:https://blog.csdn.net/qq_43437874/article/details/108625707

2.2、demo模块启动报错:Could not resolve placeholder jeecg.signatureSecret in value ${jeecg.signatureSecret

解决:在demo模块的application.yml配置文件里加上:

jeecg :
  # 签名密钥串(前后端要一致,正式发布请自行修改)
  signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值