From a1243df87bd548b2ddb81d828b0eca9d9bb24374 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 11 Nov 2022 17:31:20 +0800 Subject: [PATCH] //good --- .../iformall/enums/EnumCouponChannelType.java | 8 ++ .../impl/TtCouponGoodsServiceImpl.java | 92 +++++++++---------- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java index 37868742c..34bd5e737 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelType.java @@ -5,6 +5,14 @@ package com.iformall.enums; */ public enum EnumCouponChannelType { + /** + * //投放到抖音渠道。 + * //初次投放,只为展示审核,不让购买。 + * //当券投放到其他渠道时,此渠道自动上架,才可购买。 + * //其他所有渠道下架后,该渠道自动下架。 + */ + COUPON_CHANNEL_ID_DOUYIN(0,"抖音"), + COUPON_CHANNEL_ID_LIST(1, "列表"), COUPON_CHANNEL_ID_TIMED(2, "限时抢购"), COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片"), // banner图, 宣传页,轮播图,走马灯 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 d58b69af3..96c0924d3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -163,28 +163,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } //获取门店,确保所有门店匹配poi -// List couponMerchantList = wxCouponService.getCouponMerchantList(coupon, coupon.getId()); -// if(couponMerchantList.size() > 0){ -// List isAdminList = couponMerchantList.stream().filter(m -> EnumYesOrNo.YES.getCode().equals(m.getIsAdmin())).collect(Collectors.toList()); -// if(isAdminList != null && isAdminList.size() == 1){ -// couponMerchantList = isAdminList; -// }else if(isAdminList != null && isAdminList.size() > 1){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"数据异常,存在多个商管商户"); -// } -// } -// List poiList = new ArrayList(); -// for (WxMerchantVo mvo:couponMerchantList){ -// if(StringUtils.isNotBlank(mvo.getSupplierExtId())){ -// Product.PoiStruct poiStruct = new Product.PoiStruct(); -// poiStruct.setSupplierExtId(mvo.getSupplierExtId()); -// poiList.add(poiStruct); -// } -// } -// if(poiList.isEmpty()){ -// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店"); -// } - - List merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), coupon.getTenantId()); TtMerchantPoi poiQ = new TtMerchantPoi(); poiQ.updateTenantInfo(coupon); @@ -209,39 +187,51 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { merchantQ.setSortColumns(BaseEntity.SortField.MerchantAdmin); WxMerchant merchant = wxMerchantMapper.findIdNameList(merchantQ).get(0); - //查询是否有上架的 + //投放到抖音渠道,获取详情地址,以做审核 WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); wxCouponChannelQuery.updateTenantInfo(coupon); wxCouponChannelQuery.setCouponId(coupon.getId()); - wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); - wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); + wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); - if(wxCouponChannels.size() > 0){ - return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED); - } - //预审核的作废掉 重新投放 - wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); - WxCouponChannel updCouponChannel = new WxCouponChannel(); - updCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_AFTER.getCode()); - updCouponChannel.setUpdateDate(new Date()); - wxCouponChannelMapper.update(updCouponChannel,new QueryWrapper<>(wxCouponChannelQuery)); - //投放预审核 - WxCouponChannel wxCouponChannel = new WxCouponChannel(); - final IdWorker idWorker = IdWorker.get(); - wxCouponChannel.setId(idWorker.nextId()); - wxCouponChannel.updateTenantInfo(coupon); - wxCouponChannel.setShowBeginTime(new Date()); - wxCouponChannel.setBeginTime(new Date()); - wxCouponChannel.setEndTime(coupon.getValidEndDate()); - wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); - wxCouponChannel.setCouponId(coupon.getId()); - wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); - wxCouponChannel.setType(coupon.getType()); - wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); - wxCouponChannel.setBusiness(coupon.getBusiness()); - wxCouponChannel.setSubBusiness(coupon.getSubBusiness()); - wxCouponChannel.setTitle(coupon.getTitle()); - wxCouponChannelMapper.insert(wxCouponChannel); + WxCouponChannel wxCouponChannel = null; + Date now = new Date(); + if(wxCouponChannels == null || wxCouponChannels.isEmpty()){ + wxCouponChannel = new WxCouponChannel(); + final IdWorker idWorker = IdWorker.get(); + wxCouponChannel.setId(idWorker.nextId()); + wxCouponChannel.updateTenantInfo(coupon); + wxCouponChannel.setShowBeginTime(now); + wxCouponChannel.setBeginTime(now); + wxCouponChannel.setEndTime(coupon.getValidEndDate()); + wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); + wxCouponChannel.setCouponId(coupon.getId()); + wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); + wxCouponChannel.setType(coupon.getType()); + wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); + wxCouponChannel.setBusiness(coupon.getBusiness()); + wxCouponChannel.setSubBusiness(coupon.getSubBusiness()); + wxCouponChannel.setTitle(coupon.getTitle()); + wxCouponChannelMapper.insert(wxCouponChannel); + + }else if(wxCouponChannels.size() == 1){ + wxCouponChannel = wxCouponChannels.get(0); + wxCouponChannel.setShowBeginTime(now); + wxCouponChannel.setBeginTime(now); + wxCouponChannel.setEndTime(coupon.getValidEndDate()); + wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); + wxCouponChannel.setCouponId(coupon.getId()); + wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); + wxCouponChannel.setType(coupon.getType()); + wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); + wxCouponChannel.setBusiness(coupon.getBusiness()); + wxCouponChannel.setSubBusiness(coupon.getSubBusiness()); + wxCouponChannel.setTitle(coupon.getTitle()); + wxCouponChannel.setUpdateDate(now); + wxCouponChannelMapper.updateById(wxCouponChannel); + + }else{ + return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED.getCode(),"此券状态异常,请重新创建"); + } //提交审核 try {