刘俊驰 1 päivä sitten
vanhempi
commit
0debb943e5

+ 7 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -310,14 +310,14 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
             }
             userOrderDetailVos.forEach(o -> {
                 if (StringUtils.isNotBlank(o.getDiscountJson())) {
-                    Map<String,BigDecimal> decimalMap = JSON.parseObject(o.getDiscountJson(), Map.class);
-                    BigDecimal bigDecimal = decimalMap.get(EDiscountType.DISCOUNT.name());
-                    if (bigDecimal != null) {
-                        userOrderVo.setCardDiscountPrice(userOrderVo.getCardDiscountPrice().add(bigDecimal));
+                    Map<String,String> decimalMap = JSON.parseObject(o.getDiscountJson(), Map.class);
+                    String bigDecimal = decimalMap.get(EDiscountType.DISCOUNT.name());
+                    if (StringUtils.isBlank(bigDecimal)) {
+                        userOrderVo.setCardDiscountPrice(userOrderVo.getCardDiscountPrice().add(new BigDecimal(bigDecimal)));
                     }
-                    BigDecimal couponDecimal = decimalMap.get(EDiscountType.COUPON.name());
-                    if (couponDecimal != null) {
-                        userOrderVo.setDiscountPrice(userOrderVo.getDiscountPrice().add(couponDecimal));
+                    String couponDecimal = decimalMap.get(EDiscountType.COUPON.name());
+                    if (StringUtils.isBlank(couponDecimal)) {
+                        userOrderVo.setDiscountPrice(userOrderVo.getDiscountPrice().add(new BigDecimal(couponDecimal)));
                     }
                 }
             });