| @@ -49,16 +49,7 @@ public class WxScreenAdController extends BaseController { | |||||
| public Result list(@ModelAttribute WxScreenAd wxScreenAd, Integer pageNum, Integer pageSize) { | public Result list(@ModelAttribute WxScreenAd wxScreenAd, Integer pageNum, Integer pageSize) { | ||||
| wxScreenAd.setTenantId(getTenantId()); | wxScreenAd.setTenantId(getTenantId()); | ||||
| wxScreenAd.setStatus(EnumScreenAdStatus.VALID.getCode()); | wxScreenAd.setStatus(EnumScreenAdStatus.VALID.getCode()); | ||||
| PageInfo<WxScreenAd> page = wxScreenAdService.listAsPage(wxScreenAd,pageNum,pageSize); | |||||
| page.getList().stream().forEach(s->{ | |||||
| Object target = null; | |||||
| if (s.getType().equals(EnumScreenAdType.COUPON.getCode())) | |||||
| target = wxCouponChannelService.findDetailVo(s.getTargetId()); | |||||
| else if (s.getType().equals(EnumScreenAdType.CAMPAIGN.getCode())) | |||||
| target = wxCampaignService.getById(s.getTargetId()); | |||||
| s.setTarget(target); | |||||
| }); | |||||
| return new ResultData(page); | |||||
| return new ResultData(wxScreenAdService.listAsPage(wxScreenAd,pageNum,pageSize)); | |||||
| } | } | ||||
| @ApiOperation("添加广告") | @ApiOperation("添加广告") | ||||
| @@ -48,6 +48,10 @@ public class WxScreenAd implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="广告类型",name="type") | @io.swagger.annotations.ApiModelProperty(value="广告类型",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| /**广告子类型 (券渠道)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="广告子类型",name="subType") | |||||
| private Integer subType; | |||||
| /**广告状态**/ | /**广告状态**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="设备状态",name="status") | @io.swagger.annotations.ApiModelProperty(value="设备状态",name="status") | ||||
| private Integer status; | private Integer status; | ||||
| @@ -91,6 +95,14 @@ public class WxScreenAd implements Serializable { | |||||
| this.type = type; | this.type = type; | ||||
| } | } | ||||
| public Integer getSubType() { | |||||
| return subType; | |||||
| } | |||||
| public void setSubType(Integer subType) { | |||||
| this.subType = subType; | |||||
| } | |||||
| public Integer getStatus() { | public Integer getStatus() { | ||||
| return status; | return status; | ||||
| } | } | ||||
| @@ -152,6 +164,7 @@ public class WxScreenAd implements Serializable { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | ||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,SubType_ASC("`sub_type` ASC"),SubType_DESC("`sub_type` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | ||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | ||||
| @@ -12,6 +12,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxScreenAd; | import com.iformall.domain.po.WxScreenAd; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.enums.EnumScreenAdType; | import com.iformall.enums.EnumScreenAdType; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxScreenAdMapper; | import com.iformall.mapper.WxScreenAdMapper; | ||||
| @@ -58,6 +59,19 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| @Override | @Override | ||||
| public ResultData saveOrUpdate(WxScreenAd record) { | public ResultData saveOrUpdate(WxScreenAd record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| if (record.getType() == null || record.getTargetId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| } | |||||
| if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId()); | |||||
| if (wxCouponCVo == null) | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| record.setCoverImg(wxCouponCVo.getCoverImg()); | |||||
| record.setSubType(wxCouponCVo.getTargetAd()); | |||||
| } | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| record.setCreateDate(new Date()); | record.setCreateDate(new Date()); | ||||
| @@ -5,17 +5,17 @@ | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | ||||
| <result column="type" jdbcType="INTEGER" property="type"/> | <result column="type" jdbcType="INTEGER" property="type"/> | ||||
| <result column="sub_type" jdbcType="INTEGER" property="subType"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | ||||
| <result column="target_id" jdbcType="BIGINT" property="targetId"/> | <result column="target_id" jdbcType="BIGINT" property="targetId"/> | ||||
| <result column="qrcode" jdbcType="BLOB" property="qrcode"/> | <result column="qrcode" jdbcType="BLOB" property="qrcode"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`, `tenant_id`, `type`, `status`, `create_date`, `update_date`, `cover_img`, `target_id`, `qrcode` | |||||
| `id`, `tenant_id`, `type`, `sub_type`, `status`, `create_date`, `update_date`, `cover_img`, `target_id`, `qrcode` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -33,6 +33,10 @@ | |||||
| and `type` = #{type} | and `type` = #{type} | ||||
| </if> | </if> | ||||
| <if test=" null != subType "> | |||||
| and `sub_type` = #{subType} | |||||
| </if> | |||||
| <if test=" null != status "> | <if test=" null != status "> | ||||
| and `status` = #{status} | and `status` = #{status} | ||||
| </if> | </if> | ||||