Просмотр исходного кода

//coupon

release_toaliyun_real
xhxu 3 лет назад
Родитель
Сommit
944b822fd4
3 измененных файлов: 119 добавлений и 119 удалений
  1. +48
    -48
      mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java
  2. +3
    -3
      mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java
  3. +68
    -68
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java

+ 48
- 48
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")


+ 3
- 3
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;



+ 68
- 68
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<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo));
List<TtCouponVo> couponList = pageInfo.getList();
if(!couponList.isEmpty()){
List<Long> 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<WxCouponChannel> channellist = wxCouponChannelMapper.findList(wxCouponChannel);
Map<Long, List<WxCouponChannel>> channelGroupCoupon = new HashMap<>();
if(!channellist.isEmpty()){
channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId));
}
//预审状态
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode());
List<WxCouponChannel> planchannellist = wxCouponChannelMapper.findList(wxCouponChannel);
Map<Long, List<WxCouponChannel>> planChannelGroupCoupon = new HashMap<>();
if(!planchannellist.isEmpty()){
planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId));
}
for (TtCouponVo temp : couponList) {
List<Integer> channels = new ArrayList<>();
List<WxCouponChannel> 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<Integer> planChannels = new ArrayList<>();
List<WxCouponChannel> 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<TtCouponChannelVo> ttCouponChannelVoPageInfo = wxCouponChannelService.ttChannelList(ttChannelVo, pageNum, pageSize);
return new ResultData(ttCouponChannelVoPageInfo);
}
// @Override
// public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) {
// PageInfo<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo));
// List<TtCouponVo> couponList = pageInfo.getList();
//
// if(!couponList.isEmpty()){
// List<Long> 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<WxCouponChannel> channellist = wxCouponChannelMapper.findList(wxCouponChannel);
// Map<Long, List<WxCouponChannel>> channelGroupCoupon = new HashMap<>();
// if(!channellist.isEmpty()){
// channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId));
// }
//
// //预审状态
// wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode());
// List<WxCouponChannel> planchannellist = wxCouponChannelMapper.findList(wxCouponChannel);
// Map<Long, List<WxCouponChannel>> planChannelGroupCoupon = new HashMap<>();
// if(!planchannellist.isEmpty()){
// planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId));
// }
//
// for (TtCouponVo temp : couponList) {
// List<Integer> channels = new ArrayList<>();
// List<WxCouponChannel> 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<Integer> planChannels = new ArrayList<>();
// List<WxCouponChannel> 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<TtCouponChannelVo> 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());


Загрузка…
Отмена
Сохранить