| @@ -131,7 +131,6 @@ public class WxCouponOrderController extends BaseController { | |||
| } | |||
| @RedisCache | |||
| @ApiOperation("某日期交易总流水") | |||
| @GetMapping("getUnverifiedAmountOnDate") | |||
| @ApiImplicitParams({ | |||
| @@ -140,7 +139,6 @@ public class WxCouponOrderController extends BaseController { | |||
| return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, false); | |||
| } | |||
| @RedisCache | |||
| @ApiOperation("某日期核销总流水") | |||
| @GetMapping("getVerifiedAmountOnDate") | |||
| @ApiImplicitParams({ | |||
| @@ -64,12 +64,21 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||
| // if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||
| // | |||
| // }else{ | |||
| // wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | |||
| // } | |||
| wxCouponChannel.setSortColumn(null); | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| }else{ | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | |||
| if(EnumCouponChannelType.COUPON_CHANNEL_ID_CARD.getCode().equals(wxCouponChannel.getTargetAd()) | |||
| || EnumCouponChannelType.COUPON_CHANNEL_ID_CREDIT.getCode().equals(wxCouponChannel.getTargetAd())){ | |||
| PageInfo<WxCouponChannelVo> page = wxCouponChannelService.newListPageVo(wxCouponChannel, pageNum, pageSize); | |||
| filterTimed(wxCouponChannel, page); | |||
| return new ResultData(page); | |||
| } | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage() | |||
| + wxCouponChannel.getTenantId() + "_" | |||
| @@ -2,6 +2,7 @@ package com.iformall.schedule; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxMerchantProductVo; | |||
| import com.iformall.enums.EnumDateAmtType; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.mapper.*; | |||
| @@ -41,22 +42,38 @@ public class DaliyAmountSchedule { | |||
| @Autowired | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @Autowired | |||
| WxCouponMerchantMapper wxCouponMerchantMapper; | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void daliyAmountMerchant(Date startDate,Date endDate,Calendar cal,WxMerchant merchant){ | |||
| Map dateMap = new HashMap(); | |||
| dateMap.put("startDate", startDate); | |||
| dateMap.put("endDate", endDate); | |||
| dateMap.put("merchantId", merchant.getId()); | |||
| dateMap.put("tenantId", merchant.getTenantId()); | |||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||
| merchantBUserQ.updateTenantInfo(merchant); | |||
| merchantBUserQ.setMerchantId(merchant.getId()); | |||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||
| dateMap.put("bUserIds", bUserIds); | |||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||
| Map orderdateMap = new HashMap(); | |||
| orderdateMap.put("startDateTimes", startDate.getTime()); | |||
| orderdateMap.put("endDateTimes", endDate.getTime()); | |||
| orderdateMap.put("merchantId", merchant.getId()); | |||
| orderdateMap.put("tenantId", merchant.getTenantId()); | |||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||
| merchantIdList.add(merchant.getId()); | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(merchant.getTenantId(), merchantIdList); | |||
| boolean hasCoupons = true; | |||
| if (null != merchantProductVos && merchantProductVos.size() > 0 ){ | |||
| List<Long> couponIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < merchantProductVos.size(); i ++) { | |||
| WxMerchantProductVo mp = merchantProductVos.get(i); | |||
| if (!couponIds.contains(mp.getProductId())) { | |||
| couponIds.add(mp.getProductId()); | |||
| } | |||
| } | |||
| if (couponIds.size() > 0 ) { | |||
| orderdateMap.put("couponIds", couponIds); | |||
| }else { | |||
| return; | |||
| } | |||
| } | |||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(orderdateMap); | |||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | |||
| int total_price = list.stream().mapToInt(p -> p.getCouponPrice()).sum(); | |||
| @@ -77,6 +94,16 @@ public class DaliyAmountSchedule { | |||
| wxDateAmountRecordService.saveAmount(dateAmountRecord); | |||
| Map dateMap = new HashMap(); | |||
| dateMap.put("startDate", startDate); | |||
| dateMap.put("endDate", endDate); | |||
| dateMap.put("merchantId", merchant.getId()); | |||
| dateMap.put("tenantId", merchant.getTenantId()); | |||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||
| merchantBUserQ.updateTenantInfo(merchant); | |||
| merchantBUserQ.setMerchantId(merchant.getId()); | |||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||
| dateMap.put("bUserIdList", bUserIds); | |||
| list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | |||
| if (null != list && list.size() > 0) { | |||
| logger.info("\nfind " + list.size() + " coupon order from " + startDate + " to " + endDate); | |||
| @@ -19,8 +19,8 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L | |||
| List<WxMerchantVo> findMerchantNameList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | |||
| List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | |||
| List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | |||
| List<WxMerchantProductVo> findOnlyMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | |||
| List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList,@Param("status")Integer status); | |||
| List<Long> findOneMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantId")Long merchantId); | |||
| List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); | |||
| List<Long> findMerchantByProductId(@Param("tenantId")String tenantId,@Param("productId")Long productId); | |||
| List<Long> findOnlyMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); | |||
| } | |||
| @@ -259,7 +259,7 @@ public interface WxCouponService { | |||
| * 获取券商户map | |||
| * | |||
| */ | |||
| Map<Long,String> getCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity); | |||
| Map<Long,String> getCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity,boolean onlyOneMerchantCoupons); | |||
| Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | |||
| } | |||
| @@ -306,6 +306,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| if(wxCouponChannel.getSourceType() != null){ | |||
| couponQ.setSourceType(wxCouponChannel.getSourceType()); | |||
| } | |||
| if(wxCouponChannel.getSupportTransfer() != null){ | |||
| couponQ.setSupportTransfer(wxCouponChannel.getSupportTransfer()); | |||
| } | |||
| List<Long> cids = wxCouponMapper.findIdList(couponQ); | |||
| return cids; | |||
| } | |||
| @@ -317,7 +320,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return; | |||
| } | |||
| if(wxCouponChannel.getMerchantId() != null){ | |||
| List<Long> mcids = wxCouponMerchantMapper.findOneMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantId()); | |||
| List<Long> merchantIds = new ArrayList<Long>(); | |||
| merchantIds.add(wxCouponChannel.getMerchantId()); | |||
| List<Long> mcids = wxCouponMerchantMapper.findMerchantProductIds(wxCouponChannel.getTenantId(), merchantIds,0); | |||
| if(mcids == null || mcids.isEmpty()){ | |||
| wxCouponChannel.setId(-999L); | |||
| return; | |||
| @@ -284,29 +284,32 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| merchantBUserQ.updateTenantInfo(wxMerchant); | |||
| merchantBUserQ.setMerchantId(wxMerchant.getId()); | |||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||
| dateMap.put("bUserIds", bUserIds); | |||
| dateMap.put("bUserIdList", bUserIds); | |||
| list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | |||
| }else { | |||
| dateMap.put("startDateTimes", startDate.getTime()); | |||
| dateMap.put("endDateTimes", endDate.getTime()); | |||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||
| merchantIdList.add(wxMerchant.getId()); | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(wxMerchant.getTenantId(), merchantIdList); | |||
| if (null != merchantProductVos) { | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(wxMerchant.getTenantId(), merchantIdList); | |||
| if (null != merchantProductVos && merchantProductVos.size() > 0 ){ | |||
| List<Long> couponIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < merchantProductVos.size(); i ++) { | |||
| WxMerchantProductVo mp = merchantProductVos.get(i); | |||
| if (mp.getMc() == 1) { | |||
| if (!couponIds.contains(mp.getProductId())) { | |||
| couponIds.add(mp.getProductId()); | |||
| } | |||
| } | |||
| if (!couponIds.contains(mp.getProductId())) { | |||
| couponIds.add(mp.getProductId()); | |||
| } | |||
| } | |||
| if (couponIds.size() > 0 ) { | |||
| dateMap.put("couponIds", couponIds); | |||
| list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||
| }else { | |||
| list = new ArrayList<WxCouponOrder>(); | |||
| } | |||
| }else { | |||
| list = new ArrayList<WxCouponOrder>(); | |||
| } | |||
| list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||
| } | |||
| //logger.info("find " + list.size() + " coupon order from " + /startDate + " to " + new Date()); | |||
| resultMap.put("amount", list.stream().mapToInt(p -> p.getCouponPrice()).sum()); | |||
| @@ -331,7 +334,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| merchantBUserQ.updateTenantInfo(tenantEntity); | |||
| merchantBUserQ.setMerchantId(merchantId); | |||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||
| dateMap.put("bUserIds", bUserIds); | |||
| dateMap.put("bUserIdList", bUserIds); | |||
| PageInfo<WxCouponOrder> couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap)); | |||
| PageInfo<WxCouponOrderBVo> pageInfo = new PageInfo<WxCouponOrderBVo>(); | |||
| @@ -350,29 +353,35 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| dateMap.put("endDateTimes", endDate.getTime()); | |||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||
| merchantIdList.add(merchantId); | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIdList); | |||
| if (null != merchantProductVos) { | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(tenantEntity.getTenantId(), merchantIdList); | |||
| PageInfo<WxCouponOrder> couponOrderPage = null; | |||
| if (null != merchantProductVos && merchantProductVos.size() > 0 ) { | |||
| List<Long> couponIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < merchantProductVos.size(); i ++) { | |||
| WxMerchantProductVo mp = merchantProductVos.get(i); | |||
| if (mp.getMc() == 1) { | |||
| if (!couponIds.contains(mp.getProductId())) { | |||
| couponIds.add(mp.getProductId()); | |||
| } | |||
| } | |||
| if (!couponIds.contains(mp.getProductId())) { | |||
| couponIds.add(mp.getProductId()); | |||
| } | |||
| } | |||
| if (couponIds.size() > 0 ) { | |||
| dateMap.put("couponIds", couponIds); | |||
| couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap)); | |||
| } | |||
| } | |||
| PageInfo<WxCouponOrder> couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap)); | |||
| PageInfo<WxCouponOrderBVo> pageInfo = new PageInfo<WxCouponOrderBVo>(); | |||
| pageInfo.setList(handleToCouponOrderBVoList(tenantEntity,couponOrderPage.getList(),false,false)); | |||
| pageInfo.setPageNum(couponOrderPage.getPageNum()); | |||
| pageInfo.setPageSize(couponOrderPage.getPageSize()); | |||
| pageInfo.setPages(couponOrderPage.getPages()); | |||
| pageInfo.setTotal(couponOrderPage.getTotal()); | |||
| if (null != couponOrderPage) { | |||
| pageInfo.setList(handleToCouponOrderBVoList(tenantEntity,couponOrderPage.getList(),false,false)); | |||
| pageInfo.setPageNum(couponOrderPage.getPageNum()); | |||
| pageInfo.setPageSize(couponOrderPage.getPageSize()); | |||
| pageInfo.setPages(couponOrderPage.getPages()); | |||
| pageInfo.setTotal(couponOrderPage.getTotal()); | |||
| }else { | |||
| pageInfo.setList(null); | |||
| pageInfo.setPageNum(pageIndex); | |||
| pageInfo.setPageSize(pageSize); | |||
| pageInfo.setPages(0); | |||
| pageInfo.setTotal(0); | |||
| } | |||
| return pageInfo; | |||
| } | |||
| @@ -129,7 +129,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| pageInfo.setPageSize(sendPageInfo.getPageSize()); | |||
| pageInfo.setPages(sendPageInfo.getPages()); | |||
| pageInfo.setTotal(sendPageInfo.getTotal()); | |||
| pageInfo.setList(couponSendToVoList(record,sendPageInfo.getList(),true,false)); | |||
| pageInfo.setList(couponSendToVoList(record,sendPageInfo.getList(),true,false,false)); | |||
| } else { | |||
| record.setStatus(EnumCouponSendStatus.VALID.getCode()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| @@ -139,7 +139,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| pageInfo.setPageSize(sendPageInfo.getPageSize()); | |||
| pageInfo.setPages(sendPageInfo.getPages()); | |||
| pageInfo.setTotal(sendPageInfo.getTotal()); | |||
| pageInfo.setList(couponSendToVoList(record,sendPageInfo.getList(),false,true)); | |||
| pageInfo.setList(couponSendToVoList(record,sendPageInfo.getList(),false,true,false)); | |||
| } | |||
| return pageInfo; | |||
| } | |||
| @@ -147,10 +147,10 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| @Override | |||
| public List<WxCouponSendVo> findListVo(WxCouponSend record) { | |||
| List<WxCouponSend> couponSendList = wxCouponSendMapper.findList(record); | |||
| return couponSendToVoList(record,couponSendList,false,false); | |||
| return couponSendToVoList(record,couponSendList,false,false,false); | |||
| } | |||
| private List<WxCouponSendVo> couponSendToVoList(TenantEntity tenantEntity,List<WxCouponSend> couponSendList,boolean setInventoryAndExpired,boolean setMerchantNameAndSendCount) { | |||
| private List<WxCouponSendVo> couponSendToVoList(TenantEntity tenantEntity,List<WxCouponSend> couponSendList,boolean setInventoryAndExpired,boolean setMerchantNameAndSendCount,boolean onlyOneMerchantCoupons) { | |||
| if (null != couponSendList) { | |||
| List<Long> couponIdList = new ArrayList<>(); | |||
| List<Long> mallUserInfoIdList = new ArrayList<Long>(); | |||
| @@ -199,7 +199,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| //couponMerchant | |||
| Map<Long, String> couponMerchantMap = null; | |||
| if (setMerchantNameAndSendCount) { | |||
| couponMerchantMap = wxCouponService.getCouponMerchantMap(couponIdList,tenantEntity); | |||
| couponMerchantMap = wxCouponService.getCouponMerchantMap(couponIdList,tenantEntity,onlyOneMerchantCoupons); | |||
| } | |||
| List<WxCouponSendVo> retList = new ArrayList<WxCouponSendVo>(); | |||
| for (int i = 0 ; i <couponSendList.size() ; i++) { | |||
| @@ -962,11 +962,18 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public Map<Long, String> getCouponMerchantMap(List<Long> couponIds, TenantEntity tenantEntity) { | |||
| public Map<Long, String> getCouponMerchantMap(List<Long> couponIds, TenantEntity tenantEntity,boolean onlyOneMerchantCoupons) { | |||
| Map<Long,String> couponMerchantMap = new HashMap<Long,String>(); | |||
| if(null != couponIds && couponIds.size() > 0){ | |||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(),couponIds); | |||
| List<Long> merchantIds = null; | |||
| if (onlyOneMerchantCoupons) { | |||
| merchantIds = wxCouponMerchantMapper.findOnlyMerchantByProductIds(tenantEntity.getTenantId(),couponIds); | |||
| }else { | |||
| merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(),couponIds); | |||
| } | |||
| if (null == merchantIds || merchantIds.size() <= 0) { | |||
| return couponMerchantMap; | |||
| } | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(tenantEntity); | |||
| merchantQ.setIds(merchantIds); | |||
| @@ -979,8 +986,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIds); | |||
| if (null != merchantProductVos) { | |||
| List<WxMerchantProductVo> merchantProductVos = null; | |||
| if (onlyOneMerchantCoupons) { | |||
| merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(tenantEntity.getTenantId(), merchantIds); | |||
| }else { | |||
| merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIds); | |||
| } | |||
| if (null != merchantProductVos && merchantProductVos.size() > 0 ) { | |||
| for (int i = 0 ; i < merchantProductVos.size(); i ++) { | |||
| WxMerchantProductVo mp = merchantProductVos.get(i); | |||
| if(couponIds.contains(mp.getProductId())){ | |||
| @@ -186,26 +186,48 @@ | |||
| </if> | |||
| </select> | |||
| <select id = "findOneMerchantProductIds" parameterType="java.util.Map" resultType="Long"> | |||
| SELECT wcm.product_id | |||
| <select id = "findMerchantByProductIds" parameterType="java.util.Map" resultType="Long"> | |||
| SELECT distinct wcm.merchant_id | |||
| FROM wx_coupon_merchant wcm | |||
| WHERE wcm.STATUS = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcm.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId"> | |||
| and wcm.merchant_id = #{merchantId} | |||
| <if test=" null != productIds"> | |||
| and wcm.product_id in | |||
| <foreach collection="productIds" index="index" item="productIdItem" open="(" separator="," close=")"> | |||
| #{productIdItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id = "findMerchantByProductIds" parameterType="java.util.Map" resultType="Long"> | |||
| <select id = "findOnlyMerchantProduct" parameterType="java.util.Map" resultMap="MerchantProductVoResultMap"> | |||
| SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc | |||
| FROM wx_coupon_merchant wcm | |||
| WHERE wcm.STATUS = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcm.`tenant_id` = #{tenantId} | |||
| </if> | |||
| GROUP BY product_id | |||
| HAVING mc = 1 | |||
| <if test=" null != merchantIdList"> | |||
| and wcm.merchant_id in | |||
| <foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")"> | |||
| #{merchantIdItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id = "findOnlyMerchantByProductIds" parameterType="java.util.Map" resultType="Long"> | |||
| SELECT distinct wcm.merchant_id | |||
| FROM wx_coupon_merchant wcm | |||
| WHERE wcm.STATUS = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcm.`tenant_id` = #{tenantId} | |||
| </if> | |||
| GROUP BY product_id | |||
| HAVING COUNT(merchant_id) = 1 | |||
| <if test=" null != productIds"> | |||
| and wcm.product_id in | |||
| <foreach collection="productIds" index="index" item="productIdItem" open="(" separator="," close=")"> | |||
| @@ -213,17 +235,5 @@ | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id = "findMerchantByProductId" parameterType="java.util.Map" resultType="Long"> | |||
| SELECT merchant_id | |||
| FROM wx_coupon_merchant | |||
| WHERE STATUS = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != productId"> | |||
| and product_id = #{productId} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -160,9 +160,9 @@ | |||
| from wx_coupon_order co | |||
| where co.tenant_id = #{tenantId} | |||
| AND co.coupon_order_status = '1' | |||
| <if test=" null != bUserIds "> | |||
| <if test=" null != bUserIdList "> | |||
| and co.b_user_id in | |||
| <foreach collection="bUserIds" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||
| <foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||
| #{bUserIdItem} | |||
| </foreach> | |||
| </if> | |||