| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -41,6 +41,7 @@ import java.io.ByteArrayInputStream;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.io.ByteArrayOutputStream;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.io.IOException;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.io.InputStream;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.net.MalformedURLException;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.net.URL;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.text.ParseException;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.text.SimpleDateFormat;
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -176,9 +177,9 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @ApiOperation(value = "租赁协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				   /* @ApiOperation(value = "租赁协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @GetMapping("/leaseAgreement")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException, ParseException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult leaseAgreement(String orderId, Map<String, String> replacements) throws IOException, ParseException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        List<OrderDetailDto> orderDetailsByOrderId = orderMapper.selectOrderDetailsByOderId(orderId);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        BmContract bmContract = new BmContract();
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -242,10 +243,72 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        MultipartFile file = new MockMultipartFile("contract", "contract.docx", MediaType.APPLICATION_OCTET_STREAM_VALUE, wordBytes);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return sysFileService.upload(file);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }*/
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				   /* @ApiOperation(value = "购物车协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @GetMapping("/bookCarAgreement")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult bookCarAgreement(OrderInfoDto orderInfoDto, Map<String, String> replacements) throws ParseException, IOException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (orderInfoDto != null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            BmContract bmContract = new BmContract();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            bmContract.setStatus(1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            List<BmContract> list = bmContractService.list(bmContract);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            InputStream inputStream = new URL(wordUrl).openStream();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            XWPFDocument document = new XWPFDocument(inputStream);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //装备所属公司
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //承租方所属公司
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("${companyName}", orderInfoDto.getCompanyName());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //订单金额
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("${cost}", orderInfoDto.getCost().toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //订单详情
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            StrBuilder orderDetail = new StrBuilder();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            List<OrderDetailDto> detailsList = orderInfoDto.getDetailsList();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            for (OrderDetailDto orderDetailDto : detailsList) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Date rentBeginTime = inputFormat.parse(orderDetailDto.getRentBeginTime().toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                String beginTime = outputFormat.format(rentBeginTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Date rentEndTime = inputFormat.parse(orderDetailDto.getRentEndTime().toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                String endTime = outputFormat.format(rentEndTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                // 添加每一行的内容
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                orderDetail.append("\n");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                orderDetail.append("机具名称:").append(orderDetailDto.getDeviceName()).append("\n")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        .append("租期:").append(beginTime).append(" 至 ").append(endTime).append("\n")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        .append("天数:").append(orderDetailDto.getDays()).append("天").append("\n")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        .append("租金:").append(orderDetailDto.getDayLeasePrice()).append("元/天").append("\n")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        .append("数量:").append(orderDetailDto.getNum()).append("个").append("\n");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("${orderTable}", orderDetail.toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            for (IBodyElement element : document.getBodyElements()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (element instanceof XWPFParagraph) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    XWPFParagraph paragraph = (XWPFParagraph) element;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    for (XWPFRun run : paragraph.getRuns()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        String text = run.getText(0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        if (text != null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            for (Map.Entry<String, String> entry : replacements.entrySet()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                text = text.replace(entry.getKey(), entry.getValue());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            run.setText(text, 0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            document.write(outputStream);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            byte[] wordBytes = outputStream.toByteArray();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  /*  @ApiOperation(value = "租赁协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            MultipartFile file = new MockMultipartFile("bookCar", "bookCar.docx", MediaType.APPLICATION_OCTET_STREAM_VALUE, wordBytes);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return sysFileService.upload(file);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return AjaxResult.error("参数错误");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }*/
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @ApiOperation(value = "租赁协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @GetMapping("/leaseAgreement")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws ParseException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -272,7 +335,7 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            String beginTime = outputFormat.format(rentBeginTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Date rentEndTime = inputFormat.parse(orderDetailDto.getRentEndTime().toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            String endTime = outputFormat.format(rentEndTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            orderDetail += "<p>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "至" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            orderDetail += "<p><br>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "至" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        replacements.put("orderTable", orderDetail);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -286,16 +349,16 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        StrSubstitutor sub = new StrSubstitutor(replacements);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String result = sub.replace(content);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return AjaxResult.success(result);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }*/
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  /*  @ApiOperation(value = "购物车协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @ApiOperation(value = "购物车协议(查看)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @GetMapping("/bookCarAgreement")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult getbookCarAgreement(OrderInfoDto orderInfoDto, Map<String, Object> replacements) throws ParseException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public AjaxResult getbookCarAgreement(OrderInfoDto orderInfoDto, Map<String, Object> replacements) throws ParseException, IOException {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (orderInfoDto != null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //装备所属公司
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("czcompanyName", orderInfoDto.getCzcompanyName());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("czCompanyName", orderInfoDto.getCzcompanyName());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //承租方所属公司
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("companyName", orderInfoDto.getCompanyName());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //订单金额
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -308,7 +371,7 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                String beginTime = outputFormat.format(rentBeginTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Date rentEndTime = inputFormat.parse(orderDetailDto.getRentEndTime().toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                String endTime = outputFormat.format(rentEndTime);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                orderDetail += "<p>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "至" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                orderDetail += "<p><br>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "至" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            replacements.put("orderTable", orderDetail);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
	
		
			
				
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@ -322,5 +385,5 @@ public class OrderController extends BaseController {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        StrSubstitutor sub = new StrSubstitutor(replacements);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String result = sub.replace(content);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return AjaxResult.success(result);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }*/
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
	
		
			
				
					| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				
 
 |