租赁协议
This commit is contained in:
		
							parent
							
								
									067192c825
								
							
						
					
					
						commit
						06df89cb22
					
				| 
						 | 
				
			
			@ -23,6 +23,10 @@
 | 
			
		|||
            <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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,8 @@ 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;
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +25,7 @@ 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;
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +61,9 @@ public class OrderController extends BaseController {
 | 
			
		|||
    @Resource
 | 
			
		||||
    private BmContractService bmContractService;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private RemoteFileService sysFileService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 提交预约车到订单
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +171,7 @@ public class OrderController extends BaseController {
 | 
			
		|||
 | 
			
		||||
    @ApiOperation(value = "租赁协议(查看)")
 | 
			
		||||
    @GetMapping("/leaseAgreement")
 | 
			
		||||
    public ResponseEntity<byte[]> getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException {
 | 
			
		||||
    public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException {
 | 
			
		||||
        OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
 | 
			
		||||
        BmContract bmContract = new BmContract();
 | 
			
		||||
        bmContract.setStatus(1);
 | 
			
		||||
| 
						 | 
				
			
			@ -202,6 +208,7 @@ 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();
 | 
			
		||||
| 
						 | 
				
			
			@ -210,12 +217,14 @@ public class OrderController extends BaseController {
 | 
			
		|||
        graphics.setPaint(Color.black);
 | 
			
		||||
        graphics.drawString(new String(wordBytes), 10, 20);
 | 
			
		||||
        graphics.dispose();*/
 | 
			
		||||
 | 
			
		||||
        HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
 | 
			
		||||
        headers.setContentDispositionFormData("attachment", "contract.docx");
 | 
			
		||||
        return ResponseEntity.ok()
 | 
			
		||||
                .headers(headers)
 | 
			
		||||
                .body(wordBytes);
 | 
			
		||||
        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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue