|
@@ -8,21 +8,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.ims.common.utils.StringUtils;
|
|
import com.ims.common.utils.StringUtils;
|
|
import com.ims.eval.config.CustomException;
|
|
import com.ims.eval.config.CustomException;
|
|
-import com.ims.eval.config.ImaConfig;
|
|
|
|
import com.ims.eval.entity.EvaluationNotice;
|
|
import com.ims.eval.entity.EvaluationNotice;
|
|
import com.ims.eval.entity.OrganizationStructure;
|
|
import com.ims.eval.entity.OrganizationStructure;
|
|
import com.ims.eval.entity.custom.Path;
|
|
import com.ims.eval.entity.custom.Path;
|
|
import com.ims.eval.entity.dto.result.R;
|
|
import com.ims.eval.entity.dto.result.R;
|
|
import com.ims.eval.service.IEvaluationNoticeService;
|
|
import com.ims.eval.service.IEvaluationNoticeService;
|
|
import com.ims.eval.service.IOrganizationStructureService;
|
|
import com.ims.eval.service.IOrganizationStructureService;
|
|
|
|
+import com.ims.eval.util.FileUploadUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.core.io.InputStreamResource;
|
|
import org.springframework.core.io.InputStreamResource;
|
|
-import org.springframework.http.*;
|
|
|
|
-import org.springframework.util.LinkedMultiValueMap;
|
|
|
|
-import org.springframework.util.MultiValueMap;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -31,7 +27,6 @@ import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.net.InetAddress;
|
|
import java.net.InetAddress;
|
|
import java.net.UnknownHostException;
|
|
import java.net.UnknownHostException;
|
|
-import java.nio.file.Files;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -58,12 +53,6 @@ public class NoticeManagementController {
|
|
@Autowired
|
|
@Autowired
|
|
HttpServletRequest request;
|
|
HttpServletRequest request;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private RestTemplate restTemplate;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ImaConfig imaConfig;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 通告管理列表信息(分页)
|
|
* 通告管理列表信息(分页)
|
|
*
|
|
*
|
|
@@ -212,39 +201,19 @@ public class NoticeManagementController {
|
|
StringBuilder fileNames = new StringBuilder();
|
|
StringBuilder fileNames = new StringBuilder();
|
|
if (files.length > 0) {
|
|
if (files.length > 0) {
|
|
for (MultipartFile file : files) {
|
|
for (MultipartFile file : files) {
|
|
- HttpHeaders requestHeaders = new HttpHeaders();
|
|
|
|
- requestHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);
|
|
|
|
- CommonInputStreamResource commonInputStreamResource = null;
|
|
|
|
- try {
|
|
|
|
- commonInputStreamResource = new CommonInputStreamResource(Files.newInputStream(((File) file).toPath()), ((File) file).length(), file.getName());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("文件输入流转换错误", e);
|
|
|
|
- }
|
|
|
|
- MultiValueMap<String, Object> headers = new LinkedMultiValueMap<>();
|
|
|
|
- headers.add("Blade-Auth", "bearer " + request.getHeader("Blade-Auth"));
|
|
|
|
- headers.add("Content-Type", "multipart/form-data");
|
|
|
|
- headers.add("folder", "AsApplication");
|
|
|
|
- headers.add("objType", "xxxt/image");
|
|
|
|
- headers.add("objKey", "");
|
|
|
|
- headers.add("file", commonInputStreamResource);
|
|
|
|
- headers.add("bucketName", "yysd");
|
|
|
|
- HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<MultiValueMap<String, Object>>(headers, requestHeaders);
|
|
|
|
- ResponseEntity<String> entity = restTemplate.postForEntity(imaConfig.getGatewayUrl() + "f-center/dm/dmDoc/save", requestEntity, String.class);
|
|
|
|
- String responseValue = (String) entity.getBody();
|
|
|
|
- log.info("---->响应值为:" + responseValue);
|
|
|
|
// 上传文件路径
|
|
// 上传文件路径
|
|
- //String filePath = Path.getNoticePath();
|
|
|
|
|
|
+ String filePath = Path.getNoticePath();
|
|
// 上传并返回新文件名称
|
|
// 上传并返回新文件名称
|
|
- //String fileName = FileUploadUtil.upload(filePath, file);
|
|
|
|
- //fileNames.append(fileName).append(",");
|
|
|
|
|
|
+ String fileName = FileUploadUtil.upload(filePath, file);
|
|
|
|
+ fileNames.append(fileName).append(",");
|
|
}
|
|
}
|
|
- /*String newNoticeAnnex = fileNames.toString().substring(0, fileNames.toString().length() - 1);
|
|
|
|
|
|
+ String newNoticeAnnex = fileNames.toString().substring(0, fileNames.toString().length() - 1);
|
|
if (StringUtils.isNotEmpty(evaluationNotice.getNoticeAnnex())) {//true:非空串
|
|
if (StringUtils.isNotEmpty(evaluationNotice.getNoticeAnnex())) {//true:非空串
|
|
String noticeAnnex = evaluationNotice.getNoticeAnnex() + "," + newNoticeAnnex;
|
|
String noticeAnnex = evaluationNotice.getNoticeAnnex() + "," + newNoticeAnnex;
|
|
evaluationNotice.setNoticeAnnex(noticeAnnex);
|
|
evaluationNotice.setNoticeAnnex(noticeAnnex);
|
|
} else {
|
|
} else {
|
|
evaluationNotice.setNoticeAnnex(newNoticeAnnex);
|
|
evaluationNotice.setNoticeAnnex(newNoticeAnnex);
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
b = evaluationNoticeService.updateById(evaluationNotice);
|
|
b = evaluationNoticeService.updateById(evaluationNotice);
|
|
}
|
|
}
|
|
}
|
|
}
|