bug
This commit is contained in:
parent
6b7658eb89
commit
72de644618
@ -62,7 +62,5 @@ public class CardFavorableRecord extends Model<CardFavorableRecord> {
|
|||||||
private Double discountAmount;
|
private Double discountAmount;
|
||||||
//满足金额
|
//满足金额
|
||||||
private Double satisfiedAmount;
|
private Double satisfiedAmount;
|
||||||
//折扣抵消
|
|
||||||
private Double discountOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,11 +245,13 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
|||||||
queryWrapper.eq(CardFavorableRecord::getMtUserId,nowAccountInfo.getId());
|
queryWrapper.eq(CardFavorableRecord::getMtUserId,nowAccountInfo.getId());
|
||||||
queryWrapper.eq(CardFavorableRecord::getStoreId,cardFavorableRecord.getStoreId());
|
queryWrapper.eq(CardFavorableRecord::getStoreId,cardFavorableRecord.getStoreId());
|
||||||
//如果领过券 就不让领了
|
//如果领过券 就不让领了
|
||||||
List<CardFavorableRecord> list = list(queryWrapper);
|
List<CardFavorableRecord> list = cardFavorableRecordMapper.selectList(queryWrapper);
|
||||||
|
// List<CardFavorableRecord> list = list(queryWrapper);
|
||||||
if (CollectionUtils.isEmpty(list) && CollectionUtils.isNotEmpty(list1) && list.size() <list1.size()){
|
if (CollectionUtils.isEmpty(list) && CollectionUtils.isNotEmpty(list1) && list.size() <list1.size()){
|
||||||
isDrawDown = true;
|
isDrawDown = true;
|
||||||
}
|
}
|
||||||
return isDrawDown;
|
return isDrawDown;
|
||||||
|
//return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -124,23 +125,75 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
|||||||
queryWrapper1.eq(CardFavorableRecord::getMtUserId,TokenUtil.getNowAccountInfo().getId());
|
queryWrapper1.eq(CardFavorableRecord::getMtUserId,TokenUtil.getNowAccountInfo().getId());
|
||||||
queryWrapper1.eq(CardFavorableRecord::getStoreId,storeId);
|
queryWrapper1.eq(CardFavorableRecord::getStoreId,storeId);
|
||||||
List<CardFavorableRecord> list = cardFavorableRecordService.list(queryWrapper1);
|
List<CardFavorableRecord> list = cardFavorableRecordService.list(queryWrapper1);
|
||||||
if (CollectionUtils.isNotEmpty(list)){
|
//只查询当天的数据
|
||||||
|
queryWrapper1.ge(CardFavorableRecord::getCreateTime, LocalDateTime.now().minusDays(1));
|
||||||
|
List<CardFavorableRecord> list1= cardFavorableRecordService.list(queryWrapper1);
|
||||||
|
//所有领取列表的券ids
|
||||||
|
ArrayList<Integer> carFavorbleRecordIds = new ArrayList<>();
|
||||||
|
//领取列表的券ids限领一张
|
||||||
|
ArrayList<Integer> carFavorbleIds = new ArrayList<>();
|
||||||
|
ArrayList<Integer> carFavorbleIds2 = new ArrayList<>();
|
||||||
|
//领取列表的券ids
|
||||||
|
ArrayList<Integer> carFavorbleIds1 = new ArrayList<>();
|
||||||
|
for (CardFavorableRecord cardFavorableRecord : list) {
|
||||||
|
Integer cardFavorableId = cardFavorableRecord.getCardFavorableId();
|
||||||
|
carFavorbleRecordIds.add(cardFavorableId);
|
||||||
|
}
|
||||||
|
for (CardFavorable record : records) {
|
||||||
|
if (record.getClaimRule().equals("0")){
|
||||||
|
Integer id = record.getId();
|
||||||
|
carFavorbleIds.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//领取列表的券ids 减去 限领一张的
|
||||||
|
carFavorbleIds.removeAll(carFavorbleRecordIds);
|
||||||
|
for (Integer carFavorbleId : carFavorbleIds) {
|
||||||
|
CardFavorable one = getById(carFavorbleId);
|
||||||
|
cardFavorableArrayList.add(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CardFavorable record : records) {
|
||||||
|
if (record.getClaimRule().equals("1")){
|
||||||
|
Integer id = record.getId();
|
||||||
|
carFavorbleIds2.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//领取列表的券ids 减去 当前查询的券ids
|
||||||
|
carFavorbleIds2.removeAll(carFavorbleIds1);
|
||||||
|
for (Integer carFavorbleId : carFavorbleIds) {
|
||||||
|
CardFavorable one = getById(carFavorbleId);
|
||||||
|
cardFavorableArrayList.add(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//每人限领一张
|
||||||
|
/* if (CollectionUtils.isNotEmpty(list)){
|
||||||
for (CardFavorableRecord cardFavorableRecord : list) {
|
for (CardFavorableRecord cardFavorableRecord : list) {
|
||||||
for (CardFavorable record : records) {
|
for (CardFavorable record : records) {
|
||||||
if(record.getClaimRule().equals("0") && !cardFavorableRecord.getCardFavorableId().equals(record.getId())){
|
if(record.getClaimRule().equals("0") && !cardFavorableRecord.getCardFavorableId().equals(record.getId())){
|
||||||
CardFavorable one = getById(record.getId());
|
CardFavorable one = getById(record.getId());
|
||||||
cardFavorableArrayList.add(one);
|
cardFavorableArrayList.add(one);
|
||||||
}
|
}
|
||||||
if (record.getClaimRule().equals("1")){
|
|
||||||
//查询当天有没有领取这张券
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//每人每日限领一张
|
||||||
|
if (CollectionUtils.isNotEmpty(list1)){
|
||||||
|
for (CardFavorableRecord cardFavorableRecord : list1) {
|
||||||
|
//
|
||||||
|
for (CardFavorable record : records) {
|
||||||
|
if(record.getClaimRule().equals("1") && !cardFavorableRecord.getCardFavorableId().equals(record.getId())){
|
||||||
|
CardFavorable one = getById(record.getId());
|
||||||
|
cardFavorableArrayList.add(one);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
if (cardFavorableArrayList.size()>3){
|
if (cardFavorableArrayList.size()>3){
|
||||||
List<CardFavorable> cardFavorables = cardFavorableArrayList.subList(0, 3);
|
List<CardFavorable> cardFavorables = cardFavorableArrayList.subList(0, 3);
|
||||||
page1.setRecords(cardFavorables);
|
page1.setRecords(cardFavorables);
|
||||||
|
}else {
|
||||||
|
page1.setRecords(cardFavorableArrayList);
|
||||||
}
|
}
|
||||||
return page1;
|
return page1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user