From ef30e3f2eebad385c8b26bd0ff931c028d46f3ce Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期一, 21 四月 2025 10:39:00 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java |   73 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 1 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
index 8e4acc0..6987379 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -46,6 +46,7 @@
 import com.ruoyi.system.vo.CheckAcceptRecordVO;
 import com.ruoyi.system.vo.TContractVO;
 import com.ruoyi.web.controller.tool.NumberToChineseUtils;
+import com.ruoyi.web.controller.tool.TencentCosUtil;
 import com.ruoyi.web.controller.tool.WordUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -62,6 +63,7 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -358,6 +360,8 @@
     }
     @Autowired
     private WordUtil wordUtil;
+    @Autowired
+    private TencentCosUtil tencentCosUtil;
     @ApiOperation(value = "生成合同附件")
     @PostMapping("/set")
     @Log(title = "生成合同附件", businessType = BusinessType.EXPORT)
@@ -532,12 +536,18 @@
             fill(templateParam, "checkTime", "");
         }
 
+        String url = "";
+        if (StringUtils.isNotEmpty(contract.getSignature())){
+            url = tencentCosUtil.downLoadFileImg(contract.getSignature());
+        }
+
+
         return wordUtil.generatePdf(
                 "/usr/local/project/file/",
                 templateFileName,
                 templateParam,
                 "租赁合同",
-                "/usr/local/project/file/");
+                "/usr/local/project/file/",url);
     }
 
     private BigDecimal extracted(TContract contract,TContractDTO dto) {
@@ -789,6 +799,67 @@
     @PostMapping("/generateContractPreview")
     public R<String> generateContractPreview(@RequestBody TContractDTO dto)
     {
+        String contractName = dto.getContractName();
+        if (StringUtils.isEmpty(contractName)){
+            return R.fail("合同名称不能为空");
+        }
+        LocalDateTime startTime = dto.getStartTime();
+        if (startTime == null){
+            return R.fail("合同生效日期不能为空");
+        }
+        LocalDateTime endTime = dto.getEndTime();
+        if (endTime == null){
+            return R.fail("合同生效日期不能为空");
+        }
+
+        BigDecimal monthRent = dto.getMonthRent();
+        if (monthRent == null){
+            return R.fail("月租金不能为空");
+        }
+
+        BigDecimal deposit = dto.getDeposit();
+        if (deposit == null){
+            return R.fail("押金不能为空");
+        }
+
+        String payType = dto.getPayType();
+        if (StringUtils.isEmpty(payType)){
+            return R.fail("租金支付方式不能为空");
+        }
+
+        LocalDateTime startPayTime = dto.getStartPayTime();
+        if (startPayTime == null){
+            return R.fail("开始计费日期不能为空");
+        }
+
+        String partyOneName = dto.getPartyOneName();
+        if (StringUtils.isEmpty(partyOneName)){
+            return R.fail("甲方名称不能为空");
+        }
+
+        String partyOnePerson = dto.getPartyOnePerson();
+        if (StringUtils.isEmpty(partyOnePerson)){
+            return R.fail("甲方联系人不能为空");
+        }
+
+        String partyOnePhone = dto.getPartyOnePhone();
+        if (StringUtils.isEmpty(partyOnePhone)){
+            return R.fail("甲方联系电话不能为空");
+        }
+
+        String partyTwoName = dto.getPartyTwoName();
+        if (StringUtils.isEmpty(partyTwoName)){
+            return R.fail("乙方名称不能为空");
+        }
+        String partyTwoPerson = dto.getPartyTwoPerson();
+        if (StringUtils.isEmpty(partyTwoPerson)){
+            return R.fail("乙方联系人不能为空");
+        }
+        String partyTwoPhone = dto.getPartyTwoPhone();
+        if (StringUtils.isEmpty(partyTwoPhone)){
+            return R.fail("乙方联系电话不能为空");
+        }
+
         TContract contract = new TContract();
         BeanUtil.copyProperties(dto,contract);
         return R.ok(generateContract(contract,dto));

--
Gitblit v1.7.1