From ea1850a0a2364e632e4ee15c0c55554e34184ba3 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Thu, 22 Apr 2021 00:20:42 +0800 Subject: [PATCH] =?UTF-8?q?'=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/HighCouponAgentController.java | 2 ++ .../com/hai/service/impl/HighCouponAgentServiceImpl.java | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index 6c83b6c7..34462404 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -201,6 +201,7 @@ public class HighCouponAgentController { @ResponseBody @ApiOperation(value = "根据代理商和卡券 查询分配的销售码") public ResponseData getCodeListByAgentCoupon(@RequestParam(name = "couponId", required = true) Long couponId, + @RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { @@ -216,6 +217,7 @@ public class HighCouponAgentController { Map map = new HashMap<>(); map.put("agentId", userInfoModel.getHighAgent().getId()); map.put("couponId", couponId); + map.put("status", status); PageHelper.startPage(pageNum,pageSize); PageInfo pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map)); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index dbfbfccc..2ed2bb97 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.github.pagehelper.PageInfo; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -20,6 +21,8 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @Auther: 胡锐 @@ -50,6 +53,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { map.put("status", 1); map.put("salesEndTimeS", new Date().getTime()); map.put("isAssignAgent", false); + List codeList = highCouponCodeService.getCouponCodeList(map); if (highCouponAgentRel.getStockCount() > codeList.size()) { @@ -58,8 +62,9 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { highCouponAgentRelMapper.insert(highCouponAgentRel); + List assignCouponCodeList = codeList.stream().limit(highCouponAgentRel.getStatus()).collect(Collectors.toList()); HighCouponAgentCode highCouponAgentCode; - for (HighCouponCode code : codeList) { + for (HighCouponCode code : assignCouponCodeList) { code.setAgentId(highCouponAgentRel.getAgentId()); code.setIsAssignAgent(true); highCouponCodeService.updateCouponCode(code);