| @@ -3,6 +3,7 @@ package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.tt.TtCoupon; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.EnumCampaignType; | import com.iformall.enums.EnumCampaignType; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -25,6 +26,8 @@ public class WxCampaign extends TenantEntity { | |||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected List<WxCouponChannelVo> coupons; | protected List<WxCouponChannelVo> coupons; | ||||
| @TableField(exist = false) | |||||
| protected List<TtCoupon> ttCoupons; | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | ||||
| private String coverImg; | private String coverImg; | ||||
| @@ -6,6 +6,8 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.tt.TtCoupon; | import com.iformall.domain.po.tt.TtCoupon; | ||||
| import org.springframework.scheduling.annotation.Async; | import org.springframework.scheduling.annotation.Async; | ||||
| import java.util.List; | |||||
| public interface TtCouponService { | public interface TtCouponService { | ||||
| /** | /** | ||||
| @@ -18,6 +20,8 @@ public interface TtCouponService { | |||||
| */ | */ | ||||
| PageInfo<TtCoupon> listAsPage(TtCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<TtCoupon> listAsPage(TtCoupon record, Integer pageIndex, Integer pageSize); | ||||
| List<TtCoupon> findList(TtCoupon record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| @@ -49,7 +49,12 @@ public class TtCouponServiceImpl implements TtCouponService { | |||||
| public PageInfo<TtCoupon> listAsPage(TtCoupon record, Integer pageIndex, Integer pageSize) { | public PageInfo<TtCoupon> listAsPage(TtCoupon record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCouponMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCouponMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public List<TtCoupon> findList(TtCoupon record) { | |||||
| return ttCouponMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public TtCoupon getById(Long id) { | public TtCoupon getById(Long id) { | ||||
| return ttCouponMapper.selectById(id); | return ttCouponMapper.selectById(id); | ||||
| @@ -12,11 +12,13 @@ import com.iformall.domain.po.WxCampaign; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.tt.TtCoupon; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.tt.TtCouponService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -42,6 +44,9 @@ public class WxCampaignController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| TtCouponService ttCouponService; | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @@ -165,12 +170,19 @@ public class WxCampaignController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::findById"); | logger.debug("[" + getIpAddr() + "] WxCampaignController::findById"); | ||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | WxCampaign wxCampaign = wxCampaignService.getById(id); | ||||
| if (wxCampaign != null) { | if (wxCampaign != null) { | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| wxCampaign.setCoupons(couponList); | |||||
| // WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| // wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| // wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| // wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||||
| // List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| // wxCampaign.setCoupons(couponList); | |||||
| List<Long> longs = JSONArray.parseArray(wxCampaign.getCouponIds(), Long.class); | |||||
| if(longs != null && longs.size() > 0){ | |||||
| TtCoupon coupon = new TtCoupon(); | |||||
| coupon.setIds(longs); | |||||
| wxCampaign.setTtCoupons(ttCouponService.findList(coupon)); | |||||
| } | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.RedisCache; | import com.iformall.annotation.RedisCache; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -7,6 +8,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCampaign; | import com.iformall.domain.po.WxCampaign; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.tt.TtCoupon; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.EnumCampaignStatus; | import com.iformall.enums.EnumCampaignStatus; | ||||
| import com.iformall.enums.EnumCouponChannelType; | import com.iformall.enums.EnumCouponChannelType; | ||||
| @@ -14,6 +16,7 @@ import com.iformall.enums.EnumPayWay; | |||||
| import com.iformall.enums.EnumProjectPlat; | import com.iformall.enums.EnumProjectPlat; | ||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.tt.TtCouponService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -40,6 +43,8 @@ public class WxCampaignController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCampaignService wxCampaignService; | private WxCampaignService wxCampaignService; | ||||
| @Autowired | @Autowired | ||||
| private TtCouponService ttCouponService; | |||||
| @Autowired | |||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @RedisCache | @RedisCache | ||||
| @@ -64,14 +69,20 @@ public class WxCampaignController extends BaseController { | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | WxCampaign wxCampaign = wxCampaignService.getById(id); | ||||
| if (wxCampaign != null) { | if (wxCampaign != null) { | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| wxCouponChannel.setStatus(0); | |||||
| wxCouponChannel.setShowBeginTime(new Date()); | |||||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| wxCampaign.setCoupons(couponList); | |||||
| // WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| // wxCouponChannel.updateTenantInfo(getTenantInfo()); | |||||
| // wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| // wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| // wxCouponChannel.setStatus(0); | |||||
| // wxCouponChannel.setShowBeginTime(new Date()); | |||||
| // List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| // wxCampaign.setCoupons(couponList); | |||||
| List<Long> longs = JSONArray.parseArray(wxCampaign.getCouponIds(), Long.class); | |||||
| if(longs != null && longs.size() > 0){ | |||||
| TtCoupon coupon = new TtCoupon(); | |||||
| coupon.setIds(longs); | |||||
| wxCampaign.setTtCoupons(ttCouponService.findList(coupon)); | |||||
| } | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||