| @@ -84,7 +84,7 @@ public class WxScreenAdController extends BaseController { | |||
| Object target = null; | |||
| if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) | |||
| target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId(),wxScreenAd.getTenantId()); | |||
| target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId(),wxScreenAd.getTenantId(),true); | |||
| if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) | |||
| target = wxCampaignService.getById(wxScreenAd.getTargetId()); | |||
| @@ -82,7 +82,7 @@ public class WxDeviceScreenAdController extends BaseController { | |||
| page.getList().stream().forEach(s->{ | |||
| Object target = null; | |||
| if (s.getType().equals(EnumScreenAdType.COUPON.getCode())) | |||
| target = wxCouponChannelService.findDetailVo(s.getTargetId(),wxScreenAd.getTenantId()); | |||
| target = wxCouponChannelService.findDetailVo(s.getTargetId(),wxScreenAd.getTenantId(),true); | |||
| else if (s.getType().equals(EnumScreenAdType.CAMPAIGN.getCode())) | |||
| target = wxCampaignService.getById(s.getTargetId()); | |||
| else if (s.getType().equals(EnumScreenAdType.MERCHANT.getCode())) | |||
| @@ -19,13 +19,9 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| int countCouponChannel(WxCouponChannel wxCouponChannel); | |||
| // List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel); | |||
| WxCouponChannel findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| // List<WxCouponChannelVo> findVoListByMerchant(WxCouponChannel wxCouponChannel); | |||
| WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| WxCouponChannel findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | |||
| @@ -50,5 +46,5 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| * @param wxCouponChannel | |||
| * @return | |||
| */ | |||
| List<WxCouponChannelVo> newfindCList(WxCouponChannel wxCouponChannel); | |||
| List<WxCouponChannel> newfindCList(WxCouponChannel wxCouponChannel); | |||
| } | |||
| @@ -21,6 +21,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| WxCoupon findSimpleDetail(WxCoupon wxCoupon); | |||
| List<WxCoupon> findSimpleDetailList(WxCoupon wxCoupon); | |||
| WxCoupon findCouponCVoDetail(WxCoupon wxCoupon); | |||
| List<Long> findIdList(WxCoupon wxCoupon); | |||
| List<WxCoupon> findCouponList(WxCoupon wxCoupon); | |||
| @@ -21,39 +21,13 @@ public interface WxCouponChannelService { | |||
| * @return | |||
| */ | |||
| PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | |||
| List<WxCouponChannel> findList(WxCouponChannel record); | |||
| /** | |||
| * 根据实体查询Vo分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| // PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 查询商户的券信息 | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| // PageInfo<WxCouponChannelVo> listByMerchant(WxCouponChannel record, Integer pageIndex, Integer pageSize); | |||
| WxCouponCVo findDetailVo(Long id,String tenantId); | |||
| WxCouponCVo findDetailVo(Long id,String tenantId,boolean hasMerchant); | |||
| WxCouponCVo findVoStatusDetail(Long id,String tenantId); | |||
| /** | |||
| * 根据实体查询Vo分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| // List<WxCouponChannelVo> listVo(WxCouponChannel record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| @@ -315,7 +315,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| wxCouponChannelQ.setCouponId(couponId); | |||
| wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | |||
| List<WxCouponChannelVo> voList = wxCouponChannelMapper.newfindCList(wxCouponChannelQ); | |||
| List<WxCouponChannel> voList = wxCouponChannelMapper.newfindCList(wxCouponChannelQ); | |||
| // 不存在的, 新增 | |||
| wxCouponChannel = new WxCouponChannel(); | |||
| if(voList != null && voList.size() > 0){ | |||
| @@ -23,6 +23,7 @@ import com.iformall.utils.JsonUtil; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.RedisUtils; | |||
| import org.apache.commons.beanutils.BeanUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -32,6 +33,7 @@ import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.data.redis.core.ValueOperations; | |||
| import org.springframework.stereotype.Service; | |||
| import java.lang.reflect.InvocationTargetException; | |||
| import java.util.*; | |||
| import java.util.concurrent.TimeUnit; | |||
| import java.util.stream.Collectors; | |||
| @@ -83,6 +85,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxCouponChannel> findList(WxCouponChannel record){ | |||
| return wxCouponChannelMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxCouponChannel getById(Long id,String tenantId) { | |||
| return wxCouponChannelMapper.selectById(id,tenantId); | |||
| @@ -343,15 +350,29 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| wxCouponChannel.setCouponIds(cids); | |||
| } | |||
| private void handleWxCouponChannelVo(List<WxCouponChannelVo> list, TenantEntity tenantEntity){ | |||
| private List<WxCouponChannelVo> handleWxCouponChannelVo(List<WxCouponChannel> list, TenantEntity tenantEntity){ | |||
| if(list == null || list.isEmpty()){ | |||
| return; | |||
| return null; | |||
| } | |||
| List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | |||
| Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,tenantEntity); | |||
| for (WxCouponChannelVo cc:list) { | |||
| cc.setWxCoupon(couponMap.get(cc.getCouponId())); | |||
| List<WxCouponChannelVo> retList = new ArrayList<>(); | |||
| for (WxCouponChannel cc:list) { | |||
| try { | |||
| WxCouponChannelVo vo = new WxCouponChannelVo(); | |||
| BeanUtils.copyProperties(vo, cc); | |||
| vo.setWxCoupon(couponMap.get(cc.getCouponId())); | |||
| retList.add(vo); | |||
| } catch (IllegalAccessException e) { | |||
| logger.error("handleWxCouponChannelVo error.",e); | |||
| } catch (InvocationTargetException e) { | |||
| logger.error("handleWxCouponChannelVo error.",e); | |||
| } | |||
| } | |||
| if (retList.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| return retList; | |||
| } | |||
| @@ -361,9 +382,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| if(wxCouponChannel.getId() != null && wxCouponChannel.getId().equals(-999L)){ | |||
| return new ArrayList<>(); | |||
| } | |||
| List<WxCouponChannelVo> list = wxCouponChannelMapper.newfindCList(wxCouponChannel); | |||
| handleWxCouponChannelVo(list,wxCouponChannel); | |||
| return list; | |||
| List<WxCouponChannel> list = wxCouponChannelMapper.newfindCList(wxCouponChannel); | |||
| return handleWxCouponChannelVo(list,wxCouponChannel); | |||
| } | |||
| /** | |||
| @@ -380,9 +400,14 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| if(record.getId() != null && record.getId().equals(-999L)){ | |||
| return new PageInfo<WxCouponChannelVo>(); | |||
| } | |||
| PageInfo<WxCouponChannelVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.newfindCList(record)); | |||
| handleWxCouponChannelVo(pageInfo.getList(),record); | |||
| return pageInfo; | |||
| PageInfo<WxCouponChannel> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.newfindCList(record)); | |||
| PageInfo<WxCouponChannelVo> retPageInfo = new PageInfo<WxCouponChannelVo>(); | |||
| retPageInfo.setPageNum(pageInfo.getPageNum()); | |||
| retPageInfo.setPageSize(pageInfo.getPageSize()); | |||
| retPageInfo.setPages(pageInfo.getPages()); | |||
| retPageInfo.setTotal(pageInfo.getTotal()); | |||
| retPageInfo.setList(handleWxCouponChannelVo(pageInfo.getList(),record)); | |||
| return retPageInfo; | |||
| } | |||
| private boolean isCouponMerchantValid(Long couponId,String tenantId) { | |||
| @@ -485,60 +510,69 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return vo; | |||
| } | |||
| /** | |||
| * C端api使用,关联查找的券时已生效 | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| // @Override | |||
| // public PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize) { | |||
| // PageInfo<WxCouponChannelVo> pageInfo; | |||
| // //仅c端首页走缓存 | |||
| // if((EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode().equals(record.getTargetAd()) | |||
| // || EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(record.getTargetAd())) | |||
| // && new Integer(6).equals(pageSize) | |||
| // && pageIndex.intValue() <=5 | |||
| // && record.getBusiness() == null) { | |||
| // | |||
| // logger.info("listPageCVo.chache"); | |||
| // String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage() +record.getTenantId()+"_" + pageIndex + ":"; | |||
| // ValueOperations<String, PageInfo<WxCouponChannelVo>> operations = cdRedisTemplate.opsForValue(); | |||
| // boolean hasKey = cdRedisTemplate.hasKey(key); | |||
| // if (hasKey) { | |||
| // pageInfo = operations.get(key); | |||
| // logger.info("listPageCVo.chache.get:{}", pageInfo.getList()==null?0:pageInfo.getList().size()); | |||
| // }else{ | |||
| // pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoList(record)); | |||
| // //插入缓存 | |||
| // operations.set(key, pageInfo, 600, TimeUnit.SECONDS); | |||
| // } | |||
| // return pageInfo; | |||
| // } | |||
| // | |||
| // return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoList(record)); | |||
| // } | |||
| @Override | |||
| public WxCouponCVo findDetailVo(Long id,String tenantId) { | |||
| return wxCouponChannelMapper.findVoDetail(id,tenantId); | |||
| public WxCouponCVo findDetailVo(Long id,String tenantId,boolean hasMerchant) { | |||
| WxCouponChannel cc = wxCouponChannelMapper.findVoDetail(id,tenantId); | |||
| return couponChannelToCouponCVo(cc,hasMerchant); | |||
| } | |||
| private WxCouponCVo couponChannelToCouponCVo(WxCouponChannel cc,boolean hasMerchant) { | |||
| if (null == cc) { | |||
| return null; | |||
| } | |||
| try { | |||
| WxCoupon couponQ = new WxCoupon(); | |||
| couponQ.updateTenantInfo(cc); | |||
| couponQ.setId(cc.getCouponId()); | |||
| WxCoupon coupon = wxCouponMapper.findCouponCVoDetail(couponQ); | |||
| if (null == coupon) { | |||
| return null; | |||
| } | |||
| WxCouponCVo cvo = new WxCouponCVo(); | |||
| BeanUtils.copyProperties(cvo, coupon); | |||
| cvo.setId(cc.getId()); | |||
| cvo.setCouponId(cc.getCouponId()); | |||
| cvo.setTargetAd(cc.getTargetAd()); | |||
| cvo.setBeginTime(cc.getBeginTime()); | |||
| cvo.setEndTime(cc.getEndTime()); | |||
| cvo.updateTenantInfo(cc); | |||
| cvo.setQrCode(cc.getQrCode()); | |||
| cvo.setTtQrCode(cc.getTtQrCode()); | |||
| if (hasMerchant) { | |||
| cvo.setMerchantVoList(wxCouponMerchantMapper.findMerchantVoList(cc.getCouponId(), cc.getTenantId())); | |||
| } | |||
| return cvo; | |||
| } catch (IllegalAccessException e) { | |||
| logger.error("couponChannelToCouponCVo error.",e); | |||
| } catch (InvocationTargetException e) { | |||
| logger.error("couponChannelToCouponCVo error.",e); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public WxCouponCVo findVoStatusDetail(Long id,String tenantId) { | |||
| return wxCouponChannelMapper.findVoStatusDetail(id,tenantId); | |||
| WxCouponChannel cc = wxCouponChannelMapper.findVoStatusDetail(id,tenantId); | |||
| if (null == cc) { | |||
| return null; | |||
| } | |||
| WxCoupon couponQ = new WxCoupon(); | |||
| couponQ.updateTenantInfo(cc); | |||
| couponQ.setId(cc.getCouponId()); | |||
| WxCoupon coupon = wxCouponMapper.findCouponCVoDetail(couponQ); | |||
| if (null == coupon) { | |||
| return null; | |||
| } | |||
| WxCouponCVo cvo = new WxCouponCVo(); | |||
| cvo.setId(cc.getId()); | |||
| cvo.setCouponId(cc.getCouponId()); | |||
| cvo.setRemainInventory(coupon.getRemainInventory()); | |||
| cvo.setStatus(coupon.getStatus()); | |||
| return cvo; | |||
| } | |||
| // @Override | |||
| // public List<WxCouponChannelVo> listVo(WxCouponChannel record) { | |||
| // return wxCouponChannelMapper.findVoList(record); | |||
| // } | |||
| // @Override | |||
| // public PageInfo<WxCouponChannelVo> listByMerchant(WxCouponChannel record, Integer pageNum, Integer pageSize) { | |||
| // return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoListByMerchant(record)); | |||
| // } | |||
| } | |||
| @@ -2695,7 +2695,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| wxCouponCVo = operations.get(key); | |||
| } else { | |||
| // 游戏没有入缓存,需要从数据库中读取 | |||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId()); | |||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId(),false); | |||
| if (wxCouponCVo != null) { | |||
| // 游戏优化,进缓存 | |||
| cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); | |||
| @@ -17,6 +17,7 @@ import com.iformall.mapper.WxCampaignMapper; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.mapper.WxScreenAdMapper; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxScreenAdService; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| @@ -25,6 +26,7 @@ import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| @@ -40,8 +42,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @Lazy | |||
| @Autowired | |||
| WxCouponChannelMapper wxCouponChannelMapper; | |||
| WxCouponChannelService wxCouponChannelService; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @@ -68,7 +71,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) { | |||
| if (record.getTargetId() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId(),record.getTenantId()); | |||
| WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(record.getTargetId(),record.getTenantId(),false); | |||
| if (wxCouponCVo == null) | |||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| record.setCoverImg(wxCouponCVo.getCoverImg()); | |||
| @@ -142,7 +145,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| wxCouponChannel.updateTenantInfo(tenantEntity); | |||
| wxCouponChannel.setCouponId(couponId); | |||
| List<WxCouponChannel> list = wxCouponChannelMapper.findList(wxCouponChannel); | |||
| List<WxCouponChannel> list = wxCouponChannelService.findList(wxCouponChannel); | |||
| list.stream().forEach(cc->{ | |||
| WxScreenAd wxScreenAd = new WxScreenAd(); | |||
| @@ -160,229 +160,18 @@ | |||
| </if> | |||
| </update> | |||
| <sql id="CouponChannelVoColumns"> | |||
| <include refid="allColumns" />, | |||
| c.remain_inventory,c.inventory,c.cover_img,c.sub_title,c.sale_price,c.detail, | |||
| c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.use_limit_rule,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,c.conditions, | |||
| c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,c.valid_days,c.credit_price,c.content_type,c.source_type | |||
| </sql> | |||
| <resultMap id="CouponChannelVoMap" type="com.iformall.domain.vo.WxCouponChannelVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="business" jdbcType="VARCHAR" property="business" /> | |||
| <result column="show_begin_time" jdbcType="TIMESTAMP" property="showBeginTime" /> | |||
| <result column="sub_business" jdbcType="INTEGER" property="subBusiness" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" /> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="tail_price" jdbcType="INTEGER" property="tailPrice"/> | |||
| <result column="orig_price" jdbcType="INTEGER" property="origPrice"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="pick_start_date" jdbcType="TIMESTAMP" property="pickStartDate"/> | |||
| <result column="pick_end_date" jdbcType="TIMESTAMP" property="pickEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/> | |||
| <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||
| <result column="content_type" jdbcType="INTEGER" property="contentType"/> | |||
| <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | |||
| </resultMap> | |||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | |||
| select <include refid="CouponChannelVoColumns" /> | |||
| from wx_coupon_channel cc | |||
| left join wx_coupon c on cc.coupon_id = c.id | |||
| left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0 | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findVoListByMerchant" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | |||
| select <include refid="CouponChannelVoColumns" /> | |||
| from wx_coupon_channel cc | |||
| join wx_coupon_merchant cm | |||
| on cm.product_id = cc.coupon_id | |||
| and cm.status = 0 | |||
| <if test="merchantId != null"> | |||
| and cm.merchant_id=#{merchantId} | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and cm.merchant_id in | |||
| <foreach collection="merchantIds" index="index" item="item" open="(" separator="," close=")"> | |||
| #{item} | |||
| </foreach> | |||
| </if> | |||
| left join wx_coupon c on cc.coupon_id = c.id | |||
| left join wx_merchant mer on cm.merchant_id = mer.id | |||
| where cc.`target_ad` in (1,2,5,6,7) | |||
| <if test="status != null"> | |||
| and cc.status=#{status} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cc.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cc.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != showBeginTime "> | |||
| and cc.`show_begin_time` <= #{showBeginTime} | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <select id="findVoDetail" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time,cc.tenant_id,cc.parent_tenant_id,cc.qr_code,cc.tt_qr_code | |||
| from wx_coupon_channel cc where cc.id = #{id} and cc.tenant_id = #{tenantId} | |||
| </select> | |||
| <sql id="WxCouponCVoColumn"> | |||
| cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time, | |||
| c.tenant_id,c.parent_tenant_id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.sale_price,c.use_price, | |||
| c.use_limit_rule,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date, | |||
| c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status, | |||
| c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions,c.content_type, | |||
| cc.qr_code,cc.tt_qr_code | |||
| </sql> | |||
| <sql id="CVoStatusColumn"> | |||
| cc.id,cc.coupon_id,c.remain_inventory,c.status | |||
| </sql> | |||
| <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="pick_start_date" jdbcType="TIMESTAMP" property="pickStartDate"/> | |||
| <result column="pick_end_date" jdbcType="TIMESTAMP" property="pickEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="tail_price" jdbcType="INTEGER" property="tailPrice"/> | |||
| <result column="orig_price" jdbcType="INTEGER" property="origPrice"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="subBusiness" jdbcType="INTEGER" property="subBusiness"/> | |||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||
| <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/> | |||
| <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||
| <result column="content_type" jdbcType="INTEGER" property="contentType"/> | |||
| <collection column="{productId=coupon_id,tenantId=tenant_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| javaType="java.util.List" | |||
| select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" > | |||
| </collection> | |||
| </resultMap> | |||
| <resultMap id="WxCouponCVoMapL" type="com.iformall.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="subBusiness" jdbcType="INTEGER" property="subBusiness"/> | |||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||
| <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/> | |||
| <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||
| <result column="content_type" jdbcType="INTEGER" property="contentType"/> | |||
| </resultMap> | |||
| <select id="findVoDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMap"> | |||
| select | |||
| <include refid="WxCouponCVoColumn"/> | |||
| <select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select cc.id,cc.coupon_id | |||
| from wx_coupon_channel cc | |||
| left join wx_coupon c on cc.coupon_id = c.id | |||
| where cc.id = #{id} and cc.tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMapL"> | |||
| select | |||
| <include refid="CVoStatusColumn"/> | |||
| from wx_coupon c, wx_coupon_channel cc | |||
| where cc.coupon_id = c.id and cc.id = #{id} and cc.tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer"> | |||
| select count(distinct coupon_id) from wx_coupon_channel cc | |||
| @@ -427,7 +216,7 @@ | |||
| </update> | |||
| <select id="newfindCList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | |||
| <select id="newfindCList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap"> | |||
| select cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`, | |||
| cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`, | |||
| cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code | |||
| @@ -346,6 +346,16 @@ | |||
| from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCouponCVoDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select c.id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.sale_price,c.use_price, | |||
| c.use_limit_rule,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date, | |||
| c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status, | |||
| c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions,c.content_type | |||
| from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findSimpleDetailList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select c.id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date, | |||
| c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type | |||