diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index 85b4d074d..9fa61cfea 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -19,6 +19,7 @@ import com.iformall.mapper.*; import com.iformall.service.*; import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.service.fee.ServiceFeeAdapterService; +import com.iformall.service.util.CouponCacheUtils; import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; import me.chanjar.weixin.common.error.WxErrorException; @@ -27,7 +28,9 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; @@ -98,6 +101,10 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { @Autowired PayServiceFactory payServiceFactory; + @Autowired + @Qualifier("objectCommonRedisTemplate") + RedisTemplate redisTemplate; + // @Override // public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { // PageInfo pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); @@ -552,11 +559,10 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { wxCouponMerchantMapper.insert(cmt); } } - - //审核通过即上架 - handlePullOn(ttCouponChannelPoi,now); } } + //审核通过即上架 + handlePullOn(ttCouponChannelPoi,now); return new ResultData(product); }else{ @@ -650,6 +656,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { wxCouponChannelMapper.insert(addCouponChannel); } + CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); + CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId(),null); + } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index d9dbb147a..689334731 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -1833,6 +1833,20 @@ public class WxCouponServiceImpl implements WxCouponService { @Override @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) public ResultData disable(TenantEntity tenantInfo, Long couponId, MallUserInfo user) { + TtCouponChannelPoi onlineStatus = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(), couponId); + if(onlineStatus != null){ + if(EnumSpuSyncStatus.sync_auditing.getCode().equals(onlineStatus.getStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"此券审核中"); + } + Long draftId = wxCouponMapper.selectDraftId(couponId,tenantInfo.getTenantId()); + if(draftId != null){ + TtCouponChannelPoi draftStatus = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(), couponId); + if(draftStatus != null && EnumSpuSyncStatus.sync_auditing.getCode().equals(draftStatus.getStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"此券草稿审核中"); + } + } + } + WxCoupon couponUpd = new WxCoupon(); couponUpd.updateTenantInfo(tenantInfo); couponUpd.setId(couponId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 75db2207c..5e73aae75 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -455,8 +455,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { return false; } - @Transactional(rollbackFor = {Exception.class}) @Override + @Transactional(rollbackFor = {Exception.class}) public void disable(Long id) { WxMerchant wxMerchant = wxMerchantMapper.selectById(id); if (wxMerchant == null) {