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());