From e24e9d36b6a7be98544851798a8433522e9633f0 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 18 Dec 2024 13:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/order/controller/OrderController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java index 749aab6..659e51d 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java @@ -32,6 +32,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.mock.web.MockMultipartFile; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; @@ -190,6 +191,9 @@ public class OrderController extends BaseController { bmContract.setStatus(1); bmContract.setOwnerCom(orderInfoDto.getCompanyId().longValue()); List list = bmContractService.getContractUrl(bmContract); + if (CollectionUtils.isEmpty(list)) { + return AjaxResult.error("请先上传合同"); + } String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl(); InputStream inputStream = new URL(wordUrl).openStream(); @@ -258,6 +262,9 @@ public class OrderController extends BaseController { bmContract.setStatus(1); bmContract.setOwnerCom(orderInfoDto.getCompanyId().longValue()); List list = bmContractService.getContractUrl(bmContract); + if (CollectionUtils.isEmpty(list)) { + return AjaxResult.error("请先上传合同"); + } String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl(); InputStream inputStream = new URL(wordUrl).openStream(); XWPFDocument document = new XWPFDocument(inputStream); @@ -271,7 +278,7 @@ public class OrderController extends BaseController { //订单金额 replacements.put("${cost}", orderInfoDto.getCost().toString()); //订单详情 - StrBuilder orderDetail = new StrBuilder(); + StringBuilder orderDetail = new StringBuilder(); List detailsList = orderInfoDto.getDetailsList(); for (OrderDetailDto orderDetailDto : detailsList) { Date rentBeginTime = inputFormat.parse(orderDetailDto.getRentBeginTime().toString());