| | |
| | | import com.ruoyi.promotion.mapper.CouponMapper; |
| | | import com.ruoyi.promotion.mapper.CouponMemberMapper; |
| | | import com.ruoyi.promotion.service.ICouponMemberService; |
| | | import com.ruoyi.promotion.service.ICouponService; |
| | | import com.ruoyi.system.api.domain.CouponMember; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.dto.CouponMemberDTO; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Override |
| | | public PageDTO<CouponMemberVO> getCouponMemberList(CouponMemberDTO couponMemberDTO) { |
| | | LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.ON_SHELVES); |
| | | wrapper.eq(Coupon::getDelFlag,0); |
| | | List<Coupon> couponMemberList=couponMapper.selectList(wrapper); |
| | | Set<Long> CouponList = null; |
| | |
| | | LambdaQueryWrapper<CouponMember> wrapper1= Wrappers.lambdaQuery(); |
| | | if(couponMemberDTO.getCouponStatus()!=null){ |
| | | wrapper1.eq(CouponMember::getCouponStatus, |
| | | CouponUseEnum.getEnumByCode(couponMemberDTO.getCouponStatus()+1)); |
| | | CouponUseEnum.getEnumByCode(couponMemberDTO.getCouponStatus())); |
| | | } |
| | | if (CouponList.size()>0){ |
| | | wrapper1.notIn(CouponMember::getCouponId,CouponList); |
| | | wrapper1.in(CouponMember::getCouponId,CouponList); |
| | | } |
| | | wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); |
| | | wrapper1.eq(CouponMember::getDelFlag,0); |
| | |
| | | |
| | | @Override |
| | | public List<CouponMemberVO> getCouponMemberl(CouponMemberDTO couponMemberDTO) { |
| | | |
| | | LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.ON_SHELVES); |
| | | wrapper.eq(Coupon::getDelFlag,0); |
| | | List<Coupon> couponMemberList=couponMapper.selectList(wrapper); |
| | | Set<Long> CouponList = null; |
| | |
| | | .collect(Collectors.toSet()); |
| | | |
| | | LambdaQueryWrapper<CouponMember> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(CouponMember::getCouponStatus, |
| | | CouponUseEnum.getEnumByCode(couponMemberDTO.getCouponStatus()+1)); |
| | | wrapper1.eq(CouponMember::getCouponStatus, 0); |
| | | wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); |
| | | if (CouponList.size()>0){ |
| | | wrapper1.notIn(CouponMember::getCouponId,CouponList); |
| | | wrapper1.in(CouponMember::getCouponId,CouponList); |
| | | } |
| | | wrapper1.eq(CouponMember::getDelFlag,0); |
| | | List<CouponMember> page1 = this.list(wrapper1); |
| | |
| | | public List<CouponMemberVO> updCouponMember1(CouponMemberDTO couponMemberDTO) { |
| | | |
| | | LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); |
| | | wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.ON_SHELVES); |
| | | wrapper.eq(Coupon::getDelFlag,0); |
| | | List<Coupon> couponMemberList=couponMapper.selectList(wrapper); |
| | | Set<Long> CouponList = null; |
| | | CouponList = couponMemberList.stream().map(Coupon::getId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | |
| | | LambdaQueryWrapper<CouponMember> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(CouponMember::getCouponStatus, |
| | | CouponUseEnum.getEnumByCode(couponMemberDTO.getCouponStatus())); |
| | | if (CouponList.size()>0){ |
| | | wrapper1.notIn(CouponMember::getCouponId,CouponList); |
| | | } |
| | | wrapper1.eq(CouponMember::getCouponStatus, 0); |
| | | wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); |
| | | if (CouponList.size()>0){ |
| | | wrapper1.in(CouponMember::getCouponId,CouponList); |
| | | } |
| | | wrapper1.eq(CouponMember::getDelFlag,0); |
| | | List<CouponMember> page1 = this.list(wrapper1); |
| | | List<CouponMemberVO> couponMemberVOS=new ArrayList<>(); |
| | |
| | | } |
| | | return couponMemberVOS; |
| | | } |
| | | |
| | | @Override |
| | | public void timingCheckMemberCoupon() { |
| | | this.baseMapper.timingCheckMemberCoupon(); |
| | | } |
| | | } |