From c1ad51a9842dbbcf1530e08315d494f3725c5c19 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 29 Jul 2019 14:03:59 +0800 Subject: [PATCH] =?UTF-8?q?[C=E7=AB=AF=E9=A6=96=E9=A1=B5][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9][=E6=8D=A2=E4=B8=80=E6=8D=A2=E6=8B=BC=E5=9B=A2?= =?UTF-8?q?=E5=92=8C=E7=A0=8D=E4=BB=B7]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponChannelController.java | 23 ++++++++----------- .../impl/WxCouponChannelServiceImpl.java | 8 ++++++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 115b93a70..0150bfadb 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -1,29 +1,29 @@ package com.iformall.controller; import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; +import com.iformall.common.ResultData; import com.iformall.domain.po.BaseEntity; +import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponChannelStatus; import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumCouponStatus; +import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxMerchantService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.commons.collections.map.HashedMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import com.iformall.common.ResultData; - -import com.iformall.domain.po.WxCouponChannel; -import com.iformall.service.WxCouponChannelService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.Map; @@ -103,9 +103,6 @@ public class WxCouponChannelController extends BaseController { public ResultData change(@ModelAttribute WxCouponChannel wxCouponChannel) { if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); wxCouponChannel.setTenantId(getTenantId()); - if (wxCouponChannel.getCouponId() == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId不能为空"); - } wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 94b1b5dc8..ef40cce7a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -142,8 +142,14 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Override public WxCouponChannelVo change(WxCouponChannel record) { + Long couponId = 0L; + if (record.getCouponId() != null) { + couponId = record.getCouponId(); + record.setCouponId(null); + } + Long finalCouponId = couponId; return wxCouponChannelMapper.findVoList(record).parallelStream() - .filter(wxCouponChannelVo -> !wxCouponChannelVo.getCouponId().equals(record.getCouponId())) + .filter(wxCouponChannelVo -> !wxCouponChannelVo.getCouponId().equals(finalCouponId)) .findAny().orElse(null); }