From 2f3cd0975b753d535054a9ffb19e61c4031032a4 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期三, 18 三月 2026 15:32:34 +0800
Subject: [PATCH] feat(sales): 新增加工承揽合同导出功能
---
src/main/java/com/ruoyi/basic/pojo/Customer.java | 20 ++
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java | 6
src/main/resources/static/contract_tmp.docx | 0
src/main/java/com/ruoyi/sales/vo/ExportProcessContractVo.java | 115 ++++++++++++++
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 257 +++++++++++++++++++------------
src/main/java/com/ruoyi/common/utils/StringUtils.java | 7
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java | 4
src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java | 6
pom.xml | 7
9 files changed, 317 insertions(+), 105 deletions(-)
diff --git a/pom.xml b/pom.xml
index 553dbf2..e5cea04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -315,13 +315,6 @@
<version>${getui-sdk.version}</version>
<scope>compile</scope>
</dependency>
-
- <!--hutool宸ュ叿鍖�-->
- <dependency>
- <groupId>cn.hutool</groupId>
- <artifactId>hutool-all</artifactId>
- <version>${hutool.version}</version>
- </dependency>
<dependency>
<groupId>cn.hutool</groupId>
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index 8a35b2b..2d91424 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -115,4 +115,24 @@
@ApiModelProperty(value = "寮�鎴疯鍙�")
@Excel(name = "寮�鎴疯鍙�")
private String bankCode;
+
+ @ApiModelProperty(value = "娉曚汉")
+ @Excel(name = "娉曚汉")
+ @TableField(value = "corporation")
+ private String corporation;
+
+ @ApiModelProperty(value = "浼犵湡")
+ @Excel(name = "浼犵湡")
+ @TableField(value = "fax")
+ private String fax;
+
+ @ApiModelProperty(value = "寮�鎴疯")
+ @Excel(name = "寮�鎴疯")
+ @TableField(value = "bank_name")
+ private String bankName;
+
+ @ApiModelProperty(value = "浠g悊")
+ @Excel(name = "浠g悊")
+ @TableField(value = "agent")
+ private String agent;
}
diff --git a/src/main/java/com/ruoyi/common/utils/StringUtils.java b/src/main/java/com/ruoyi/common/utils/StringUtils.java
index 74eb532..4e9b245 100644
--- a/src/main/java/com/ruoyi/common/utils/StringUtils.java
+++ b/src/main/java/com/ruoyi/common/utils/StringUtils.java
@@ -719,4 +719,11 @@
}
return sb.toString();
}
+
+ public static String padRight(String str, int length) {
+ if (str == null) str = "";
+ if (str.length() >= length) return str;
+ // 鐢ㄧ┖鏍艰ˉ榻�
+ return String.format("%-" + length + "s", str);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index cbef46f..79771c5 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -179,6 +179,12 @@
util.exportExcel(response, salesLedgerIPage == null ? new ArrayList<>() : salesLedgerIPage.getRecords(), "瀵煎嚭寮�绁ㄧ櫥璁板垪琛�");
}
+ @Log(title = "瀵煎嚭鍔犲伐鎵挎徑鍚堝悓", businessType = BusinessType.EXPORT)
+ @GetMapping("/exportProcessContract/{id}")
+ public void exportProcessContract(@PathVariable Long id){
+ salesLedgerService.exportProcessContract(id);
+ }
+
/**
* 鏂板淇敼閿�鍞彴璐�
*/
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
index 36751c2..e2fa28a 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
@@ -147,5 +147,9 @@
@TableField(exist = false)
//鏄惁鍙紪杈�
private Boolean isEdit;
+
+ // 绛捐鍦扮偣
+ @TableField(value = "place_of_singing")
+ private String placeOfSinging;
}
diff --git a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
index 79aea98..aa2abf2 100644
--- a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
+++ b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
@@ -52,4 +52,10 @@
List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId);
IPage<SalesLedgerDto> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page);
+
+ /**
+ * 瀵煎嚭鍔犲伐鎵挎徑鍚堝悓
+ * @param id
+ */
+ void exportProcessContract(@NotNull Long id);
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 8f13c5e..eca1a1e 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -1,5 +1,11 @@
package com.ruoyi.sales.service.impl;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.LocalDateTimeUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -8,8 +14,10 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
@@ -17,31 +25,26 @@
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.SaleEnum;
import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.EnumUtil;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.production.mapper.*;
-import com.ruoyi.production.pojo.*;
import com.ruoyi.production.service.ProductionProductMainService;
-import com.ruoyi.production.service.impl.ProductionProductMainServiceImpl;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysDeptMapper;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.quality.mapper.QualityInspectMapper;
-import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.sales.dto.*;
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.*;
-import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
+import com.ruoyi.sales.vo.ExportProcessContractVo;
import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
@@ -51,8 +54,12 @@
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
@@ -81,69 +88,41 @@
@RequiredArgsConstructor
@Slf4j
public class SalesLedgerServiceImpl extends ServiceImpl<SalesLedgerMapper, SalesLedger> implements ISalesLedgerService {
- private final AccountIncomeService accountIncomeService;
-
- private final SalesLedgerMapper salesLedgerMapper;
-
- private final CustomerMapper customerMapper;
-
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
-
- private final CommonFileMapper commonFileMapper;
-
- private final TempFileMapper tempFileMapper;
-
- private final ReceiptPaymentMapper receiptPaymentMapper;
-
- private final ShippingInfoServiceImpl shippingInfoServiceImpl;
-
- private final CommonFileServiceImpl commonFileService;
-
- private final ShippingInfoMapper shippingInfoMapper;
-
- private final InvoiceLedgerMapper invoiceLedgerMapper;
-
- private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
-
- private final SalesLedgerWorkMapper salesLedgerWorkMapper;
-
- private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
-
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
-
- private final InvoiceRegistrationMapper invoiceRegistrationMapper;
-
- private final ProductOrderMapper productOrderMapper;
-
- private final ProcessRouteMapper processRouteMapper;
- private final ProductProcessRouteMapper productProcessRouteMapper;
-
- private final ProcessRouteItemMapper processRouteItemMapper;
-
- private final ProductProcessRouteItemMapper productProcessRouteItemMapper;
-
- private final ProductWorkOrderMapper productWorkOrderMapper;
-
- private final ProductionProductMainMapper productionProductMainMapper;
-
- private final ProductionProductOutputMapper productionProductOutputMapper;
-
- private final ProductionProductInputMapper productionProductInputMapper;
-
- private final QualityInspectMapper qualityInspectMapper;
-
- @Autowired
- private SysDeptMapper sysDeptMapper;
-
- @Value("${file.upload-dir}")
- private String uploadDir;
-
private static final String LOCK_PREFIX = "contract_no_lock:";
private static final long LOCK_WAIT_TIMEOUT = 10; // 閿佺瓑寰呰秴鏃舵椂闂达紙绉掞級
private static final long LOCK_EXPIRE_TIME = 30; // 閿佽嚜鍔ㄨ繃鏈熸椂闂达紙绉掞級
-
+ private final AccountIncomeService accountIncomeService;
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final CustomerMapper customerMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
+ private final CommonFileMapper commonFileMapper;
+ private final TempFileMapper tempFileMapper;
+ private final ReceiptPaymentMapper receiptPaymentMapper;
+ private final ShippingInfoServiceImpl shippingInfoServiceImpl;
+ private final CommonFileServiceImpl commonFileService;
+ private final ShippingInfoMapper shippingInfoMapper;
+ private final InvoiceLedgerMapper invoiceLedgerMapper;
+ private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
+ private final SalesLedgerWorkMapper salesLedgerWorkMapper;
+ private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
+ private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
+ private final InvoiceRegistrationMapper invoiceRegistrationMapper;
+ private final ProductOrderMapper productOrderMapper;
+ private final ProcessRouteMapper processRouteMapper;
+ private final ProductProcessRouteMapper productProcessRouteMapper;
+ private final ProcessRouteItemMapper processRouteItemMapper;
+ private final ProductProcessRouteItemMapper productProcessRouteItemMapper;
+ private final ProductWorkOrderMapper productWorkOrderMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
+ private final ProductionProductInputMapper productionProductInputMapper;
+ private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
+ @Autowired
+ private SysDeptMapper sysDeptMapper;
+ @Value("${file.upload-dir}")
+ private String uploadDir;
@Autowired
private ProductModelMapper productModelMapper;
@@ -154,14 +133,15 @@
@Autowired
private ProductionProductMainService productionProductMainService;
;
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
return salesLedgerMapper.selectSalesLedgerList(salesLedgerDto);
}
-
- public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type){
+ public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type) {
LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, relateId);
productWrapper.eq(SalesLedgerProduct::getType, type.getCode());
@@ -339,9 +319,6 @@
return salesLedgerMapper.selectSalesLedgerListPage(page, salesLedgerDto);
}
- @Autowired
- private SysUserMapper sysUserMapper;
-
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult importData(MultipartFile file) {
@@ -497,35 +474,90 @@
return salesLedgerDtoIPage;
}
+ @Override
+ public void exportProcessContract(Long id) {
+ //鍔犲伐鎵挎徑鍚堝悓
+ ExportProcessContractVo exportProcessContract = new ExportProcessContractVo();
+ exportProcessContract.setId(id);
+ SalesLedger salesLedger = salesLedgerMapper.selectById(id);
+ // 鏌ヨ瀹㈡埛鍏徃淇℃伅
+ Customer customer = customerMapper.selectById(salesLedger.getCustomerId());
+ exportProcessContract.setCreateTime(LocalDateTimeUtil.format(Optional.ofNullable(salesLedger.getExecutionDate()).orElse(LocalDate.now()), "yyyy骞碝M鏈坉d鏃�"));
+ exportProcessContract.setRemark(Optional.ofNullable(salesLedger.getRemarks()).orElse("鏃�")); // 澶囨敞
+ exportProcessContract.setPlaceOfSinging(Optional.ofNullable(salesLedger.getPlaceOfSinging()).orElse(""));
- // 鍐呴儴绫荤敤浜庡瓨鍌ㄨ仛鍚堢粨鏋�
- private static class GroupedCustomer {
- private final Long customerId;
- private final String customerName;
- private BigDecimal totalAmount = BigDecimal.ZERO;
+ // 濉啓鐢叉柟淇℃伅
+ ExportProcessContractVo.Customer partyA = ExportProcessContractVo.Customer.getCustomer(customer);
+ exportProcessContract.setPartyAClientName(customer.getCustomerName());
+ exportProcessContract.setPartyA(partyA);
- public GroupedCustomer(Long customerId, String customerName) {
- this.customerId = customerId;
- this.customerName = customerName;
+ // 濉啓涔欐柟淇℃伅
+ ExportProcessContractVo.Customer partyB = new ExportProcessContractVo.Customer();
+ exportProcessContract.setPartyBClientName("");//todo@ 涔欐柟鍏徃鍚嶇О
+ exportProcessContract.setPartyB(partyB);
+
+ // 濉啓鍟嗗搧淇℃伅
+ final BigDecimal[] totalAmount = {BigDecimal.ZERO}; // 鎬婚噾棰�
+ LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
+ productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId());
+ productWrapper.eq(SalesLedgerProduct::getType, 1);
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
+ List<ExportProcessContractVo.SaleProduct> productList = products.stream().map(it -> {
+ ExportProcessContractVo.SaleProduct saleProduct = BeanUtil.copyProperties(it, ExportProcessContractVo.SaleProduct.class);
+ // 璁$畻鎬讳环鏍�
+ totalAmount[0] = totalAmount[0].add(Optional.ofNullable(saleProduct.getTaxInclusiveTotalPrice()).orElse(BigDecimal.ZERO));
+ return saleProduct;
+ }).collect(Collectors.toList());
+ // 绗竴涓缃� 鍚堝悓缂栧彿
+ if (!productList.isEmpty()) {
+ productList.get(0).setSalesContractNo(salesLedger.getSalesContractNo());
+ }
+ // 鏌ョ湅绋庣巼 鐞嗚涓婄◣鐜囧崟涓�锛屽鏋滃绋庣巼涓虹┖
+ Map<BigDecimal, Long> rateMap = productList.stream().map(product -> product.getTaxRate()).filter(Objects::nonNull)
+ .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+ String taxRateStr = rateMap.size() == 1 ? rateMap.keySet().iterator().next().toString() + " %" : "";
+ exportProcessContract.setTaxRate(taxRateStr);
+ exportProcessContract.setSaleProducts(productList);// 鍟嗗搧淇℃伅
+ // 璁剧疆澶у啓鐨勬�讳环鏍�
+ exportProcessContract.setTotalAmountZh(Convert.digitToChinese(totalAmount[0].doubleValue()));
+
+ exportProcessContractToWord(exportProcessContract);
+ }
+
+ @SneakyThrows
+ private void exportProcessContractToWord(@NotNull ExportProcessContractVo exportProcessContract){
+ // 纭繚 saleProducts 涓嶄负 null
+ if (exportProcessContract.getSaleProducts() == null) {
+ exportProcessContract.setSaleProducts(new ArrayList<>());
}
- public void addAmount(BigDecimal amount) {
- if (amount != null) {
- this.totalAmount = this.totalAmount.add(amount);
- }
- }
+ // 妯℃澘杈撳叆娴�
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/contract_tmp.docx");
+ Assert.isTrue(inputStream != null, "妯℃澘涓嶅瓨鍦�");
- public Long getCustomerId() {
- return customerId;
- }
+ // 杞� Map
+ Map<String, Object> dataMap = BeanUtil.beanToMap(exportProcessContract);
- public String getCustomerName() {
- return customerName;
- }
+ // 缁戝畾寰幆绛栫暐
+ Configure configure = Configure.builder()
+ .bind("saleProducts", new LoopRowTableRenderPolicy())
+ .build();
- public BigDecimal getTotalAmount() {
- return totalAmount;
- }
+ // 娓叉煋妯℃澘
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, configure)
+ .render(dataMap);
+// template.write(FileUtil.getOutputStream("/Users/ONEX/Downloads/a.docx"));
+
+ // 杈撳嚭鍒版祻瑙堝櫒
+ HttpServletResponse response =
+ ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
+ .getResponse();
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ response.setHeader("Content-Disposition", "attachment;filename="+ StrUtil.format("{}-{}",exportProcessContract.getPartyAClientName(),exportProcessContract.getCreateTime()) +"鍚堝悓.docx");
+
+ template.write(response.getOutputStream());
+ template.close();
+ response.flushBuffer();
}
/**
@@ -646,7 +678,7 @@
// 4. 澶勭悊瀛愯〃鏁版嵁
List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class,salesLedgerDto.getType()));
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
updateMainContractAmount(
salesLedger.getId(),
productList,
@@ -665,8 +697,6 @@
throw new BaseException("鏂囦欢杩佺Щ澶辫触: " + e.getMessage());
}
}
-
- // 鏂囦欢杩佺Щ鏂规硶
/**
* 灏嗕复鏃舵枃浠惰縼绉诲埌姝e紡鐩綍
@@ -743,6 +773,7 @@
}
}
+ // 鏂囦欢杩佺Щ鏂规硶
@Override
public void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, SaleEnum type) {
@@ -884,4 +915,34 @@
throw new RuntimeException("鍔ㄦ�佹洿鏂颁富琛ㄩ噾棰濆け璐�", e);
}
}
+
+ // 鍐呴儴绫荤敤浜庡瓨鍌ㄨ仛鍚堢粨鏋�
+ private static class GroupedCustomer {
+ private final Long customerId;
+ private final String customerName;
+ private BigDecimal totalAmount = BigDecimal.ZERO;
+
+ public GroupedCustomer(Long customerId, String customerName) {
+ this.customerId = customerId;
+ this.customerName = customerName;
+ }
+
+ public void addAmount(BigDecimal amount) {
+ if (amount != null) {
+ this.totalAmount = this.totalAmount.add(amount);
+ }
+ }
+
+ public Long getCustomerId() {
+ return customerId;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public BigDecimal getTotalAmount() {
+ return totalAmount;
+ }
+ }
}
diff --git a/src/main/java/com/ruoyi/sales/vo/ExportProcessContractVo.java b/src/main/java/com/ruoyi/sales/vo/ExportProcessContractVo.java
new file mode 100644
index 0000000..5ec848c
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/vo/ExportProcessContractVo.java
@@ -0,0 +1,115 @@
+package com.ruoyi.sales.vo;
+
+import com.ruoyi.basic.pojo.Customer;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Optional;
+
+import static com.ruoyi.common.utils.StringUtils.padRight;
+
+/**
+ * @author buhuazhen
+ * @date 2026/3/18
+ * @email 3038525872@qq.com
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ExportProcessContractVo implements Serializable {
+
+ private Long id;
+
+ // yyyy骞碝M鏈坉d鏃�
+ private String createTime;
+
+
+ // 鎬婚噾棰�(澶у啓姹夊瓧)
+ private String totalAmountZh;
+
+ // 鐢叉柟
+ private Customer partyA;
+
+ // 涔欐柟
+ private Customer partyB;
+
+ // 鐢叉柟鍏徃鍚嶇О
+ private String partyAClientName;
+
+ // 涔欐柟鍏徃鍚嶇О
+ private String partyBClientName;
+
+ // 澶囨敞
+ private String remark;
+
+ private List<SaleProduct> saleProducts;
+
+ // 绛捐鍦扮偣
+ private String placeOfSinging;
+
+ private String taxRate;
+
+
+ // 鍏紡淇℃伅
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ public static class Customer implements Serializable {
+ // 娉曚汉
+ private String corporation = "";
+
+ // 寮�鎴疯
+ private String bankName = "";
+
+ //浠g悊浜�
+ private String agent = "";
+
+ // 鍦板潃
+ private String address = "";
+
+ //浼犵湡
+ private String fax = "";
+
+ private String taxpayerIdentificationNumber = "";
+
+ // 寮�鎴疯鍙�
+ private String bankCode = "";
+
+
+ // 閭紪
+ private String postCode = "";
+
+ public static ExportProcessContractVo.Customer getCustomer(com.ruoyi.basic.pojo.Customer customer) {
+ ExportProcessContractVo.Customer partyA = new ExportProcessContractVo.Customer();
+ partyA.setFax(Optional.ofNullable(customer.getFax()).orElse(""));
+ partyA.setAddress(padRight(customer.getCompanyAddress(), 15));
+ partyA.setCorporation(Optional.ofNullable(customer.getCorporation()).orElse(""));
+ partyA.setBankName(padRight(customer.getBankName(), 13));
+ partyA.setAgent(Optional.ofNullable(customer.getAgent()).orElse(""));
+ partyA.setTaxpayerIdentificationNumber(padRight(customer.getTaxpayerIdentificationNumber(), 15));
+ partyA.setBankCode(padRight(customer.getBankCode(), 12));
+ return partyA;
+ }
+ }
+
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ public static class SaleProduct implements Serializable {
+ // 鍚堝悓缂栧彿
+ private String salesContractNo = "";
+ private String productCategory = "";
+ private String specificationModel = "";
+ private BigDecimal quantity;
+ // 绋庣巼
+ private BigDecimal taxRate;
+ // 鍚◣鍗曚环
+ private BigDecimal taxInclusiveUnitPrice;
+ // 鍚◣鎬讳环
+ private BigDecimal taxInclusiveTotalPrice;
+ }
+}
diff --git a/src/main/resources/static/contract_tmp.docx b/src/main/resources/static/contract_tmp.docx
new file mode 100644
index 0000000..eb8fb5e
--- /dev/null
+++ b/src/main/resources/static/contract_tmp.docx
Binary files differ
--
Gitblit v1.9.3