diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 87dca425a..37b2e84f5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -482,7 +482,8 @@ public class WxCouponController extends BaseController { result.put("list", pageInfo); return new ResultData(result); } - + + @TenantIgnore @ApiOperation("卡营销列表记录导出") @GetMapping("/cardCountExportData") @SystemControllerLog(description = "营销统计-卡营销数据导出") @@ -554,7 +555,8 @@ public class WxCouponController extends BaseController { } return new ResultData(pageInfo); } - + + @TenantIgnore @ApiOperation("券营销列表记录导出") @GetMapping("/couponCountExportData") @SystemControllerLog(description = "营销统计-券营销数据导出") @@ -595,20 +597,11 @@ public class WxCouponController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); wxCoupon.updateTenantInfo(tenantEntity); + + handleCouponStartDate(wxCoupon); + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); - //根据上架时间查询券 - WxCouponChannel couponChannelQ = new WxCouponChannel(); - couponChannelQ.updateTenantInfo(tenantEntity); - couponChannelQ.setStartdate(wxCoupon.getStartdate()); - couponChannelQ.setEnddate(wxCoupon.getEnddate()); - List couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); - if (null != couponIds && couponIds.size() > 0 ) { - wxCoupon.setIds(couponIds); - }else { - wxCoupon.setId(-1L); - } - PageInfo pages = wxCouponService.findPressData(wxCoupon,tenantEntitys,pageNum,pageSize); return new ResultData(pages); } @@ -621,10 +614,28 @@ public class WxCouponController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); wxCoupon.updateTenantInfo(tenantEntity); + + handleCouponStartDate(wxCoupon); + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); + wxCouponService.exportPressData(wxCoupon,tenantEntitys, request, response); } + //根据投放时间搜索 + private void handleCouponStartDate(WxCoupon wxCoupon){ + WxCouponChannel couponChannelQ = new WxCouponChannel(); + couponChannelQ.updateTenantInfo(wxCoupon); + couponChannelQ.setStartdate(wxCoupon.getStartdate()); + couponChannelQ.setEnddate(wxCoupon.getEnddate()); + List couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); + if (null != couponIds && couponIds.size() > 0 ) { + wxCoupon.setIds(couponIds); + }else { + wxCoupon.setId(-1L); + } + } + @GetMapping("exportCouponPassword") @SystemControllerLog(description = "卡券兑换码-导出数据") public void exportCouponPassword(@ModelAttribute WxCouponPassword wxCouponPassword, HttpServletRequest request, HttpServletResponse response) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java index 561d1db5b..19d8483de 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java @@ -54,17 +54,9 @@ public class WxOrderGroupController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); wxOrderGroupMarketing.updateTenantInfo(tenantEntity); - - WxCouponChannel couponChannelQ = new WxCouponChannel(); - couponChannelQ.updateTenantInfo(tenantEntity); - couponChannelQ.setStartdate(wxOrderGroupMarketing.getStartdate()); - couponChannelQ.setEnddate(wxOrderGroupMarketing.getEnddate()); - List couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); - if (null != couponIds && couponIds.size() > 0 ) { - wxOrderGroupMarketing.setCouponIdList(couponIds); - }else { - wxOrderGroupMarketing.setCouponId("-1"); - } + + handleCouponStartDate(wxOrderGroupMarketing); + final PageInfo page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing,tenantEntitys, pageNum, pageSize); return new ResultData(page); } @@ -79,7 +71,24 @@ public class WxOrderGroupController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); wxOrderGroupMarketing.updateTenantInfo(tenantEntity); + + handleCouponStartDate(wxOrderGroupMarketing); + wxOrderGroupService.exportOrderGroupMarketingList(wxOrderGroupMarketing,tenantEntitys, request, response); } + //处理投放时间 + private void handleCouponStartDate(WxOrderGroupMarketing wxOrderGroupMarketing){ + WxCouponChannel couponChannelQ = new WxCouponChannel(); + couponChannelQ.updateTenantInfo(wxOrderGroupMarketing); + couponChannelQ.setStartdate(wxOrderGroupMarketing.getStartdate()); + couponChannelQ.setEnddate(wxOrderGroupMarketing.getEnddate()); + List couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); + if (null != couponIds && couponIds.size() > 0 ) { + wxOrderGroupMarketing.setCouponIdList(couponIds); + }else { + wxOrderGroupMarketing.setCouponId("-1"); + } + } + } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 6583cff1d..73331befd 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -187,7 +187,7 @@ public class WxCouponController extends BaseController { } sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()); //如果配置显示已售数量 - SysConfig config = sysConfigService.getByKey(SysConfigConstant.coupon_detail_show_selled, channelPriceAndStock); + SysConfig config = sysConfigService.getByKey(SysConfigConstant.coupon_detail_show_selled, getTenantInfo()); if (null != config && config.getConfigItemValue().equals("1")) { sb.append(",\"selledCount\":").append(coupon.getInventory()-coupon.getRemainInventory()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java index 1744c8b41..a1100fc7a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java @@ -31,18 +31,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { @Override public PageInfo listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { - if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) { - WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); - wxCouponChannelQ.updateTenantInfo(record); - wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate()); - wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate()); - List ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ); - if (null == ccIds || ccIds.size() <= 0 ) { - record.setId(-999L); - }else { - record.setCouponIdList(ccIds); - } - } + handleCouponOnlineEndDate(record); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findVoList(record)); } @@ -69,9 +58,26 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { } @Override - public void exportData(WxCardVo wxCardVo, HttpServletRequest request, HttpServletResponse response) { - List list = wxCardInfoMapper.findVoList(wxCardVo); + public void exportData(WxCardVo record, HttpServletRequest request, HttpServletResponse response) { + handleCouponOnlineEndDate(record); + List list = wxCardInfoMapper.findVoList(record); excelService.exportExcel(list, null, "卡订单", WxCardVo.class, "卡订单.xlsx", response, false); } + + private void handleCouponOnlineEndDate(WxCardVo record){ + if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) { + WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); + wxCouponChannelQ.updateTenantInfo(record); + wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate()); + wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate()); + List ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ); + if (null == ccIds || ccIds.size() <= 0 ) { + record.setId(-999L); + }else { + record.setCouponIdList(ccIds); + } + } + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java index b4f1653f1..66794bf33 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java @@ -386,29 +386,34 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { @Override public PageInfo listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize) { - if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) { - WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); - wxCouponChannelQ.updateTenantInfo(record); - wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate()); - wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate()); - List ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ); - if (null == ccIds || ccIds.size() <= 0 ) { - record.setId(-999L); - }else { - WxCardInfo cardInfo = new WxCardInfo(); - cardInfo.updateTenantInfo(record); - cardInfo.setCouponIdList(ccIds); - List cardIdList = wxCardInfoMapper.findIdList(cardInfo); - if (null == cardIdList || cardIdList.size() <= 0 ) { - record.setId(-999L); - }else { - record.setCardIdList(ccIds); - } - } - } + handleCouponOnlineStartDate(record); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record)); } + //处理券投放时间 + private void handleCouponOnlineStartDate(WxCardSpendVo record){ + if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) { + WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); + wxCouponChannelQ.updateTenantInfo(record); + wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate()); + wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate()); + List ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ); + if (null == ccIds || ccIds.size() <= 0 ) { + record.setId(-999L); + }else { + WxCardInfo cardInfo = new WxCardInfo(); + cardInfo.updateTenantInfo(record); + cardInfo.setCouponIdList(ccIds); + List cardIdList = wxCardInfoMapper.findIdList(cardInfo); + if (null == cardIdList || cardIdList.size() <= 0 ) { + record.setId(-999L); + }else { + record.setCardIdList(ccIds); + } + } + } + } + @Override public List> sumCardSpendForMerchant(WxCardSpendVo record) { return wxCardSpendMapper.sumCardSpendVoForMerchant(record); @@ -651,8 +656,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } @Override - public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { - List list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); + public void exportData(WxCardSpendVo record, HttpServletRequest request, HttpServletResponse response) { + handleCouponOnlineStartDate(record); + List list = wxCardSpendMapper.findCardSpendVoList(record); excelService.exportExcel(list, null, "卡消费记录", WxCardSpendVo.class, "卡消费记录.xlsx", response, false); } diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index a3d02fd51..142feb551 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -1129,8 +1129,11 @@ and c.title like concat('%', #{wxCoupon.title},'%') - - and c.`create_date` between #{wxCoupon.startdate} and #{wxCoupon.enddate} + + and c.id in + + #{idItem} + order by ${wxCoupon.sortColumns}