|
|
|
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
@@ -138,7 +139,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public WxCouponChannelVo change(WxCouponChannel record) { |
|
|
|
public ResultData change(WxCouponChannel record) { |
|
|
|
Long couponId = 0L; |
|
|
|
if (record.getCouponId() != null) { |
|
|
|
couponId = record.getCouponId(); |
|
|
|
@@ -146,10 +147,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
} |
|
|
|
List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record); |
|
|
|
if (voList.isEmpty()) { |
|
|
|
return null; |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", null); |
|
|
|
} |
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
if (voList.size() == 1) { |
|
|
|
return voList.get(0); |
|
|
|
data.put("size", 1); |
|
|
|
data.put("data", voList.get(0)); |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", data); |
|
|
|
} |
|
|
|
Long finalCouponId = couponId; |
|
|
|
voList = voList.stream() |
|
|
|
@@ -157,7 +161,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
int size = voList.size(); |
|
|
|
Random random = new Random(); |
|
|
|
return voList.get(random.nextInt(size)); |
|
|
|
data.put("size", size); |
|
|
|
data.put("data", voList.get(random.nextInt(size))); |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", data); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isCouponMerchantValid(Long couponId) { |
|
|
|
|