chao %!s(int64=4) %!d(string=hai) anos
pai
achega
d39d8e57ac

+ 7 - 4
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -85,11 +85,16 @@ public class PriceUtilService {
     public void setPriceByUserId(PriceVo price, Integer userId) {
         // 根据用户Id查询用户身份
         Integer identity = priceMapper.getIdentityByUserId(userId);
-        price.setRepurchaseFlag(0);
-        if (price.getActStatus() == null){
+        // 根据商品id查询商品活动
+        PromotionsVo promotions = promotionsMapper.getPromotionsByProductId(price.getProductId());
+        if (null != promotions) {
+            price.setPromotions(promotions);
+            price.setActStatus(1);
+        } else {
             // 默认非促销活动状态
             price.setActStatus(0);
         }
+        price.setRepurchaseFlag(0);
         if (null != identity && identity > 0) {
             // 用户身份: 2-会员机构, 4-普通机构
             price.setUserIdentity(identity);
@@ -97,8 +102,6 @@ public class PriceUtilService {
             price.setOriginalPrice(price.getPrice());
             //税费标志
             boolean taxFlag = "0".equals(price.getIncludedTax()) && ("1".equals(price.getInvoiceType()) || "2".equals(price.getInvoiceType()));
-            // 根据商品id查询商品活动
-            PromotionsVo promotions = promotionsMapper.getPromotionsByProductId(price.getProductId());
             if (null != promotions) {
                 // 促销活动
                 price.setActStatus(1);