瀏覽代碼

bugfix:联调修改细节

lyx 22 小時之前
父節點
當前提交
2702c15e3b

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/StorePlatformBenefits.java

@@ -71,5 +71,9 @@ public class StorePlatformBenefits {
     @ApiModelProperty(value = "U币Id")
     @TableField(exist = false)
     private Integer virtualCurrencyId;
+
+    @ApiModelProperty(value = "UB数量")
+    @TableField(exist = false)
+    private Integer virtualCurrencyAmount;
 }
 

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreVirtualCurrency.java

@@ -47,6 +47,10 @@ public class StoreVirtualCurrency {
     @TableField("created_user_id")
     private Integer createdUserId;
 
+    @ApiModelProperty(value = "U币数量")
+    @TableField("quantity")
+    private Integer quantity;
+
     @ApiModelProperty(value = "修改时间")
     @TableField(value = "updated_time", fill = FieldFill.UPDATE)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

+ 5 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StorePlatformBenefitsVo.java

@@ -20,5 +20,10 @@ public class StorePlatformBenefitsVo extends StorePlatformBenefits {
      * 是否领取
      */
     private Boolean claimed;
+
+    /**
+     * 数量
+     */
+    private Integer quantity;
 }
 

+ 14 - 6
alien-entity/src/main/java/shop/alien/mapper/StorePlatformBenefitsMapper.java

@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.StorePlatformBenefits;
-import shop.alien.entity.store.vo.LifeUserViolationVo;
 import shop.alien.entity.store.vo.StorePlatformBenefitsVo;
 
 /**
@@ -27,13 +26,22 @@ public interface StorePlatformBenefitsMapper extends BaseMapper<StorePlatformBen
      */
     @Select("<script>" +
             " select * from ( " +
-            " select spb.id, spb.type, spb.business_id, spb.usage_conditions, lc.name  " +
-            " from store_platform_benefits spb  " +
-            " inner join life_coupon lc on spb.business_id = lc.id  " +
+            " select\n" +
+            "\tspb.id,\n" +
+            "\tspb.type,\n" +
+            "\tspb.business_id,\n" +
+            "\tspb.usage_conditions,\n" +
+            "\tldc.name,\n" +
+            " spb.created_time," +
+            " 0 quantity \n" +
+            "from\n" +
+            "\tstore_platform_benefits spb\n" +
+            "inner join life_discount_coupon ldc on\n" +
+            "\tspb.business_id = ldc.id and spb.delete_flag = 0 " +
             " union all " +
-            " select spb.id, spb.type, spb.business_id, spb.usage_conditions, svc.name  " +
+            " select spb.id, spb.type, spb.business_id, spb.usage_conditions, svc.name, spb.created_time,svc.quantity  " +
             " from store_platform_benefits spb " +
-            " inner join store_virtual_currency svc on spb.business_id = svc.id ) a " +
+            " inner join store_virtual_currency svc on spb.business_id = svc.id  and spb.delete_flag = 0  ) a " +
             " ${ew.customSqlSegment}" +
             "</script>")
     IPage<StorePlatformBenefitsVo> getPlatformBenefitsPage(

+ 10 - 5
alien-store/src/main/java/shop/alien/store/service/impl/StorePlatformBenefitsServiceImpl.java

@@ -2,6 +2,7 @@ package shop.alien.store.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -85,6 +86,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
             virtualCurrency.setStatus(0);
             virtualCurrency.setCreatedTime(new Date());
             virtualCurrency.setCreatedUserId(userId);
+            virtualCurrency.setQuantity(benefits.getVirtualCurrencyAmount());
             virtualCurrencyMapper.insert(virtualCurrency);
 
             benefits.setBusinessId(virtualCurrency.getId().toString());
@@ -116,6 +118,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
             virtualCurrency.setName(benefits.getName());
             virtualCurrency.setUpdatedTime(new Date());
             virtualCurrency.setUpdatedUserId(userId);
+            virtualCurrency.setQuantity(benefits.getVirtualCurrencyAmount());
             virtualCurrencyMapper.updateById(virtualCurrency);
         }
 
@@ -131,7 +134,9 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
         benefits.setId(id);
         benefits.setDeleteFlag(1);
         benefits.setUpdatedTime(new Date());
-        return benefitsMapper.updateById(benefits);
+        UpdateWrapper<StorePlatformBenefits> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", id).set("delete_flag", 1).set("updated_time", new Date());
+        return benefitsMapper.update(null, updateWrapper);
     }
 
     @Override
@@ -166,9 +171,9 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
         }
         
         // 检查福利状态:必须是审核通过(status=2)
-        if (benefits.getStatus() == null || benefits.getStatus() != 2) {
-            throw new RuntimeException("福利未审核通过,无法领取");
-        }
+//        if (benefits.getStatus() == null || benefits.getStatus() != 2) {
+//            throw new RuntimeException("福利未审核通过,无法领取");
+//        }
         
         // 检查删除标记
         if (benefits.getDeleteFlag() != null && benefits.getDeleteFlag() == 1) {
@@ -226,7 +231,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
             throw new RuntimeException("优惠券信息不存在");
         }
 
-        LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectById(benefitsId);
+        LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectById(benefits.getBusinessId());
         if (lifeDiscountCoupon == null) {
             throw new RuntimeException("优惠券不存在");
         }