Quellcode durchsuchen

Merge branch 'develop/v1.0' into master-test

Bob vor 1 Woche
Ursprung
Commit
7612f96e2b

+ 1 - 1
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/OrderServiceImpl.java

@@ -326,7 +326,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 Map<String, String> result = new HashMap<>();
                 result.put("payHref", payHref);
                 result.put("orderId", order.getId());
-                result.put("thirdOrderNo", order.getThirdOrderNo());
+                result.put("thirdOrderNo", order.getThirdTradeNo());
                 return result;
             }
         } catch (IOException e) {

+ 1 - 1
pdf-office-pdf-website/src/main/java/cn/kdan/cloud/pdf/office/website/controller/PdfOfficeWebController.java

@@ -64,7 +64,7 @@ public class PdfOfficeWebController {
      */
     @GetMapping("/checkCoupon")
     public ResultMap<ListingProductVO> checkCoupon(@Validated @NotNull(message = "产品id不能为空") @RequestParam("productId") String productId,
-                                                   @NotNull(message = "用户id不能为空") @RequestParam("userId") String userId,
+                                                   @RequestParam(required = false, name = "userId") String userId,
                                                    @NotNull(message = "券码不能为空") @RequestParam("code") String code) {
         return productInfoService.checkCoupon(productId,userId, code);
     }

+ 1 - 1
pdf-office-product/src/main/java/cn/kdan/cloud/pdf/office/product/controller/ProductController.java

@@ -151,7 +151,7 @@ public class ProductController {
      */
     @GetMapping("/checkCoupon")
     public ResultMap<ListingProductVO> checkCoupon(@Validated @NotNull(message = "产品id不能为空") @RequestParam("productId") String productId,
-                                                 @NotNull(message = "用户id不能为空") @RequestParam("userId") String userId,
+                                                 @RequestParam(required = false, name = "userId") String userId,
                                                  @NotNull(message = "券码不能为空") @RequestParam("code") String code) {
         return ResultMap.success(productService.checkCoupon(productId,userId, code));
     }

+ 49 - 36
pdf-office-product/src/main/java/cn/kdan/cloud/pdf/office/product/service/impl/ProductServiceImpl.java

@@ -392,50 +392,63 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
 
     @Override
     public ListingProductVO checkCoupon(String productId, String userId, String code) {
-        Prize prize = prizeService.getOne(new LambdaQueryWrapper<Prize>()
-                .eq(Prize::getCode, code).eq(Prize::getValidFlag, 1));
-        if (prize == null) {
-            log.error("优惠券不存在:{}", code);
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_NOT_EXISTS);
-        }
-        if (prize.getType() != 1) {
-            log.error("优惠券类型错误:{}", code);
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_TYPE_ERROR);
-        }
-        if (StringUtils.isNotEmpty(prize.getProductId()) && !prize.getProductId().contains(productId)) {
-            log.error("优惠券关联产品错误,productId:{}", productId);
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
-        }
-        if (prize.getValidFlag() != 1) {
-            log.error("优惠券不可用:{}", code);
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
-        }
-        if (prize.getEndDate().before(new Date()) || prize.getStartDate().after(new Date())) {
-            log.error("优惠券时间不可用:{}", code);
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
-        }
         List<ListingProductVO> productVOs = this.baseMapper.getProductsByIds(Collections.singletonList(productId));
         ListingProductVO listingProductVO = productVOs.get(0);
-        if(ObjectUtils.isNotEmpty(listingProductVO.getIsAi())&&listingProductVO.getIsAi().equals(1)){
-            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
+        if (ObjectUtils.isEmpty(listingProductVO)) {
+            throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_PRODUCT_NOT_EXIST);
         }
-        if(ObjectUtils.isNotEmpty(listingProductVO.getDisplayPrice())){
-            if (prize.getActivityType().equals("1")){
+        if ("4DDF2-6860-49C".equals(code)) {
+            // 运营临时活动优惠,只针对黑五产品
+            if (blackFiveProduct.contains(listingProductVO.getCode())) {
+                listingProductVO.setDisplayPrice(listingProductVO.getDisplayPrice().subtract(new BigDecimal("20")));
+                listingProductVO.setCnyDisplayPrice(listingProductVO.getCnyDisplayPrice().subtract(new BigDecimal("130")));
+            } else {
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
+            }
+        } else {
+            Prize prize = prizeService.getOne(new LambdaQueryWrapper<Prize>()
+                    .eq(Prize::getCode, code).eq(Prize::getValidFlag, 1));
+            if (prize == null) {
+                log.error("优惠券不存在:{}", code);
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_NOT_EXISTS);
+            }
+            if (prize.getType() != 1) {
+                log.error("优惠券类型错误:{}", code);
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_TYPE_ERROR);
+            }
+            if (StringUtils.isNotEmpty(prize.getProductId()) && !prize.getProductId().contains(productId)) {
+                log.error("优惠券关联产品错误,productId:{}", productId);
                 throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
             }
-            listingProductVO.setDisplayPrice(listingProductVO.getDisplayPrice().subtract(prize.getUsdPrice()));
-            listingProductVO.setCnyDisplayPrice(listingProductVO.getCnyDisplayPrice().subtract(prize.getCnyPrice()));
-        }else{
-            if ("1".equals(prize.getActivityType())) {
-                if (listingProductVO.getDiscountType()==1) {
-                    throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
+            if (prize.getValidFlag() != 1) {
+                log.error("优惠券不可用:{}", code);
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
+            }
+            if (prize.getEndDate().before(new Date()) || prize.getStartDate().after(new Date())) {
+                log.error("优惠券时间不可用:{}", code);
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
+            }
+            if(ObjectUtils.isNotEmpty(listingProductVO.getIsAi())&&listingProductVO.getIsAi().equals(1)){
+                throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
+            }
+            if(ObjectUtils.isNotEmpty(listingProductVO.getDisplayPrice())){
+                if (prize.getActivityType().equals("1")){
+                    throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
                 }
-                if (listingProductVO.getPrice().compareTo(BigDecimal.valueOf(79.99)) < 0) {
-                    throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
+                listingProductVO.setDisplayPrice(listingProductVO.getDisplayPrice().subtract(prize.getUsdPrice()));
+                listingProductVO.setCnyDisplayPrice(listingProductVO.getCnyDisplayPrice().subtract(prize.getCnyPrice()));
+            }else{
+                if ("1".equals(prize.getActivityType())) {
+                    if (listingProductVO.getDiscountType()==1) {
+                        throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
+                    }
+                    if (listingProductVO.getPrice().compareTo(BigDecimal.valueOf(79.99)) < 0) {
+                        throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_PRODUCT_ERROR);
+                    }
                 }
+                listingProductVO.setDisplayPrice(listingProductVO.getPrice().subtract(prize.getUsdPrice()));
+                listingProductVO.setCnyDisplayPrice(listingProductVO.getCnyPrice().subtract(prize.getCnyPrice()));
             }
-            listingProductVO.setDisplayPrice(listingProductVO.getPrice().subtract(prize.getUsdPrice()));
-            listingProductVO.setCnyDisplayPrice(listingProductVO.getCnyPrice().subtract(prize.getCnyPrice()));
         }
         return listingProductVO;
     }