Commit f74a69748c63b9b9fa03cdfb66ea90a2577e3a02

Authored by 房远帅
1 parent 5638f67d

楚江ERP:草稿要车单-业务员(合同创建人)可修改

... ... @@ -18,6 +18,7 @@ import com.lframework.xingyun.sc.vo.shipments.car.*;
18 18 import io.swagger.annotations.Api;
19 19 import io.swagger.annotations.ApiImplicitParam;
20 20 import io.swagger.annotations.ApiOperation;
  21 +import org.apache.commons.lang3.StringUtils;
21 22 import org.springframework.beans.factory.annotation.Autowired;
22 23 import org.springframework.validation.annotation.Validated;
23 24 import org.springframework.web.bind.annotation.*;
... ... @@ -60,7 +61,10 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
60 61
61 62 results = datas.stream().map(draftRequestCarTicket -> {
62 63 GetDraftRequestCarTicketBo bo = new GetDraftRequestCarTicketBo(draftRequestCarTicket);
63   - PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(draftRequestCarTicket.getPurchaseOrderId());
  64 + PurchaseOrderInfo purchaseOrderInfo = null;
  65 + if (StringUtils.isNotEmpty(draftRequestCarTicket.getPurchaseOrderId())) {
  66 + purchaseOrderInfo = purchaseOrderInfoService.findById(draftRequestCarTicket.getPurchaseOrderId());
  67 + }
64 68 // 判断 createById 是否等于当前用户 ID
65 69 boolean isCreateBy = false;
66 70 if (purchaseOrderInfo != null && currentUserId.equals(purchaseOrderInfo.getContractCreateById())) {
... ... @@ -92,6 +96,14 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
92 96 }
93 97
94 98 GetDraftRequestCarTicketBo result = new GetDraftRequestCarTicketBo(data);
  99 + result.setDraftCreateBy(false);
  100 + if (StringUtils.isNotEmpty(result.getPurchaseOrderId())) {
  101 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  102 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(result.getPurchaseOrderId());
  103 + if (purchaseOrderInfo != null && currentUserId.equals(purchaseOrderInfo.getContractCreateById())) {
  104 + result.setDraftCreateBy(true);
  105 + }
  106 + }
95 107
96 108 return InvokeResultBuilder.success(result);
97 109 }
... ...