|
@@ -5,13 +5,14 @@ import com.sckw.example.service.FileService;
|
|
|
import com.sckw.file.api.dubbo.FileApiDubboService;
|
|
import com.sckw.file.api.dubbo.FileApiDubboService;
|
|
|
import com.sckw.file.api.feign.FileApiFeignService;
|
|
import com.sckw.file.api.feign.FileApiFeignService;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author lfdc
|
|
* @author lfdc
|
|
@@ -22,7 +23,6 @@ import java.io.IOException;
|
|
|
* @company sckw
|
|
* @company sckw
|
|
|
* @date 2023-06-02 16:06:43
|
|
* @date 2023-06-02 16:06:43
|
|
|
*/
|
|
*/
|
|
|
-@Slf4j
|
|
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/file")
|
|
@RequestMapping("/file")
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
@@ -73,11 +73,39 @@ public class FileApiController {
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping (value = "/fileFeignUpload",method = RequestMethod.POST)
|
|
@RequestMapping (value = "/fileFeignUpload",method = RequestMethod.POST)
|
|
|
public HttpResult fileFeignUpload(@RequestParam("file") MultipartFile file) {
|
|
public HttpResult fileFeignUpload(@RequestParam("file") MultipartFile file) {
|
|
|
- //auth 服务 调用 file服务提供的feign接口
|
|
|
|
|
|
|
+ //example 服务 调用 file服务提供的feign接口
|
|
|
HttpResult result = fileApiFeignService.fileFeignUpload(file);
|
|
HttpResult result = fileApiFeignService.fileFeignUpload(file);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 基于feign调用
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping (value = "/fileFeignDemo",method = RequestMethod.GET)
|
|
|
|
|
+ //@RequestParam("file") MultipartFile file
|
|
|
|
|
+ public String fileFeignDemo() {
|
|
|
|
|
+ //example 服务 调用 file服务提供的feign接口
|
|
|
|
|
+ return fileApiFeignService.fileFeignDemo("userName");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 基于feign调用
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping (value = "/fileFeignDemo1",method = RequestMethod.POST)
|
|
|
|
|
+ public String fileFeignDemo1() {
|
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
|
+ map.put("123","456");
|
|
|
|
|
+ map.put("asd","asd");
|
|
|
|
|
+ return fileApiFeignService.fileFeignDemo1(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 基于dubbo调用
|
|
* 基于dubbo调用
|
|
|
*
|
|
*
|