diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-client/pom.xml b/esua-epdc/epdc-module/epdc-api/epdc-api-client/pom.xml
index 7416667dc..43d64f905 100644
--- a/esua-epdc/epdc-module/epdc-api/epdc-api-client/pom.xml
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-client/pom.xml
@@ -45,17 +45,17 @@
com.esua.epdc
- epdc-events-client
+ epdc-services-client
1.0.0
com.esua.epdc
- epdc-services-client
+ epdc-user-client
1.0.0
com.esua.epdc
- epdc-user-client
+ epdc-oss-client
1.0.0
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiIssueController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiIssueController.java
index 396e740c1..8a4cf679e 100644
--- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiIssueController.java
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiIssueController.java
@@ -3,12 +3,14 @@ package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.annotation.LoginUser;
import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.UploadDTO;
import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO;
import com.elink.esua.epdc.dto.issue.form.IssueFormDTO;
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO;
import com.elink.esua.epdc.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -48,4 +50,16 @@ public class ApiIssueController {
return issueService.listIssues(userDetail, formDto);
}
+ /**
+ * 文件上传
+ * @Params: [file]
+ * @Return: com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author: liuchuang
+ * @Date: 2019/9/8 18:34
+ */
+ @PostMapping("upload")
+ public Result upload(@RequestParam("file") MultipartFile file) {
+ return issueService.upload(file);
+ }
+
}
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/OssFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/OssFeignClient.java
new file mode 100644
index 000000000..ec8294bf0
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/OssFeignClient.java
@@ -0,0 +1,23 @@
+package com.elink.esua.epdc.feign;
+
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.UploadDTO;
+import com.elink.esua.epdc.feign.fallback.OssFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 文件对象模块
+ * @Author LC
+ * @Date 2019/9/8 18:24
+ */
+@FeignClient(name = ServiceConstant.EPDC_OSS_SERVER, fallback = OssFeignClientFallback.class)
+public interface OssFeignClient {
+
+ @PostMapping(value = "oss/file/upload", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ Result upload(@RequestPart("file") MultipartFile file);
+}
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/OssFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/OssFeignClientFallback.java
new file mode 100644
index 000000000..c9dc436a8
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/OssFeignClientFallback.java
@@ -0,0 +1,23 @@
+package com.elink.esua.epdc.feign.fallback;
+
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
+import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.UploadDTO;
+import com.elink.esua.epdc.feign.OssFeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 文件对象模块
+ * @Author LC
+ * @Date 2019/9/8 18:25
+ */
+@Component
+public class OssFeignClientFallback implements OssFeignClient {
+
+ @Override
+ public Result upload(MultipartFile file) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "upload", file.getOriginalFilename());
+ }
+}
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/IssueService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/IssueService.java
index 759519915..c529bb090 100644
--- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/IssueService.java
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/IssueService.java
@@ -2,9 +2,11 @@ package com.elink.esua.epdc.service;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dto.UploadDTO;
import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO;
import com.elink.esua.epdc.dto.issue.form.IssueFormDTO;
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -32,4 +34,13 @@ public interface IssueService {
* @Date: 2019/9/7 11:26
*/
Result> listIssues(TokenDto userDetail, IssueFormDTO formDto);
+
+ /**
+ * 文件上传
+ * @Params: [file]
+ * @Return: com.elink.esua.epdc.commons.tools.utils.Result
+ * @Author: liuchuang
+ * @Date: 2019/9/8 18:34
+ */
+ Result upload(MultipartFile file);
}
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/IssueServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/IssueServiceImpl.java
index b64e982fe..468676da7 100644
--- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/IssueServiceImpl.java
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/IssueServiceImpl.java
@@ -3,14 +3,17 @@ package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.CompleteDeptDTO;
+import com.elink.esua.epdc.dto.UploadDTO;
import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO;
import com.elink.esua.epdc.dto.issue.form.IssueFormDTO;
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO;
import com.elink.esua.epdc.feign.IssueFeignClient;
+import com.elink.esua.epdc.feign.OssFeignClient;
import com.elink.esua.epdc.feign.SysDeptFeignClient;
import com.elink.esua.epdc.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -28,6 +31,9 @@ public class IssueServiceImpl implements IssueService {
@Autowired
private SysDeptFeignClient sysDeptFeignClient;
+ @Autowired
+ private OssFeignClient ossFeignClient;
+
@Override
public Result saveEvent(TokenDto userDetail, EpdcEventSubmitFormDTO formDto) {
// 获取该网格所有上级机构
@@ -55,4 +61,9 @@ public class IssueServiceImpl implements IssueService {
formDto.setDeptId(userDetail.getGridId());
return issueFeignClient.listIssues(formDto);
}
+
+ @Override
+ public Result upload(MultipartFile file) {
+ return ossFeignClient.upload(file);
+ }
}