|
|
|
@ -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<HighCouponCode> codeList = highCouponCodeService.getCouponCodeList(map); |
|
|
|
|
|
|
|
|
|
if (highCouponAgentRel.getStockCount() > codeList.size()) { |
|
|
|
@ -58,8 +62,9 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { |
|
|
|
|
|
|
|
|
|
highCouponAgentRelMapper.insert(highCouponAgentRel); |
|
|
|
|
|
|
|
|
|
List<HighCouponCode> 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); |
|
|
|
|