Просмотр исходного кода

增加 添加优惠券 和修改优惠券 机构id问题

hgw 3 лет назад
Родитель
Сommit
a61e4f5439

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysCouponServiceImpl.java

@@ -10,6 +10,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -110,6 +111,7 @@ public class SysCouponServiceImpl extends BaseServiceImpl<Integer, SysCoupon> im
             if (sysCoupon.getStockCount() == -1) {
                 sysCoupon.setWarningStockNum(-1);
             }
+            sysCoupon.setTenantId(TenantContextHolder.getTenantId());
             sysCouponDao.update(sysCoupon);
         }
     }
@@ -133,6 +135,7 @@ public class SysCouponServiceImpl extends BaseServiceImpl<Integer, SysCoupon> im
         sysCoupon.setStatus(0);
         sysCoupon.setConsumeNum(0);
         sysCoupon.setWarningStatus(0);
+        sysCoupon.setTenantId(TenantContextHolder.getTenantId());
         if (Objects.isNull(sysCoupon.getType())) {
             throw new BizException("请指定优惠券类型");
         }