Commit 00da7bc06e02c474ff52196c8a889e82d192977a

Authored by yeqianyong
1 parent 1993ac6e

楚江erp:订货单-检查数据是否规范接口开发

... ... @@ -19,9 +19,11 @@ import com.lframework.starter.web.core.utils.PageResultUtil;
19 19 import com.lframework.starter.web.inner.entity.*;
20 20 import com.lframework.starter.web.inner.service.system.*;
21 21 import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderInfoBo;
  22 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
22 23 import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
23 24 import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
24 25 import com.lframework.xingyun.sc.handlers.TransactorHandler;
  26 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
25 27 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
26 28 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
27 29 import com.lframework.xingyun.sc.utils.LatexFormulaExcelExporterUtil;
... ... @@ -34,6 +36,7 @@ import io.swagger.annotations.ApiImplicitParam;
34 36 import io.swagger.annotations.ApiOperation;
35 37 import lombok.extern.slf4j.Slf4j;
36 38 import org.apache.commons.collections4.CollectionUtils;
  39 +import org.apache.commons.lang3.BooleanUtils;
37 40 import org.apache.commons.lang3.StringUtils;
38 41 import org.apache.poi.ss.usermodel.*;
39 42 import org.apache.poi.ss.util.CellRangeAddress;
... ... @@ -82,6 +85,9 @@ public class PurchaseOrderInfoController extends DefaultBaseController {
82 85 private FlowTaskWrapperMapper flowTaskWrapperMapper;
83 86 @Resource
84 87 private TransactorHandler transactorHandler;
  88 + @Resource
  89 + private ContractDistributorStandardService contractDistributorStandardService;
  90 +
85 91
86 92 /**
87 93 * 查询列表
... ... @@ -275,6 +281,31 @@ public class PurchaseOrderInfoController extends DefaultBaseController {
275 281 return InvokeResultBuilder.success();
276 282 }
277 283
  284 +
  285 + /**
  286 + * 检查数据是否规范
  287 + */
  288 + @ApiOperation("检查数据是否规范")
  289 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  290 + @GetMapping("/check")
  291 + public InvokeResult<Void> check(@NotBlank(message = "id不能为空!") String id) {
  292 + // 判断合同是否符合规范
  293 + PurchaseOrderInfo orderInfo = purchaseOrderInfoService.findById(id);
  294 + if (orderInfo == null) {
  295 + throw new DefaultClientException("订货单不存在!");
  296 + }
  297 + ContractDistributorStandard contract = contractDistributorStandardService.findById(orderInfo.getContractId());
  298 + if (contract == null) {
  299 + throw new DefaultClientException("合同不存在!");
  300 + }
  301 + Boolean standardStandardized = contract.getStandardStandardized();
  302 + if (!BooleanUtils.isTrue(standardStandardized)) {
  303 + throw new DefaultClientException("合同不规范,请补充!");
  304 + }
  305 + return InvokeResultBuilder.success();
  306 + }
  307 +
  308 +
278 309 @ApiOperation("订货单打印")
279 310 @GetMapping("/printPurchaseOrder")
280 311 public void printPurchaseOrder(@NotBlank(message = "id不能为空") String id, HttpServletResponse response) throws IOException {
... ...