| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import com.iformall.domain.po.WxFloatingLayer; | |||
| import com.iformall.domain.vo.WxFloatingLayerVO; | |||
| import com.iformall.enums.EnumFloatingLayerStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxFloatingLayerService; | |||
| @@ -41,7 +42,7 @@ public class WxFloatingLayerController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxFloatingLayerController::list"); | |||
| wxFloatingLayer.setTenantId(getTenantId()); | |||
| wxFloatingLayer.setSortColumns(BaseEntity.SortField.CreateTime_DESC, BaseEntity.SortField.Id_DESC); | |||
| final PageInfo<WxFloatingLayer> page = wxFloatingLayerService.listAsPage(wxFloatingLayer, pageNum, pageSize); | |||
| final PageInfo<WxFloatingLayerVO> page = wxFloatingLayerService.listAsPage(wxFloatingLayer, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -514,6 +514,11 @@ public enum ErrorCode{ | |||
| */ | |||
| POWER_BILL_CONFIGU_NOT_FOUND(50001, "未配置电费账单生成规则"), | |||
| /** | |||
| * 首页浮屠广告 | |||
| */ | |||
| FLOATING_LAYER_FOUND(60001, "首页广告已存在,请先下线再重新投放"), | |||
| ; | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxFloatingLayerVO extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverImg") | |||
| private String coverImg; | |||
| @io.swagger.annotations.ApiModelProperty(value = "产品ID", name = "produceId") | |||
| private Long produceId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "小程序跳转路径", name = "pagePath") | |||
| private String pagePath; | |||
| @io.swagger.annotations.ApiModelProperty(value = "0上线 1下线", name = "status") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "名称", name = "title") | |||
| private String title; | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxFloatingLayer; | |||
| import com.iformall.domain.vo.WxFloatingLayerVO; | |||
| import java.util.List; | |||
| @@ -12,4 +13,8 @@ public interface WxFloatingLayerMapper extends CommonMapper<WxFloatingLayer, Lon | |||
| List<WxFloatingLayer> findList(WxFloatingLayer wxFloatingLayer); | |||
| List<WxFloatingLayerVO> findListVO(WxFloatingLayer wxFloatingLayer); | |||
| void updateStatus(Long couponId); | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxFloatingLayer; | |||
| import com.iformall.domain.vo.WxFloatingLayerVO; | |||
| /** | |||
| * @author gongbiao | |||
| @@ -17,7 +18,7 @@ public interface WxFloatingLayerService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxFloatingLayer> listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxFloatingLayerVO> listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -13,10 +13,7 @@ import com.iformall.domain.vo.WxCouponChannelAddVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxCardInfoMapper; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.mapper.WxCouponMerchantMapper; | |||
| import com.iformall.mapper.WxMerchantMapper; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -46,6 +43,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| QrCodeService qrCodeService; | |||
| @Autowired | |||
| WxCardInfoMapper wxCardInfoMapper; | |||
| @Autowired | |||
| WxFloatingLayerMapper wxFloatingLayerMapper; | |||
| /** | |||
| * B端业务端 | |||
| @@ -105,7 +104,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| wxOrderService.updateOrderGroupStatusByCouponChannelId(record.getId(), record.getTenantId(), EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); | |||
| //修改卡状态 | |||
| wxCardInfoMapper.updateTransferStatusByCouponId(orignal.getCouponId()); | |||
| //浮层下架 | |||
| wxFloatingLayerMapper.updateStatus(orignal.getCouponId()); | |||
| } | |||
| } | |||
| record.setUpdateDate(new Date()); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| @@ -7,6 +8,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxFloatingLayer; | |||
| import com.iformall.domain.vo.WxFloatingLayerVO; | |||
| import com.iformall.mapper.WxFloatingLayerMapper; | |||
| import com.iformall.service.WxFloatingLayerService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -30,8 +32,8 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { | |||
| WxFloatingLayerMapper wxFloatingLayerMapper; | |||
| @Override | |||
| public PageInfo<WxFloatingLayer> listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFloatingLayerMapper.findList(record)); | |||
| public PageInfo<WxFloatingLayerVO> listAsPage(WxFloatingLayer record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFloatingLayerMapper.findListVO(record)); | |||
| } | |||
| @Override | |||
| @@ -48,6 +50,13 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { | |||
| if (StringUtils.isEmpty(wxFloatingLayer.getPagePath())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "小程序跳转路径不能为空"); | |||
| } | |||
| WxFloatingLayer wxFloatingLayerQuery = new WxFloatingLayer(); | |||
| wxFloatingLayerQuery.setTenantId(wxFloatingLayer.getTenantId()); | |||
| wxFloatingLayerQuery.setStatus(wxFloatingLayer.getStatus()); | |||
| Integer integer = wxFloatingLayerMapper.selectCount(new QueryWrapper<>(wxFloatingLayerQuery)); | |||
| if (integer > 0) { | |||
| return new ResultData(ErrorCode.FLOATING_LAYER_FOUND); | |||
| } | |||
| Date date = new Date(); | |||
| if (wxFloatingLayer.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -41,11 +41,64 @@ | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <sql id="allColumnsVO"> | |||
| fl.`id` as id, fl.`tenant_id` , fl.`cover_img` , fl.`produce_id`, | |||
| fl.`page_path` , fl.`status`, fl.`create_time` as create_time, fl.`update_time`, | |||
| c.title | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxFloatingLayer" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_floating_layer | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <resultMap id="resultListVO" type="com.iformall.domain.vo.WxFloatingLayerVO"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="produce_id" jdbcType="VARCHAR" property="produceId"/> | |||
| <result column="page_path" jdbcType="VARCHAR" property="pagePath"/> | |||
| <result column="status" jdbcType="VARCHAR" property="status"/> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| </resultMap> | |||
| <sql id="dynamicWhereConditionsVO"> | |||
| <if test=" null != id "> | |||
| and fl.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and fl.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and fl.`status` = #{status} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and fl.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findListVO" parameterType="com.iformall.domain.po.WxFloatingLayer" resultMap="resultListVO"> | |||
| select | |||
| <include refid="allColumnsVO"/> | |||
| from wx_floating_layer fl left join wx_coupon c on fl.produce_id=c.id | |||
| where c.status = 0 | |||
| <include refid="dynamicWhereConditionsVO"/> | |||
| </select> | |||
| <update id="updateStatus"> | |||
| update wx_floating_layer set status=1 where produce_id=#{value} | |||
| </update> | |||
| </mapper> | |||