Authored by tanling

参数检查

@@ -34,7 +34,7 @@ public class ErpFastDeliveryController { @@ -34,7 +34,7 @@ public class ErpFastDeliveryController {
34 34
35 35
36 /** 36 /**
37 - * 批量上架 37 + * 货号+尺寸是否存在
38 * @param req 38 * @param req
39 * @return 39 * @return
40 */ 40 */
@@ -364,7 +364,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -364,7 +364,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
364 public List<FastDeliveryBatchOnShelfResp> batchOnShelf(FastDeliveryBatchOnShelfReq req) { 364 public List<FastDeliveryBatchOnShelfResp> batchOnShelf(FastDeliveryBatchOnShelfReq req) {
365 365
366 // 1.检查入口参数 366 // 1.检查入口参数
367 - checkBatchOnShelf(req, true); 367 + checkBatchOnShelf(req, true, true);
368 368
369 // 2.检查用户权限(极速发货权限) 369 // 2.检查用户权限(极速发货权限)
370 SellerWrapper sellerWrapper = checkFastDeliveryAuth(req.getUid()); 370 SellerWrapper sellerWrapper = checkFastDeliveryAuth(req.getUid());
@@ -439,7 +439,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -439,7 +439,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
439 */ 439 */
440 public List<StorageCheckResp> getStorageInfo(FastDeliveryBatchOnShelfReq req){ 440 public List<StorageCheckResp> getStorageInfo(FastDeliveryBatchOnShelfReq req){
441 // 1.检查入口参数 441 // 1.检查入口参数
442 - checkBatchOnShelf(req, false); 442 + checkBatchOnShelf(req, false,false);
443 443
444 return productProxyService.getStorageInfoList(buildStorageReq(req)); 444 return productProxyService.getStorageInfoList(buildStorageReq(req));
445 } 445 }
@@ -515,7 +515,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -515,7 +515,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
515 } 515 }
516 516
517 517
518 - private void checkBatchOnShelf(FastDeliveryBatchOnShelfReq req, boolean checkPrice) { 518 + private void checkBatchOnShelf(FastDeliveryBatchOnShelfReq req, boolean checkNum, boolean checkPrice) {
519 519
520 if (req.getUid() < 0){ 520 if (req.getUid() < 0){
521 logger.warn("uid is empty"); 521 logger.warn("uid is empty");
@@ -529,12 +529,18 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -529,12 +529,18 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
529 529
530 for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){ 530 for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){
531 if (StringUtils.isBlank(productInfo.getSizeName()) 531 if (StringUtils.isBlank(productInfo.getSizeName())
532 - || StringUtils.isBlank(productInfo.getProductCode())  
533 - || productInfo.getNum() == null){ 532 + || StringUtils.isBlank(productInfo.getProductCode())){
534 logger.warn("productInfo is invalidate {}", productInfo); 533 logger.warn("productInfo is invalidate {}", productInfo);
535 throw new UfoServiceException(400, "商品信息不合法"); 534 throw new UfoServiceException(400, "商品信息不合法");
536 } 535 }
537 536
  537 + if (checkNum){
  538 + if (productInfo.getNum() == null){
  539 + logger.warn("productInfo is invalidate {}", productInfo);
  540 + throw new UfoServiceException(400, "商品信息不合法");
  541 + }
  542 + }
  543 +
538 if (checkPrice){ 544 if (checkPrice){
539 // 价格已9结尾 545 // 价格已9结尾
540 BigDecimal salePrice = priceComputePrepareProcessor.checkAndAcquireSalePrice(productInfo.getPrice(), SkupType.FAST_DELIVERY); 546 BigDecimal salePrice = priceComputePrepareProcessor.checkAndAcquireSalePrice(productInfo.getPrice(), SkupType.FAST_DELIVERY);