修复bug
This commit is contained in:
parent
bed055fa1d
commit
93c7ff1ed0
|
|
@ -43,6 +43,16 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,15 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
//@EnableDiscoveryClient
|
||||
//@MapperScan("cn.qihangerp.oms.mapper")
|
||||
@EnableFeignClients(basePackages = "cn.qihangerp.oms")
|
||||
@EnableDiscoveryClient
|
||||
@ComponentScan(basePackages={"cn.qihangerp"})
|
||||
@SpringBootApplication
|
||||
|
|
@ -18,5 +23,9 @@ public class OmsApi {
|
|||
System.out.println( "Hello oms-api!" );
|
||||
SpringApplication.run(OmsApi.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,40 @@
|
|||
package cn.qihangerp.oms.controller;
|
||||
|
||||
import cn.qihangerp.oms.feign.EchoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
public class HomeController {
|
||||
|
||||
@Resource
|
||||
private EchoService echoService;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
|
||||
@GetMapping("/")
|
||||
public String home(){
|
||||
return "{'code':0,'msg':'oms-api请通过api访问'}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/echo-rest")
|
||||
public String rest() {
|
||||
return restTemplate.getForObject("http://tao-oms/test/na", String.class);
|
||||
}
|
||||
@GetMapping(value = "/echo-feign")
|
||||
public String feign() {
|
||||
String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdkOTBmN2EzLWUwNWQtNDkxNy04NjIzLTU1OGRhNGY3NjE3NiJ9._Oukm9b0P1WvcOywLdhs6_BOt_6mRSF41Q6f4fBm_DGUkPR86Qg1tqyRTM5ouTR2Xz46IRuRAVez8Wcl3NIlwg";
|
||||
|
||||
return echoService.echo(token);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,16 +72,16 @@
|
|||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter</artifactId>-->
|
||||
<!-- <version>4.0.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-loadbalancer</artifactId>-->
|
||||
<!-- <version>4.0.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-gateway</artifactId>-->
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
* Hello world!
|
||||
*
|
||||
*/
|
||||
@EnableFeignClients(basePackages = "cn.qihangerp.sys")
|
||||
|
||||
@EnableDiscoveryClient
|
||||
@ComponentScan(basePackages={"cn.qihangerp"})
|
||||
//@MapperScan("com.qihang.sys.api.mapper")
|
||||
|
|
@ -26,9 +26,5 @@ public class SysApi
|
|||
SpringApplication.run(SysApi.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
package cn.qihangerp.sys.controller;
|
||||
|
||||
import cn.qihangerp.sys.feign.EchoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@RestController
|
||||
public class HomeController {
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
@Resource
|
||||
private EchoService echoService;
|
||||
@GetMapping("/")
|
||||
public String home(){
|
||||
return "{'code':0,'msg':'请通过api访问'}";
|
||||
}
|
||||
@GetMapping(value = "/echo-rest")
|
||||
public String rest() {
|
||||
return restTemplate.getForObject("http://tao-oms/test/na", String.class);
|
||||
}
|
||||
@GetMapping(value = "/echo-feign")
|
||||
public String feign() {
|
||||
String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdkOTBmN2EzLWUwNWQtNDkxNy04NjIzLTU1OGRhNGY3NjE3NiJ9._Oukm9b0P1WvcOywLdhs6_BOt_6mRSF41Q6f4fBm_DGUkPR86Qg1tqyRTM5ouTR2Xz46IRuRAVez8Wcl3NIlwg";
|
||||
|
||||
return echoService.echo(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 6}).then(response => {
|
||||
listShop({type: 400}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 3}).then(response => {
|
||||
listShop({type: 200}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 5}).then(response => {
|
||||
listShop({type: 300}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 4}).then(response => {
|
||||
listShop({type: 100}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 2}).then(response => {
|
||||
listShop({type: 500}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
Loading…
Reference in New Issue