Compare commits

..

No commits in common. "01247334d743d140a7f3347c4e5f9e3977dd6786" and "0d20b8018e39a3962087eee0af7b5c1484ce1138" have entirely different histories.

2 changed files with 8 additions and 21 deletions

View File

@ -23,10 +23,6 @@
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${jasypt-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@ -15,8 +15,6 @@ import com.bonus.material.order.domain.OrderDetailDto;
import com.bonus.material.order.domain.OrderInfoDto;
import com.bonus.material.order.mapper.OrderMapper;
import com.bonus.material.order.service.OrderService;
import com.bonus.system.api.RemoteFileService;
import com.bonus.system.api.domain.SysFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -25,7 +23,6 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
@ -61,9 +58,6 @@ public class OrderController extends BaseController {
@Resource
private BmContractService bmContractService;
@Resource
private RemoteFileService sysFileService;
/**
* 提交预约车到订单
*/
@ -171,7 +165,7 @@ public class OrderController extends BaseController {
@ApiOperation(value = "租赁协议(查看)")
@GetMapping("/leaseAgreement")
public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException {
public ResponseEntity<byte[]> getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException {
OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
BmContract bmContract = new BmContract();
bmContract.setStatus(1);
@ -208,7 +202,6 @@ public class OrderController extends BaseController {
document.write(outputStream);
byte[] wordBytes = outputStream.toByteArray();
// Convert Word to Image (simple example using BufferedImage)
/* BufferedImage image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
@ -217,14 +210,12 @@ public class OrderController extends BaseController {
graphics.setPaint(Color.black);
graphics.drawString(new String(wordBytes), 10, 20);
graphics.dispose();*/
MultipartFile file = new MockMultipartFile("contract", "contract.docx", MediaType.APPLICATION_OCTET_STREAM_VALUE, wordBytes);
AjaxResult upload = sysFileService.upload(file);
return upload;
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
// headers.setContentDispositionFormData("attachment", "contract.docx");
// return ResponseEntity.ok()
// .headers(headers)
// .body(wordBytes);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", "contract.docx");
return ResponseEntity.ok()
.headers(headers)
.body(wordBytes);
}
}