From 944b822fd4c6a3ec4ca65deede83590bd868f5d5 Mon Sep 17 00:00:00 2001 From: xhxu Date: Sun, 4 Dec 2022 17:08:08 +0800 Subject: [PATCH] //coupon --- .../market/TtCouponGoodsController.java | 96 ++++++------- .../service/TtCouponGoodsService.java | 6 +- .../impl/TtCouponGoodsServiceImpl.java | 136 +++++++++--------- 3 files changed, 119 insertions(+), 119 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java index 60a03d46f..cabdd4b35 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java @@ -42,54 +42,54 @@ public class TtCouponGoodsController extends BaseController { @Autowired private TtGoodsCategoryService ttGoodsCategoryService; - @ApiOperation("分页列表接口") - @GetMapping("couponList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - @SystemControllerLog(description = "-列表") - public ResultData couponList(@ModelAttribute TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxCouponController::couponList"); - if (ttCouponVo == null) ttCouponVo = new TtCouponVo(); - ttCouponVo.updateTenantInfo(getTenantInfo()); - ttCouponVo.setType(EnumCouponType.COUPON_DOUYIN.getCode()); - if(StringUtils.isNotBlank(ttCouponVo.getSortColumn())){ - String coryColumn = "c."+ttCouponVo.getSortColumns(); - ttCouponVo.setSortColumns(coryColumn); - ttCouponVo.setSortColumn(null); - }else{ - ttCouponVo.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC); - } - if (ttCouponVo.getStatus() != null && ttCouponVo.getStatus() == -1) - ttCouponVo.setStatus(null); - return ttCouponGoodsService.couponList(ttCouponVo, pageNum, pageSize); - } - - @ApiOperation("分页列表接口") - @GetMapping("channelList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - @SystemControllerLog(description = "-列表") - public ResultData channelList(@ModelAttribute TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxCouponController::channelList"); - if (ttChannelVo == null) ttChannelVo = new TtCouponChannelVo(); - ttChannelVo.updateTenantInfo(getTenantInfo()); - ttChannelVo.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); - if(null == ttChannelVo.getSourceType()){ - ttChannelVo.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); - } - - if(StringUtils.isNotBlank(ttChannelVo.getSortColumn())){ - String coryColumn = "cc."+ttChannelVo.getSortColumns(); - ttChannelVo.setSortColumns(coryColumn); - ttChannelVo.setSortColumn(null); - }else{ - ttChannelVo.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC); - } - - return ttCouponGoodsService.channelList(ttChannelVo, pageNum, pageSize); - } +// @ApiOperation("分页列表接口") +// @GetMapping("couponList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) +// @SystemControllerLog(description = "-列表") +// public ResultData couponList(@ModelAttribute TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { +// logger.debug("[" + getIpAddr() + "] WxCouponController::couponList"); +// if (ttCouponVo == null) ttCouponVo = new TtCouponVo(); +// ttCouponVo.updateTenantInfo(getTenantInfo()); +// ttCouponVo.setType(EnumCouponType.COUPON_DOUYIN.getCode()); +// if(StringUtils.isNotBlank(ttCouponVo.getSortColumn())){ +// String coryColumn = "c."+ttCouponVo.getSortColumns(); +// ttCouponVo.setSortColumns(coryColumn); +// ttCouponVo.setSortColumn(null); +// }else{ +// ttCouponVo.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC); +// } +// if (ttCouponVo.getStatus() != null && ttCouponVo.getStatus() == -1) +// ttCouponVo.setStatus(null); +// return ttCouponGoodsService.couponList(ttCouponVo, pageNum, pageSize); +// } +// +// @ApiOperation("分页列表接口") +// @GetMapping("channelList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) +// @SystemControllerLog(description = "-列表") +// public ResultData channelList(@ModelAttribute TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { +// logger.debug("[" + getIpAddr() + "] WxCouponController::channelList"); +// if (ttChannelVo == null) ttChannelVo = new TtCouponChannelVo(); +// ttChannelVo.updateTenantInfo(getTenantInfo()); +// ttChannelVo.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); +// if(null == ttChannelVo.getSourceType()){ +// ttChannelVo.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); +// } +// +// if(StringUtils.isNotBlank(ttChannelVo.getSortColumn())){ +// String coryColumn = "cc."+ttChannelVo.getSortColumns(); +// ttChannelVo.setSortColumns(coryColumn); +// ttChannelVo.setSortColumn(null); +// }else{ +// ttChannelVo.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC); +// } +// +// return ttCouponGoodsService.channelList(ttChannelVo, pageNum, pageSize); +// } @ApiOperation("根据类目获取商品模板") @GetMapping("getTemplate") diff --git a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java index 6ce3b6e50..0dc717045 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java @@ -14,9 +14,9 @@ import java.util.List; public interface TtCouponGoodsService { - ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize); - - ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); +// ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize); +// +// ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); ResultData productSave(WxCoupon coupon) throws Exception; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index 3c16897fe..08c349941 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -91,72 +91,72 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { @Autowired WxMerchantService wxMerchantService; - @Override - public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { - PageInfo pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); - List couponList = pageInfo.getList(); - - if(!couponList.isEmpty()){ - List ids = couponList.stream().map(p -> p.getId()).collect(toList()); - WxCouponChannel wxCouponChannel = new WxCouponChannel(); - wxCouponChannel.updateTenantInfo(ttCouponVo); - wxCouponChannel.setCouponIds(ids); - //上架状态 - wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - List channellist = wxCouponChannelMapper.findList(wxCouponChannel); - Map> channelGroupCoupon = new HashMap<>(); - if(!channellist.isEmpty()){ - channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); - } - - //预审状态 - wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); - List planchannellist = wxCouponChannelMapper.findList(wxCouponChannel); - Map> planChannelGroupCoupon = new HashMap<>(); - if(!planchannellist.isEmpty()){ - planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); - } - - for (TtCouponVo temp : couponList) { - List channels = new ArrayList<>(); - List couponChannels = channelGroupCoupon.get(temp.getId()); - if(couponChannels != null && !couponChannels.isEmpty()){ - for (WxCouponChannel tempchannel : couponChannels) { - if (!channels.contains(tempchannel.getTargetAd())) { - channels.add(tempchannel.getTargetAd()); - } - } - } - if(!channels.isEmpty()){ - temp.setChannels(JSON.toJSONString(channels)); - }else{ - temp.setChannels(""); - } - - List planChannels = new ArrayList<>(); - List planCouponChannels = planChannelGroupCoupon.get(temp.getId()); - if(planCouponChannels != null && !planCouponChannels.isEmpty()){ - for (WxCouponChannel tempchannel : planCouponChannels) { - if (!planChannels.contains(tempchannel.getTargetAd())) { - planChannels.add(tempchannel.getTargetAd()); - } - } - } - if(!planChannels.isEmpty()){ - temp.setPlanChannels(JSON.toJSONString(planChannels)); - }else{ - temp.setPlanChannels(""); - } - } - } - return new ResultData(pageInfo); - } - - @Override - public ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { - PageInfo ttCouponChannelVoPageInfo = wxCouponChannelService.ttChannelList(ttChannelVo, pageNum, pageSize); - return new ResultData(ttCouponChannelVoPageInfo); - } +// @Override +// public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { +// PageInfo pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); +// List couponList = pageInfo.getList(); +// +// if(!couponList.isEmpty()){ +// List ids = couponList.stream().map(p -> p.getId()).collect(toList()); +// WxCouponChannel wxCouponChannel = new WxCouponChannel(); +// wxCouponChannel.updateTenantInfo(ttCouponVo); +// wxCouponChannel.setCouponIds(ids); +// //上架状态 +// wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); +// List channellist = wxCouponChannelMapper.findList(wxCouponChannel); +// Map> channelGroupCoupon = new HashMap<>(); +// if(!channellist.isEmpty()){ +// channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); +// } +// +// //预审状态 +// wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); +// List planchannellist = wxCouponChannelMapper.findList(wxCouponChannel); +// Map> planChannelGroupCoupon = new HashMap<>(); +// if(!planchannellist.isEmpty()){ +// planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); +// } +// +// for (TtCouponVo temp : couponList) { +// List channels = new ArrayList<>(); +// List couponChannels = channelGroupCoupon.get(temp.getId()); +// if(couponChannels != null && !couponChannels.isEmpty()){ +// for (WxCouponChannel tempchannel : couponChannels) { +// if (!channels.contains(tempchannel.getTargetAd())) { +// channels.add(tempchannel.getTargetAd()); +// } +// } +// } +// if(!channels.isEmpty()){ +// temp.setChannels(JSON.toJSONString(channels)); +// }else{ +// temp.setChannels(""); +// } +// +// List planChannels = new ArrayList<>(); +// List planCouponChannels = planChannelGroupCoupon.get(temp.getId()); +// if(planCouponChannels != null && !planCouponChannels.isEmpty()){ +// for (WxCouponChannel tempchannel : planCouponChannels) { +// if (!planChannels.contains(tempchannel.getTargetAd())) { +// planChannels.add(tempchannel.getTargetAd()); +// } +// } +// } +// if(!planChannels.isEmpty()){ +// temp.setPlanChannels(JSON.toJSONString(planChannels)); +// }else{ +// temp.setPlanChannels(""); +// } +// } +// } +// return new ResultData(pageInfo); +// } +// +// @Override +// public ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { +// PageInfo ttCouponChannelVoPageInfo = wxCouponChannelService.ttChannelList(ttChannelVo, pageNum, pageSize); +// return new ResultData(ttCouponChannelVoPageInfo); +// } @Override @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @@ -685,7 +685,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { if(wxCoupon == null){ return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); } - if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ + if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); @@ -737,7 +737,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { if(wxCoupon == null){ return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); } - if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ + if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId());