|
|
|
@@ -8,6 +8,7 @@ import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.enums.EnumAppPlat; |
|
|
|
import com.iformall.enums.EnumCouponChannelStatus; |
|
|
|
import com.iformall.enums.EnumCouponMallStatus; |
|
|
|
import com.iformall.enums.EnumCouponMerchantStatus; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
import com.iformall.enums.EnumSpuSyncStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
@@ -31,6 +32,8 @@ public class WxCouponMallServiceImpl implements WxCouponMallService { |
|
|
|
WxCouponChannelMapper wxCouponChannelMapper; |
|
|
|
@Autowired |
|
|
|
WxMallMapper wxMallMapper; |
|
|
|
@Autowired |
|
|
|
WxCouponMerchantMapper wxCouponMerchantMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WxCouponMall> list(WxCouponMall wxCouponMall,boolean queryMall){ |
|
|
|
@@ -72,9 +75,19 @@ public class WxCouponMallServiceImpl implements WxCouponMallService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void finised(String tenantId, Long couponId, String mallTenantId) { |
|
|
|
public void finised(String couponTenantId, Long couponId, String mallTenantId) { |
|
|
|
//查询商户设置了没有 |
|
|
|
WxCouponMerchant cmParam = new WxCouponMerchant(); |
|
|
|
cmParam.setTenantId(mallTenantId); |
|
|
|
cmParam.setProductId(couponId); |
|
|
|
cmParam.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
List<WxCouponMerchant> merchantList = wxCouponMerchantMapper.findList(cmParam); |
|
|
|
if (null == merchantList || merchantList.size() <= 0 ) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"未设置有效商户"); |
|
|
|
} |
|
|
|
|
|
|
|
WxCouponMall couponMall = new WxCouponMall(); |
|
|
|
couponMall.setTenantId(tenantId); |
|
|
|
couponMall.setTenantId(couponTenantId); |
|
|
|
couponMall.setMallTenantId(mallTenantId); |
|
|
|
couponMall.setProductId(couponId); |
|
|
|
couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()); |
|
|
|
@@ -82,17 +95,17 @@ public class WxCouponMallServiceImpl implements WxCouponMallService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void unfinised(String tenantId, Long couponId,Integer couponType, String mallTenantId) throws Exception{ |
|
|
|
public void unfinised(String couponTenantId, Long couponId,Integer couponType, String mallTenantId) throws Exception{ |
|
|
|
//抖音平台查询的是未提交抖音审核的,微信是未上架的 |
|
|
|
EnumAppPlat plat = EnumCouponType.getAppPlat(couponType); |
|
|
|
if (plat == EnumAppPlat.TOUTIAO) { |
|
|
|
TtCouponChannelPoi poi = ttCouponChannelPoiMapper.selectById(tenantId, couponId); |
|
|
|
TtCouponChannelPoi poi = ttCouponChannelPoiMapper.selectById(couponTenantId, couponId); |
|
|
|
if (null != poi &&( EnumSpuSyncStatus.isValid(poi.getLastStatus()))) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"券已在抖音审核流程中,无法修改。"); |
|
|
|
} |
|
|
|
}else if (plat == EnumAppPlat.WX) { |
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
couponChannel.setTenantId(tenantId); |
|
|
|
couponChannel.setTenantId(couponTenantId); |
|
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
List<WxCouponChannel> clist = wxCouponChannelMapper.findList(couponChannel); |
|
|
|
if (null != clist && clist.size() > 0 ) { |
|
|
|
@@ -100,7 +113,7 @@ public class WxCouponMallServiceImpl implements WxCouponMallService { |
|
|
|
} |
|
|
|
} |
|
|
|
WxCouponMall couponMall = new WxCouponMall(); |
|
|
|
couponMall.setTenantId(tenantId); |
|
|
|
couponMall.setTenantId(couponTenantId); |
|
|
|
couponMall.setMallTenantId(mallTenantId); |
|
|
|
couponMall.setProductId(couponId); |
|
|
|
couponMall.setStatus(EnumCouponMallStatus.UNFINISED.getCode()); |
|
|
|
|