|
|
|
@@ -163,28 +163,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
} |
|
|
|
|
|
|
|
//获取门店,确保所有门店匹配poi |
|
|
|
// List<WxMerchantVo> couponMerchantList = wxCouponService.getCouponMerchantList(coupon, coupon.getId()); |
|
|
|
// if(couponMerchantList.size() > 0){ |
|
|
|
// List<WxMerchantVo> 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<Product.PoiStruct> 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<Long> 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<WxCouponChannel> 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 { |
|
|
|
|