租赁协议

This commit is contained in:
liang.chao 2024-12-16 17:58:54 +08:00
parent 01247334d7
commit 97c7285ac3
2 changed files with 14 additions and 2 deletions

View File

@ -39,7 +39,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
@ -171,7 +175,7 @@ public class OrderController extends BaseController {
@ApiOperation(value = "租赁协议(查看)")
@GetMapping("/leaseAgreement")
public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException {
public AjaxResult getleaseAgreement(String orderId, Map<String, String> replacements) throws IOException, ParseException {
OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
BmContract bmContract = new BmContract();
bmContract.setStatus(1);
@ -180,8 +184,14 @@ public class OrderController extends BaseController {
InputStream inputStream = new URL(wordUrl).openStream();
XWPFDocument document = new XWPFDocument(inputStream);
String dateStr = orderInfoDto.getOrderTime().toString();
SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = inputFormat.parse(dateStr);
String formattedDate = outputFormat.format(date);
//订单日期
replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
replacements.put("${orderTime}", formattedDate);
//装备所属公司
replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
//承租方所属公司

View File

@ -1,5 +1,6 @@
package com.bonus.material.order.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -35,6 +36,7 @@ public class OrderInfoDto {
@ApiModelProperty(value = "订单日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
@ApiModelProperty(value = "开始日期")