| @@ -84,7 +84,7 @@ public class WxScreenAdController extends BaseController { | |||||
| Object target = null; | Object target = null; | ||||
| if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) | 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())) | if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) | ||||
| target = wxCampaignService.getById(wxScreenAd.getTargetId()); | target = wxCampaignService.getById(wxScreenAd.getTargetId()); | ||||
| @@ -82,7 +82,7 @@ public class WxDeviceScreenAdController extends BaseController { | |||||
| page.getList().stream().forEach(s->{ | page.getList().stream().forEach(s->{ | ||||
| Object target = null; | Object target = null; | ||||
| if (s.getType().equals(EnumScreenAdType.COUPON.getCode())) | 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())) | else if (s.getType().equals(EnumScreenAdType.CAMPAIGN.getCode())) | ||||
| target = wxCampaignService.getById(s.getTargetId()); | target = wxCampaignService.getById(s.getTargetId()); | ||||
| else if (s.getType().equals(EnumScreenAdType.MERCHANT.getCode())) | else if (s.getType().equals(EnumScreenAdType.MERCHANT.getCode())) | ||||
| @@ -19,13 +19,9 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| int countCouponChannel(WxCouponChannel wxCouponChannel); | 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); | void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | ||||
| @@ -50,5 +46,5 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| * @param wxCouponChannel | * @param wxCouponChannel | ||||
| * @return | * @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); | WxCoupon findSimpleDetail(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findSimpleDetailList(WxCoupon wxCoupon); | List<WxCoupon> findSimpleDetailList(WxCoupon wxCoupon); | ||||
| WxCoupon findCouponCVoDetail(WxCoupon wxCoupon); | |||||
| List<Long> findIdList(WxCoupon wxCoupon); | List<Long> findIdList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findCouponList(WxCoupon wxCoupon); | List<WxCoupon> findCouponList(WxCoupon wxCoupon); | ||||
| @@ -56,8 +56,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||||
| WxMerchant getMerchantByEncode(@Param("encode")String encode); | WxMerchant getMerchantByEncode(@Param("encode")String encode); | ||||
| List<WxMerchant> findFollowList(WxMerchant record); | |||||
| int recordedAmount(WxMerchant record); | int recordedAmount(WxMerchant record); | ||||
| List<Map<String, Object>> findMerchantByShop(@Param("shopId")Long shopId); | List<Map<String, Object>> findMerchantByShop(@Param("shopId")Long shopId); | ||||
| @@ -21,39 +21,13 @@ public interface WxCouponChannelService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | 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); | WxCouponCVo findVoStatusDetail(Long id,String tenantId); | ||||
| /** | |||||
| * 根据实体查询Vo分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| // List<WxCouponChannelVo> listVo(WxCouponChannel record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| @@ -166,12 +166,6 @@ public interface WxMerchantService { | |||||
| List<Long> getMerchantShopIds(Long merchantId); | List<Long> getMerchantShopIds(Long merchantId); | ||||
| void followMerchant(TenantEntity tenantEntity, Long memberId, Long id); | |||||
| void cancelFollow(Long memberId, Long id); | |||||
| int getfollow(Long memberId, Long id); | |||||
| PageInfo<WxMerchant> followListAsPage(WxMerchant record, Integer pageNum, Integer pageSize); | |||||
| ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo); | ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo); | ||||
| ResultData downmark(WxMerchant wxMerchant); | ResultData downmark(WxMerchant wxMerchant); | ||||
| @@ -315,7 +315,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| wxCouponChannelQ.setCouponId(couponId); | wxCouponChannelQ.setCouponId(couponId); | ||||
| wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | ||||
| List<WxCouponChannelVo> voList = wxCouponChannelMapper.newfindCList(wxCouponChannelQ); | |||||
| List<WxCouponChannel> voList = wxCouponChannelMapper.newfindCList(wxCouponChannelQ); | |||||
| // 不存在的, 新增 | // 不存在的, 新增 | ||||
| wxCouponChannel = new WxCouponChannel(); | wxCouponChannel = new WxCouponChannel(); | ||||
| if(voList != null && voList.size() > 0){ | if(voList != null && voList.size() > 0){ | ||||
| @@ -23,6 +23,7 @@ import com.iformall.utils.JsonUtil; | |||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| import com.iformall.utils.RedisUtils; | import com.iformall.utils.RedisUtils; | ||||
| import org.apache.commons.beanutils.BeanUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | 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.data.redis.core.ValueOperations; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.lang.reflect.InvocationTargetException; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | import java.util.concurrent.TimeUnit; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -83,6 +85,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponChannel> findList(WxCouponChannel record){ | |||||
| return wxCouponChannelMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponChannel getById(Long id,String tenantId) { | public WxCouponChannel getById(Long id,String tenantId) { | ||||
| return wxCouponChannelMapper.selectById(id,tenantId); | return wxCouponChannelMapper.selectById(id,tenantId); | ||||
| @@ -343,15 +350,29 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponChannel.setCouponIds(cids); | 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()){ | if(list == null || list.isEmpty()){ | ||||
| return; | |||||
| return null; | |||||
| } | } | ||||
| List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | ||||
| Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,tenantEntity); | 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)){ | if(wxCouponChannel.getId() != null && wxCouponChannel.getId().equals(-999L)){ | ||||
| return new ArrayList<>(); | 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)){ | if(record.getId() != null && record.getId().equals(-999L)){ | ||||
| return new PageInfo<WxCouponChannelVo>(); | 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) { | private boolean isCouponMerchantValid(Long couponId,String tenantId) { | ||||
| @@ -485,60 +510,69 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return vo; | 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 | @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 | @Override | ||||
| public WxCouponCVo findVoStatusDetail(Long id,String tenantId) { | 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)); | |||||
| // } | |||||
| } | } | ||||
| @@ -1077,43 +1077,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return wxMerchantShopMapper.findShopIds(merchantIds); | return wxMerchantShopMapper.findShopIds(merchantIds); | ||||
| } | } | ||||
| @Override | |||||
| public void followMerchant(TenantEntity tenantEntity, Long memberId, Long id) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| TtUserFollow userFollow = new TtUserFollow(); | |||||
| userFollow.setId(idWorker.nextId()); | |||||
| userFollow.updateTenantInfo(tenantEntity); | |||||
| userFollow.setUserId(memberId); | |||||
| userFollow.setMerchernId(id); | |||||
| userFollow.setCreateDate(new Date()); | |||||
| userFollow.setUpdateDate(new Date()); | |||||
| try { | |||||
| ttUserFollowMapper.insert(userFollow); | |||||
| } catch (Exception e) { | |||||
| // e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void cancelFollow(Long memberId, Long id) { | |||||
| TtUserFollow userFollow = new TtUserFollow(); | |||||
| userFollow.setUserId(memberId); | |||||
| userFollow.setMerchernId(id); | |||||
| int delete = ttUserFollowMapper.delete(new QueryWrapper<>(userFollow)); | |||||
| } | |||||
| @Override | |||||
| public int getfollow(Long memberId, Long id) { | |||||
| TtUserFollow userFollow = new TtUserFollow(); | |||||
| userFollow.setUserId(memberId); | |||||
| userFollow.setMerchernId(id); | |||||
| return ttUserFollowMapper.selectCount(new QueryWrapper<>(userFollow)); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<WxMerchant> followListAsPage(WxMerchant record, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findFollowList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo) { | public ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo) { | ||||
| @@ -2695,7 +2695,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| wxCouponCVo = operations.get(key); | wxCouponCVo = operations.get(key); | ||||
| } else { | } else { | ||||
| // 游戏没有入缓存,需要从数据库中读取 | // 游戏没有入缓存,需要从数据库中读取 | ||||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId()); | |||||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId(),false); | |||||
| if (wxCouponCVo != null) { | if (wxCouponCVo != null) { | ||||
| // 游戏优化,进缓存 | // 游戏优化,进缓存 | ||||
| cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); | 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.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxScreenAdMapper; | import com.iformall.mapper.WxScreenAdMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxCouponChannelService; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxScreenAdService; | import com.iformall.service.WxScreenAdService; | ||||
| import com.iformall.service.wechat.FmOpenService; | import com.iformall.service.wechat.FmOpenService; | ||||
| @@ -25,6 +26,7 @@ import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -40,8 +42,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Lazy | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | |||||
| WxCouponChannelService wxCouponChannelService; | |||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @@ -68,7 +71,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) { | if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) { | ||||
| if (record.getTargetId() == null) | if (record.getTargetId() == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | 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) | if (wxCouponCVo == null) | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| record.setCoverImg(wxCouponCVo.getCoverImg()); | record.setCoverImg(wxCouponCVo.getCoverImg()); | ||||
| @@ -142,7 +145,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| wxCouponChannel.updateTenantInfo(tenantEntity); | wxCouponChannel.updateTenantInfo(tenantEntity); | ||||
| wxCouponChannel.setCouponId(couponId); | wxCouponChannel.setCouponId(couponId); | ||||
| List<WxCouponChannel> list = wxCouponChannelMapper.findList(wxCouponChannel); | |||||
| List<WxCouponChannel> list = wxCouponChannelService.findList(wxCouponChannel); | |||||
| list.stream().forEach(cc->{ | list.stream().forEach(cc->{ | ||||
| WxScreenAd wxScreenAd = new WxScreenAd(); | WxScreenAd wxScreenAd = new WxScreenAd(); | ||||
| @@ -160,229 +160,18 @@ | |||||
| </if> | </if> | ||||
| </update> | </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> | </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 | 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} | where cc.id = #{id} and cc.tenant_id = #{tenantId} | ||||
| </select> | </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 id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer"> | ||||
| select count(distinct coupon_id) from wx_coupon_channel cc | select count(distinct coupon_id) from wx_coupon_channel cc | ||||
| @@ -427,7 +216,7 @@ | |||||
| </update> | </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`, | 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.`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 | 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} | from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId} | ||||
| </select> | </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 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, | 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 | c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type | ||||
| @@ -215,29 +215,6 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findFollowList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| form tt_user_follow uf | |||||
| left join wx_merchant m on uf.merchern_id = m.id | |||||
| where uf.is_del = 0 and uf.user_id = ${cUserId} | |||||
| and m.is_del = 0 | |||||
| <if test=" null != status "> | |||||
| and m.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != isPublic "> | |||||
| and m.`is_public` = #{isPublic} | |||||
| </if> | |||||
| <if test=" null != name and ''!=name "> | |||||
| and m.`name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != businessTypes "> | |||||
| and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes})) | |||||
| </if> | |||||
| order by uf.create_date desc | |||||
| </select> | |||||
| <select id="findListVo" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | <select id="findListVo" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumnsVo"/> | <include refid="allColumnsVo"/> | ||||
| @@ -75,89 +75,4 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(wxMerchant); | return new ResultData(wxMerchant); | ||||
| } | } | ||||
| @ApiOperation("是否关注") | |||||
| @GetMapping("/isfollow") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData isfollow(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::isfollow"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| int count = wxMerchantService.getfollow(memberId,id); | |||||
| if(count > 0){ | |||||
| return new ResultData(true); | |||||
| }else{ | |||||
| return new ResultData(false); | |||||
| } | |||||
| } | |||||
| @ApiOperation("关注") | |||||
| @GetMapping("/followMerchant") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData followMerchant(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::followMerchant"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| WxMerchant byId = wxMerchantService.getById(id); | |||||
| if(byId == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到数据"); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| wxMerchantService.followMerchant(byId,memberId,byId.getId()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("分页关注列表接口") | |||||
| @GetMapping("collectList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData followList(@ModelAttribute WxMerchant record, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::followList"); | |||||
| if (record == null) record = new WxMerchant(); | |||||
| record.updateTenantInfo(getParentTenantInfo()); | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| record.setCUserId(memberId); | |||||
| record.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| record.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); | |||||
| return new ResultData(wxMerchantService.followListAsPage(record, pageNum, pageSize)); | |||||
| } | |||||
| @ApiOperation("取消关注") | |||||
| @GetMapping("/cancelFollow") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData cancelFollow(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] TtCouponController::cancelFollow"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| wxMerchantService.cancelFollow(memberId,id); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||